diff --git a/roles/php_website/molecule/default/prepare.yml b/roles/php_website/molecule/default/prepare.yml index 70666084c706b9fb686296155221f48a65dd9119..4b47547e8ff5e7ad4f4d0b1c861653b74e35737d 100644 --- a/roles/php_website/molecule/default/prepare.yml +++ b/roles/php_website/molecule/default/prepare.yml @@ -38,6 +38,32 @@ name: postfix state: present + - name: Install procmail for consistency with mail_server and mail_forwarder roles + apt: + name: procmail + state: present + + - name: Update Postfix configuration + lineinfile: + path: /etc/postfix/main.cf + regexp: "^{{ item.key }}" + line: "{{ item.value }}" + state: present + with_dict: + myhostname: "myhostname = {{ inventory_hostname }}" + mailbox_command: 'mailbox_command = procmail -a "$EXTENSION"' + notify: + - Restart Postfix + + - name: Direct all mails from the root account to vagrant (Stretch image does not do that by default) + lineinfile: + path: /etc/aliases + regexp: "^root" + line: "root: vagrant" + state: present + notify: + - Generate aliases database + - name: Set-up group for an additional user group: name: user @@ -48,3 +74,13 @@ name: user group: user shell: /bin/bash + + handlers: + + - name: Restart Postfix + service: + name: postfix + state: restarted + + - name: Generate aliases database + command: "/usr/bin/newaliases"