summaryrefslogtreecommitdiff
path: root/playbooks/roles/mail/tasks/main.yml
blob: 12b789d55bb8276ea536d2b9a91f9c55a5359463 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---

- name: Build mail compose dirs
  ansible.builtin.file:
    state: directory
    dest: '{{ mail_base }}/{{ item.path }}'
    owner: 1000
    group: 1000
    mode: 0755
  with_filetree: '../templates'
  when: item.state == 'directory'

- name: Build mail compose files
  ansible.builtin.template:
    src: '{{ item.src }}'
    dest: '{{ mail_base }}/{{ item.path }}'
    owner: 1000
    group: 1000
    mode: 0755
  with_filetree: '../templates'
  when: item.state == 'file'

# https://github.com/docker-mailserver/docker-mailserver/blob/23bb1c8e50dad1462c645b8a9cf50aeee8bc2625/Dockerfile#L149C19-L149C20
- name: Build DMS compose dirs
  ansible.builtin.file:
    state: directory
    dest: '{{ mail_base }}/volumes/data/dms/{{ item.path }}'
    owner: 5000
    group: 5000
    mode: 0755
  with_filetree: '../templates/volumes/data/dms'
  when: item.state == 'directory'

- name: Build DMS template files with correct UID for docker mailserver
  ansible.builtin.template:
    src: '{{ item.src }}'
    dest: '{{ mail_base }}/volumes/data/dms/{{ item.path }}'
    owner: 5000
    group: 5000
    mode: 0755
  with_filetree: '../templates/volumes/data/dms'
  when: item.state == 'file'

- name: Build Roundcube compose dirs
  ansible.builtin.file:
    state: directory
    dest: '{{ mail_base }}/volumes/data/roundcube/{{ item.path }}'
    mode: 0755
    # https://github.com/roundcube/roundcubemail-docker/blob/ef4b8cc59eecbf0e25c66c7f3c464594cc310761/apache/Dockerfile#L145
    owner: 33 
    group: 33
  with_filetree: '../templates/volumes/data/roundcube'
  when: item.state == 'directory'

- name: Build Roundcube template files
  ansible.builtin.template:
    src: '{{ item.src }}'
    dest: '{{ mail_base }}/volumes/data/roundcube/{{ item.path }}'
    owner: 33
    group: 33
    mode: 0755
  with_filetree: '../templates/volumes/data/roundcube'
  when: item.state == 'file'

- name: Deploy mail stack
  ansible.builtin.command:
    cmd: 'docker stack deploy -c {{ mail_base }}/stacks/docker-compose.yml mail'