diff --git a/deploy/inventory b/deploy/inventory index 6a913d6..45df2cc 100644 --- a/deploy/inventory +++ b/deploy/inventory @@ -1,2 +1,2 @@ [servers] -club_secure +club_mail diff --git a/deploy/roles/docker/tasks/main.yml b/deploy/roles/docker/tasks/main.yml new file mode 100644 index 0000000..088c52e --- /dev/null +++ b/deploy/roles/docker/tasks/main.yml @@ -0,0 +1,25 @@ +- name: Install and start docker + environment: + PYTHONPATH: "/usr/local/lib/python2.7/dist-packages" + block: + - apt_key: + url: https://download.docker.com/linux/debian/gpg + state: present + + - apt_repository: + repo: deb [arch=amd64] https://download.docker.com/linux/debian buster stable + state: present + + - apt: + name: docker-ce + state: present + + - pip: + name: docker-compose + + - systemd: + enabled: yes + state: started + daemon_reload: yes + name: docker + diff --git a/deploy/roles/mailserver/meta/main.yml b/deploy/roles/mailserver/meta/main.yml new file mode 100644 index 0000000..4a1f648 --- /dev/null +++ b/deploy/roles/mailserver/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - { role: docker } diff --git a/deploy/roles/mailserver/tasks/main.yml b/deploy/roles/mailserver/tasks/main.yml index d9d7a53..a160924 100644 --- a/deploy/roles/mailserver/tasks/main.yml +++ b/deploy/roles/mailserver/tasks/main.yml @@ -17,6 +17,11 @@ name: "{{ docker_project_folder }}/mailserver/nginx" state: directory +- name: Create db folder + file: + name: "{{ docker_project_folder }}/mailserver/db" + state: directory + - name: Copy nginx config \#1 template: src: mailman-web.conf.j2 @@ -32,6 +37,11 @@ src: smtp dest: "{{ docker_project_folder }}/mailserver" +- name: Create nginx include folder + file: + name: "{{ docker_project_folder }}/mailserver/webmail" + state: directory + - name: Copy webmail Add template: src: config.inc.php.j2 @@ -87,13 +97,13 @@ - name: Copy mailman-conf copy: - src: mailman-extra.cfg + src: mailman/mailman-extra.cfg dest: "{{ docker_project_folder }}/mailserver/mailman-extra.cfg" - name: New Mysql EntryPoint copy: - src: docker-entrypoint.sh - dest: "{{ docker_project_folder }}/mailserver/docker-entrypoint.sh" + src: db/docker-entrypoint.sh + dest: "{{ docker_project_folder }}/mailserver/db/docker-entrypoint.sh" mode: "555" - name: Copy docker-compose diff --git a/deploy/roles/mailserver/templates/docker-compose.yml.j2 b/deploy/roles/mailserver/templates/docker-compose.yml.j2 index 8ee1e76..925a924 100644 --- a/deploy/roles/mailserver/templates/docker-compose.yml.j2 +++ b/deploy/roles/mailserver/templates/docker-compose.yml.j2 @@ -29,8 +29,8 @@ services: labels: - "traefik.enable=false" networks: - defualt: - alias: + default: + aliases: - smtp imap: @@ -113,7 +113,7 @@ services: - db:db depends_on: - db - image: hardware/postfixadmin:latest + image: hardware/postfixadmin expose: - "8888" restart: always @@ -131,7 +131,7 @@ services: db: container_name: mariadb - image: mariadb:10.3 + image: mariadb:latest restart: always environment: MYSQL_ROOT_PASSWORD: {{ DB_ROOT_PASSWORD }} @@ -224,7 +224,7 @@ services: traefik: container_name: traefik - image: traefik + image: traefik:alpine command: --api --docker # Enables the web UI and tells Traefik to listen to docker restart: always ports: @@ -241,13 +241,13 @@ services: container_name: extractor image: danielhuisman/traefik-certificate-extractor volumes: - - {{ docker_data_folder }}/mailserver/traefik:/app/data + - {{ docker_project_folder }}/mailserver/traefik:/app/data - certs:/app/certs_flat labels: - "traefik.enable=false" - networks: - default: +networks: + default: volumes: mails: