[postfix] Fix ansible-lint issues

Signed-off-by: Michal Konecny <mkonecny@redhat.com>
This commit is contained in:
Michal Konečný 2026-03-02 16:26:13 +01:00
commit 8146e99e1b
2 changed files with 37 additions and 15 deletions

View file

@ -33,7 +33,7 @@
vars:
selinux_module_dir: /usr/local/share/zabbix
selinux_module_name: zabbix_sendmail
when: selinux_zabbix_file.changed
when: selinux_zabbix_file.changed # noqa: no-handler
tags:
- selinux
- postfix
@ -42,7 +42,7 @@
# On a fresh install, the zabbix user won't exist yet
# so don't try to set it here. The agent role will fix it later
- name: Ensure Zabbix drop-in directory
file:
ansible.builtin.file:
path: /etc/zabbix/zabbix_agentd.d
state: directory
mode: '0755'

View file

@ -8,7 +8,10 @@
- postfix
- name: /etc/postfix/main.cf
ansible.builtin.copy: src={{ item }} dest=/etc/postfix/main.cf
ansible.builtin.copy:
src: "{{ item }}"
dest: /etc/postfix/main.cf
mode: "0644"
with_first_found:
- "{{ postfix_maincf }}"
- "postfix/main.cf/main.cf.{{ ansible_fqdn }}"
@ -26,7 +29,10 @@
- smtp_auth_relay
- name: Install /etc/postfix/master.cf file
ansible.builtin.copy: src={{ item }} dest=/etc/postfix/master.cf mode=0644
ansible.builtin.copy:
src: "{{ item }}"
dest: /etc/postfix/master.cf
mode: "0644"
with_first_found:
- "postfix/master.cf/master.cf.{{ inventory_hostname }}"
- "postfix/master.cf/master.cf.{{ host_group }}"
@ -41,7 +47,10 @@
- base
- name: Deploy sender_access file
ansible.builtin.copy: src="{{private}}/files/smtpd/sender_access.{{postfix_group}}" dest="/etc/postfix/sender_access"
ansible.builtin.copy:
src: "{{ private }}/files/smtpd/sender_access.{{ postfix_group }}"
dest: "/etc/postfix/sender_access"
mode: "0644"
when: postfix_group == "smtp-mm" or postfix_group == "mailman" or postfix_group == "gateway"
notify:
- Restart postfix
@ -51,11 +60,12 @@
- base
- name: Work around s390 privatedevices bug
ini_file:
community.general.ini_file:
path: /usr/lib/systemd/system/postfix.service
section: Service
option: PrivateDevices
value: false
mode: "0644"
notify:
- Reload systemd
when: inventory_hostname.startswith(('buildvm-s390x'))
@ -65,13 +75,19 @@
- base
- name: Enable postfix to start
service: name=postfix state=started enabled=true
ansible.builtin.service:
name: postfix
state: started
enabled: true
tags:
- service
- base
- name: Install /etc/postfix/transport file
ansible.builtin.copy: src="postfix/{{ postfix_transport_filename }}" dest=/etc/postfix/transport
ansible.builtin.copy:
src: "postfix/{{ postfix_transport_filename }}"
dest: /etc/postfix/transport
mode: "0644"
when: inventory_hostname.startswith(('smtp-mm','bastion','noc02')) and env != 'staging'
notify:
- Rebuild postfix transport
@ -82,7 +98,10 @@
- config
- name: Install /etc/postfix/bysender file
ansible.builtin.copy: src="postfix/bysender" dest=/etc/postfix/bysender
ansible.builtin.copy:
src: "postfix/bysender"
dest: /etc/postfix/bysender
mode: "0644"
when: inventory_hostname.startswith(('bastion')) and env != 'staging'
notify:
- Rebuild postfix bysender
@ -93,7 +112,10 @@
- config
- name: Create /etc/postfix/tls_policy
ansible.builtin.copy: src="postfix/tls_policy" dest=/etc/postfix/tls_policy
ansible.builtin.copy:
src: "postfix/tls_policy"
dest: /etc/postfix/tls_policy
mode: "0644"
when: inventory_hostname.startswith(('bastion','smtp-mm','pagure')) and env != 'staging'
notify:
- Rebuild postfix tls_policy
@ -106,11 +128,11 @@
# This cert is a digicert one, renew it there.
- name: Install /etc/pki/tls/private/gateway-chain.pem
ansible.builtin.copy:
src="{{private}}/files/smtpd/gateway-chain.pem"
dest=/etc/pki/tls/private/gateway-chain.pem
owner=root
group=root
mode=0600
src: "{{ private }}/files/smtpd/gateway-chain.pem"
dest: /etc/pki/tls/private/gateway-chain.pem
owner: root
group: root
mode: "0600"
when: inventory_hostname.startswith(('bastion','smtp-mm')) and env != 'staging'
notify:
- Restart postfix