fix(debian): refs #8318 check por apparmor and postfix services

This commit is contained in:
Juan Ferrer 2024-12-18 09:32:41 +01:00
parent 67f01fd74c
commit e67b766374
2 changed files with 49 additions and 41 deletions

View File

@ -1,8 +1,12 @@
- name: Install exim packages
- name: Getting service facts to check for postfix
service_facts:
- when: "'postfix.service' not in ansible_facts.services"
block:
- name: Install exim packages
apt:
name: exim4
state: present
- name: Prepare exim configuration
- name: Prepare exim configuration
blockinfile:
path: /etc/exim4/update-exim4.conf.conf
marker_begin: '--- BEGIN VN ---'
@ -20,9 +24,9 @@
mode: u=rw,g=r,o=r
notify: update exim configuration
register: exim_config
- name: Force execution of handlers immediately
- name: Force execution of handlers immediately
meta: flush_handlers
- name: Sending mail to verify relay host configuration works
- name: Sending mail to verify relay host configuration works
shell: >
sleep 2; echo "If you see this message, relayhost on {{ ansible_fqdn }} has been configured correctly." \
| mailx -s "Relayhost test for {{ ansible_fqdn }}" "{{ sysadmin_mail }}"

View File

@ -1,12 +1,16 @@
- name: Stop AppArmor
- name: Getting service facts to check for apparmor
service_facts:
- when: "'apparmor.service' in ansible_facts.services"
block:
- name: Stop AppArmor
systemd:
name: apparmor
state: stopped
- name: Disable AppArmor service
- name: Disable AppArmor service
systemd:
name: apparmor
enabled: no
- name: Mask AppArmor service
- name: Mask AppArmor service
systemd:
name: apparmor
masked: yes