Disable client mail task when the server is a mail server
This commit is contained in:
parent
361a28add3
commit
1bd98dd13c
|
@ -1,18 +1,20 @@
|
||||||
---
|
---
|
||||||
- name: Include OS-specific variables.
|
- name: Include OS-specific variables.
|
||||||
include_vars: "{{ ansible_os_family }}.yml"
|
include_vars: "{{ ansible_os_family }}.yml"
|
||||||
|
when: "'mail_server' not in group_names"
|
||||||
|
|
||||||
- name: Ensure postfix is installed.
|
- name: Ensure postfix is installed.
|
||||||
package:
|
package:
|
||||||
name: postfix
|
name: postfix
|
||||||
state: present
|
state: present
|
||||||
|
when: "'mail_server' not in group_names"
|
||||||
|
|
||||||
- name: Update mail aliases.
|
- name: Update mail aliases.
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: "{{ aliases_config_file }}"
|
dest: "{{ aliases_config_file }}"
|
||||||
line: "root: {{ alias_email }}"
|
line: "root: {{ alias_email }}"
|
||||||
regexp: "^root:"
|
regexp: "^root:"
|
||||||
when: alias_email != "root"
|
when: alias_email != "root" and 'mail_server' not in group_names
|
||||||
notify: update aliases
|
notify: update aliases
|
||||||
|
|
||||||
- name: Update Postfix configuration.
|
- name: Update Postfix configuration.
|
||||||
|
@ -27,10 +29,12 @@
|
||||||
value: "{{ postfix_inet_protocols }}"
|
value: "{{ postfix_inet_protocols }}"
|
||||||
- name: myhostname
|
- name: myhostname
|
||||||
value: "{{ inventory_hostname }}"
|
value: "{{ inventory_hostname }}"
|
||||||
|
when: "'mail_server' not in group_names"
|
||||||
notify: restart postfix
|
notify: restart postfix
|
||||||
|
|
||||||
- name: Ensure postfix is started and enabled at boot.
|
- name: Ensure postfix is started and enabled at boot.
|
||||||
service:
|
service:
|
||||||
name: postfix
|
name: postfix
|
||||||
enabled: "{{ postfix_service_enabled }}"
|
enabled: "{{ postfix_service_enabled }}"
|
||||||
|
when: "'mail_server' not in group_names"
|
||||||
notify: restart postfix
|
notify: restart postfix
|
||||||
|
|
Loading…
Reference in a new issue