Files
ansible-role-common/tasks/communication.yml

47 lines
1.3 KiB
YAML
Raw Normal View History

---
2018-06-27 21:13:40 +12:00
- name: Postfix Configuration
block:
- name: postfix | Apply postfix configuration
lineinfile:
2022-03-11 22:02:17 +13:00
dest: "{{ item.dest }}"
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
2018-06-27 21:13:40 +12:00
insertafter: EOF
notify: Restart Postfix
when: "'SMTP0' not in inventory_hostname"
with_items:
2022-04-03 13:20:47 +12:00
- {
dest: /etc/postfix/main.cf,
regexp: "^.?inet_protocols =",
2022-04-03 13:20:47 +12:00
line: "inet_protocols = ipv4",
2018-06-27 21:13:40 +12:00
}
2022-04-03 13:20:47 +12:00
- {
dest: /etc/postfix/main.cf,
regexp: "^.?inet_interfaces =",
2022-04-03 13:20:47 +12:00
line: "inet_interfaces = all",
2018-06-27 21:13:40 +12:00
}
2022-04-03 13:20:47 +12:00
- {
dest: /etc/postfix/main.cf,
regexp: "^.?relayhost =",
2022-04-03 13:20:47 +12:00
line: "relayhost = {{ relayhost }}",
2018-06-27 21:13:40 +12:00
}
- {
dest: /etc/postfix/main.cf,
regexp: "^.?smtp_randomize_addresses =",
2022-04-03 13:20:47 +12:00
line: "smtp_randomize_addresses = no",
2018-06-27 21:13:40 +12:00
}
2018-06-27 21:13:40 +12:00
- name: postfix | Ensure Postfix is Started/Enabled
service:
name: postfix
state: started
enabled: yes
2018-06-29 21:05:57 +12:00
when: postfix_configure
- name: Ensure root forwarding address is set
lineinfile:
dest: ~/.forward
2022-03-11 20:21:44 +13:00
regexp: "{{ common_root_email }}"
line: "{{ common_root_email }}"
create: yes