sendmail: ansible-lint fixes

This commit is contained in:
Timo Makinen 2022-10-30 15:28:30 +00:00
parent 09921538da
commit 64e868fc10
2 changed files with 43 additions and 38 deletions

View file

@ -1,13 +1,19 @@
---
- name: restart sendmail
service:
- name: Restart sendmail
ansible.builtin.service:
name: sendmail
state: restarted
- name: update sendmail config
command: make -C /etc/mail all
notify: restart sendmail
- name: Update sendmail config
ansible.builtin.command:
argv:
- make
- -C
- /etc/mail
- all
notify: Restart sendmail
- name: update aliases
command: newaliases
- name: Update aliases
ansible.builtin.command:
argv:
- newaliases

View file

@ -1,7 +1,6 @@
---
- name: install packages
package:
- name: Install packages
ansible.builtin.package:
name: "{{ item }}"
state: installed
with_items:
@ -9,16 +8,16 @@
- sendmail
- sendmail-cf
- name: create root cert directory
file:
- name: Create root cert directory
ansible.builtin.file:
path: /etc/mail/certs
state: directory
mode: 0755
owner: root
group: "{{ ansible_wheel }}"
- name: copy private key
copy:
- name: Copy private key
ansible.builtin.copy:
dest: "{{ tls_private }}/{{ mail_server }}.key"
src: "{{ item }}"
mode: 0600
@ -29,10 +28,10 @@
- "/srv/ca/private/{{ mail_server }}.key"
- "/srv/ca/private/{{ inventory_hostname }}.key"
tags: certificates
notify: restart sendmail
notify: Restart sendmail
- name: copy certificate
copy:
- name: Copy certificate
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ tls_certs }}/{{ mail_server }}.crt"
mode: 0644
@ -44,10 +43,10 @@
- "/srv/ca/certs/hosts/{{ mail_server }}.crt"
- "/srv/ca/certs/hosts/{{ inventory_hostname }}.crt"
tags: certificates
notify: restart sendmail
notify: Restart sendmail
- name: copy certificate chain
copy:
- name: Copy certificate chain
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ tls_certs }}/{{ mail_server }}-chain.crt"
mode: 0644
@ -58,15 +57,15 @@
- "/srv/letsencrypt/live/{{ mail_server }}/chain.pem"
- "/srv/ca/certs/ca.crt"
tags: certificates
notify: restart sendmail
notify: Restart sendmail
- name: fix selinux contexts from data directory
sefcontext:
- name: Fix SELinux contexts from data directory
community.general.sefcontext:
path: "/export/mail(/.*)?"
setype: mail_spool_t
- name: create data directory
file:
- name: Create data directory
ansible.builtin.file:
path: /export/mail
state: directory
mode: 0775
@ -74,16 +73,16 @@
group: mail
setype: _default
- name: backup old data directory
command:
- name: Backup old data directory
ansible.builtin.command:
argv:
- mv
- /var/spool/mail
- /var/spool/mail.backup
creates: /var/spool/mail.backup
- name: link data directory
file:
- name: Link data directory
ansible.builtin.file:
path: /var/spool/mail
src: /export/mail
state: link
@ -93,27 +92,27 @@
follow: false
force: true
- name: copy sendmail config template
template:
- name: Create sendmail.mc
ansible.builtin.template:
src: sendmail.mc.j2
dest: /etc/mail/sendmail.mc
mode: 0644
owner: root
group: "{{ ansible_wheel }}"
validate: /bin/sh -c '/usr/bin/m4 %s > /dev/null'
notify: update sendmail config
notify: Update sendmail config
- name: copy aliases
copy:
- name: Copy aliases
ansible.builtin.copy:
src: aliases
dest: /etc/aliases
mode: 0644
owner: root
group: "{{ ansible_wheel }}"
notify: update aliases
notify: Update aliases
- name: enable sendmail service
service:
- name: Enable service
ansible.builtin.service:
name: sendmail
enabled: true
state: started