From d9897aa51ef5106dca1ab7cb46f7575e7d7077b4 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Mon, 19 Aug 2019 16:06:35 +0200 Subject: [PATCH] Reformatted YML files --- ansible/roles/ispmail-database/tasks/main.yml | 46 +++++++++-------- ansible/roles/ispmail-postfix/handlers/main.yml | 1 - ansible/roles/ispmail-postfix/tasks/main.yml | 69 +++++++++++++++---------- ansible/roles/ispmail-webmail/tasks/main.yml | 41 +++++++++++---- 4 files changed, 96 insertions(+), 61 deletions(-) diff --git a/ansible/roles/ispmail-database/tasks/main.yml b/ansible/roles/ispmail-database/tasks/main.yml index 633a278..2b30304 100644 --- a/ansible/roles/ispmail-database/tasks/main.yml +++ b/ansible/roles/ispmail-database/tasks/main.yml @@ -3,15 +3,6 @@ # apt: name=python-mysqldb apt: name=python-pymysql -# - name: Set root user password -# become: true -# # If .my.cnf already exists, this will cause an mysql-root-password update. -# mysql_user: -# name: root -# password: "{{ ispmail_mysql_root_password}}" -# login_unix_socket: /var/run/mysqld/mysqld.sock -# check_implicit_admin: true - - name: Set a new root password mysql_user: check_implicit_admin: yes @@ -37,24 +28,35 @@ name: mailserver - name: creating Roundcube MySQL database - mysql_db: name=roundcube + mysql_db: + name: roundcube - name: copying MySQL database schema to server - copy: src=schema.sql dest=/tmp + copy: + src: schema.sql + dest: /tmp - name: setting up SQL schema of mailserver database - mysql_db: name=mailserver state=import target=/tmp/schema.sql -# - name: set the MySQL root user's password - # mysql_user: name=root password={{ispmail_mysql_root_password}} + mysql_db: + name: mailserver + state: import + target: /tmp/schema.sql - name: creating MySQL user to read the mailserver database - mysql_user: name=mailuser password={{ispmail_mysql_mailuser_password}} priv=mailserver.*:SELECT,INSERT,UPDATE,DELETE + mysql_user: + name: mailuser + password: "{{ispmail_mysql_mailuser_password}}" + priv: mailserver.*:SELECT,INSERT,UPDATE,DELETE - name: creating MySQL user for roundcube - mysql_user: name=roundcube password={{ispmail_mysql_roundcube_password}} priv=roundcube.*:ALL + mysql_user: + name: roundcube + password: "{{ispmail_mysql_roundcube_password}}" + priv: roundcube.*:ALL - name: copying MySQL test data to server - copy: src=test.sql dest=/tmp + copy: + src: test.sql + dest: /tmp when: ispmail_populate_test_data == true - name: populating the database with test data - mysql_db: name=mailserver state=import target=/tmp/test.sql + mysql_db: + name: mailserver + state: import + target: /tmp/test.sql when: ispmail_populate_test_data == true -# - name: set the MySQL root user's password -# mysql_user: name=root password={{ispmail_mysql_root_password}} -# - name: Create root's .my.cnf -# template: src=my-cnf.j2 dest=/root/.my.cnf mode=0600 diff --git a/ansible/roles/ispmail-postfix/handlers/main.yml b/ansible/roles/ispmail-postfix/handlers/main.yml index fd520ac..9398ba4 100644 --- a/ansible/roles/ispmail-postfix/handlers/main.yml +++ b/ansible/roles/ispmail-postfix/handlers/main.yml @@ -4,4 +4,3 @@ - name: restart spamassassin service: name=spamassassin state=restarted - diff --git a/ansible/roles/ispmail-postfix/tasks/main.yml b/ansible/roles/ispmail-postfix/tasks/main.yml index 88b6ff3..313f85e 100644 --- a/ansible/roles/ispmail-postfix/tasks/main.yml +++ b/ansible/roles/ispmail-postfix/tasks/main.yml @@ -1,34 +1,49 @@ --- - name: define Postfix virtual mailbox domain mapping - template: src=mysql-virtual-mailbox-domains.cf.j2 dest=/etc/postfix/mysql-virtual-mailbox-domains.cf + template: + src: "{{item}}.j2" + dest: "/etc/postfix/{{item}}" + mode: 0640 notify: restart postfix -- name: tell Postfix to use the virtual mailbox domain mapping - command: postconf virtual_mailbox_domains=mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf - -- name: define Postfix virtual mailbox mapping - template: src=mysql-virtual-mailbox-maps.cf.j2 dest=/etc/postfix/mysql-virtual-mailbox-maps.cf - notify: restart postfix -- name: tell Postfix to use the virtual mailbox mapping - command: postconf virtual_mailbox_maps=mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf - -- name: define Postfix virtual alias mapping - template: src=mysql-virtual-alias-maps.cf.j2 dest=/etc/postfix/mysql-virtual-alias-maps.cf - notify: restart postfix -- name: tell Postfix to use the virtual alias mapping - command: postconf virtual_alias_maps=mysql:/etc/postfix/mysql-virtual-alias-maps.cf - -- name: define Postfix email-to-email mapping (required for catchall domains) - template: src=mysql-email2email.cf.j2 dest=/etc/postfix/mysql-email2email.cf - notify: restart postfix -- name: tell Postfix to use the email-to-email mapping - command: postconf virtual_alias_maps=mysql:/etc/postfix/mysql-virtual-alias-maps.cf,mysql:/etc/postfix/mysql-email2email.cf - -- name: Restricting access to database mapping files that contain a password - file: path=/etc/postfix/mysql-{{item}}.cf mode=0640 with_items: - - virtual-mailbox-domains - - virtual-mailbox-maps - - virtual-alias-maps + - mysql-virtual-mailbox-domains.cf + - mysql-virtual-mailbox-maps.cf + - mysql-virtual-alias-maps.cf + - mysql-email2email.cf + +- name: copy master.cf to enable submission service + copy: + src: master.cf + dest: /etc/postfix/master.cf + mode: 0644 + +# - name: tell Postfix to use the virtual mailbox domain mapping +# command: postconf virtual_mailbox_domains=mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf + +# - name: define Postfix virtual mailbox mapping +# template: src=mysql-virtual-mailbox-maps.cf.j2 dest=/etc/postfix/mysql-virtual-mailbox-maps.cf +# notify: restart postfix +# - name: tell Postfix to use the virtual mailbox mapping +# command: postconf virtual_mailbox_maps=mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf + +# - name: define Postfix virtual alias mapping +# template: src=mysql-virtual-alias-maps.cf.j2 dest=/etc/postfix/mysql-virtual-alias-maps.cf +# notify: restart postfix +# - name: tell Postfix to use the virtual alias mapping +# command: postconf virtual_alias_maps=mysql:/etc/postfix/mysql-virtual-alias-maps.cf + +# - name: define Postfix email-to-email mapping (required for catchall domains) +# template: src=mysql-email2email.cf.j2 dest=/etc/postfix/mysql-email2email.cf +# notify: restart postfix +# - name: tell Postfix to use the email-to-email mapping +# command: postconf virtual_alias_maps=mysql:/etc/postfix/mysql-virtual-alias-maps.cf,mysql:/etc/postfix/mysql-email2email.cf + +# - name: Restricting access to database mapping files that contain a password +# file: path=/etc/postfix/mysql-{{item}}.cf mode=0640 +# with_items: +# - virtual-mailbox-domains +# - virtual-mailbox-maps +# - virtual-alias-maps - name: Make Postfix use LMTP to send emails to Dovecot command: postconf virtual_transport=lmtp:unix:private/dovecot-lmtp diff --git a/ansible/roles/ispmail-webmail/tasks/main.yml b/ansible/roles/ispmail-webmail/tasks/main.yml index 277c942..cd350b2 100644 --- a/ansible/roles/ispmail-webmail/tasks/main.yml +++ b/ansible/roles/ispmail-webmail/tasks/main.yml @@ -1,21 +1,40 @@ --- -- name: adding Jessie backports repository (for Roundcube) - apt_repository: repo='deb http://http.debian.net/debian jessie-backports main' state=present - name: install required binary packages - apt: name={{item}} state=installed - with_items: - - roundcube - - roundcube-plugins + apt: + name: "{{ packages }}" + update_cache: yes + vars: + packages: + - roundcube + - roundcube-plugins - name: Creating random des_key for Roundcube shell: pwgen 24 register: roundcube_random_des_key - name: Deploying Roundcube configuration - template: src=roundcube-config.inc.php.j2 dest=/etc/roundcube/config.inc.php owner=root group=www-data mode=640 + template: + src: roundcube-config.inc.php.j2 + dest: /etc/roundcube/config.inc.php + owner: root + group: www-data + mode: 0640 - name: Deploying Roundcube managesieve plugin configuration - copy: src=roundcube-managesieve-config.inc.php dest=/etc/roundcube/plugins/managesieve/config.inc.php mode=0640 + copy: + src: roundcube-managesieve-config.inc.php + dest: /etc/roundcube/plugins/managesieve/config.inc.php + mode: 0640 - name: Deploying Roundcube password plugin configuration - template: src=roundcube-password-config.inc.php.j2 dest=/etc/roundcube/plugins/password/config.inc.php owner=root group=www-data mode=640 + template: + src: roundcube-password-config.inc.php.j2 + dest: /etc/roundcube/plugins/password/config.inc.php + owner: root + group: www-data + mode: 0640 - name: Copy ISPmail logo - copy: src=ispmail-logo.png dest=/var/lib/roundcube/ + copy: + src: ispmail-logo.png + dest: /var/lib/roundcube/ - name: Copy Roundcube database config file - template: src=roundcube-debian-db.php.j2 dest=/etc/roundcube/debian-db.php mode=0640 + template: + src: roundcube-debian-db.php.j2 + dest: /etc/roundcube/debian-db.php + mode: 0640