Files
ansible-role-common/tasks/communication.yml
Aaron Guise 7f3147e3ee
All checks were successful
ci/woodpecker/push/1.test Pipeline was successful
Update lint pass
2023-10-05 17:06:16 +13:00

49 lines
1.3 KiB
YAML

---
- name: Postfix Configuration
when: postfix_configure
block:
- name: postfix | Apply postfix configuration
lineinfile:
dest: "{{ configurations.dest }}"
regexp: "{{ configurations.regexp }}"
line: "{{ configurations.line }}"
insertafter: EOF
notify: Restart Postfix
when: "'SMTP0' not in inventory_hostname"
with_items:
- {
dest: /etc/postfix/main.cf,
regexp: "^.?inet_protocols =",
line: "inet_protocols = ipv4",
}
- {
dest: /etc/postfix/main.cf,
regexp: "^.?inet_interfaces =",
line: "inet_interfaces = all",
}
- {
dest: /etc/postfix/main.cf,
regexp: "^.?relayhost =",
line: "relayhost = {{ relayhost }}",
}
- {
dest: /etc/postfix/main.cf,
regexp: "^.?smtp_randomize_addresses =",
line: "smtp_randomize_addresses = no",
}
loop_control:
loop_var: configurations
- name: postfix | Ensure Postfix is Started/Enabled
service:
name: postfix
state: started
enabled: yes
- name: Ensure root forwarding address is set
lineinfile:
dest: ~/.forward
regexp: "{{ common_root_email }}"
line: "{{ common_root_email }}"
create: yes