You've already forked ansible-role-common
Move postfix configuration to block
This commit is contained in:
@@ -1,36 +1,39 @@
|
||||
---
|
||||
- name: Apply postfix configuration
|
||||
lineinfile:
|
||||
dest: "{{item.dest}}"
|
||||
regexp: "{{item.regexp}}"
|
||||
line: "{{item.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"
|
||||
}
|
||||
- name: Postfix Configuration
|
||||
block:
|
||||
- name: postfix | Apply postfix configuration
|
||||
lineinfile:
|
||||
dest: "{{item.dest}}"
|
||||
regexp: "{{item.regexp}}"
|
||||
line: "{{item.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"
|
||||
}
|
||||
|
||||
- name: Ensure Postfix is Started/Enabled
|
||||
service:
|
||||
name: postfix
|
||||
state: started
|
||||
enabled: yes
|
||||
- name: postfix | Ensure Postfix is Started/Enabled
|
||||
service:
|
||||
name: postfix
|
||||
state: started
|
||||
enabled: yes
|
||||
when: "{{ postfix_configure }}"
|
||||
|
||||
- name: Ensure root forwarding address is set
|
||||
lineinfile:
|
||||
|
||||
Reference in New Issue
Block a user