Disable client mail task when the server is a mail server

This commit is contained in:
Nemo 2020-08-01 20:28:22 +02:00
parent 361a28add3
commit 1bd98dd13c

View file

@ -1,18 +1,20 @@
---
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"
when: "'mail_server' not in group_names"
- name: Ensure postfix is installed.
package:
name: postfix
state: present
when: "'mail_server' not in group_names"
- name: Update mail aliases.
lineinfile:
dest: "{{ aliases_config_file }}"
line: "root: {{ alias_email }}"
regexp: "^root:"
when: alias_email != "root"
when: alias_email != "root" and 'mail_server' not in group_names
notify: update aliases
- name: Update Postfix configuration.
@ -27,10 +29,12 @@
value: "{{ postfix_inet_protocols }}"
- name: myhostname
value: "{{ inventory_hostname }}"
when: "'mail_server' not in group_names"
notify: restart postfix
- name: Ensure postfix is started and enabled at boot.
service:
name: postfix
enabled: "{{ postfix_service_enabled }}"
when: "'mail_server' not in group_names"
notify: restart postfix