Initial commit

This commit is contained in:
2022-03-15 02:56:50 +01:00
commit f2b39b5f88
9 changed files with 149 additions and 0 deletions

51
tasks/main.yml Normal file
View File

@@ -0,0 +1,51 @@
- name: Check that a username and password is supplied
assert:
that:
- (relay_user is defined) and (relay_user is not none)
- (relay_password is defined) and
(relay_password is not none)
fail_msg: "'relay_user' and 'relay_password' must be set"
success_msg: "username and password for relay is set"
- name: Check that we have supplied a recipient address
assert:
that:
- (external_email_address is defined) and
(external_email_address is not none)
fail_msg: "'external_email_address' must be set. Local
mail will be forwarded to this address"
success_msg: "Recipient address is set"
- name: Install Postfix and s-nail
package:
state: present
name: "{{ item }}"
with_items:
- postfix
- s-nail
notify: Activate and restart Postfix
- name: Configure Postfix
template:
src: main.cf.j2
dest: /etc/postfix/main.cf
notify: Activate and restart Postfix
- name: Copy Postfix authentication
template:
src: sasl_passwd.j2
dest: /etc/postfix/sasl_passwd
mode: 0600
notify: Generate SASL
- name: Copy alisases
template:
src: aliases.j2
dest: /etc/aliases
notify: Generate aliases
- name: Copy sender_canonical
template:
src: sender_canonical.j2
dest: /etc/postfix/sender_canonical
notify: Generate sender_canonical