Don't combine start/restart and rename cfg to conf

This commit is contained in:
Wojciech Kozlowski 2022-08-30 15:51:02 +02:00
parent 2045cbd4d8
commit 86170d0393

View File

@ -18,7 +18,7 @@
src: ./root/etc/ssh/sshd_config.d/00-yggdrasil.conf.j2
dest: /etc/ssh/sshd_config.d/00-yggdrasil.conf
mode: 0600
register: sshd_cfg
register: sshd_conf
- name: Restart sshd
service:
@ -26,7 +26,7 @@
enabled: yes
state: restarted
when:
sshd_cfg is changed
sshd_conf is changed
# -------------------------------------------------------------------------
# Firewall configuration.
@ -35,23 +35,26 @@
- name: Install nftables
apt:
name: nftables
register: nftables_install
- name: Configure nftables
template:
src: ./root/etc/nftables.conf.j2
dest: /etc/nftables.conf
mode: 0755
register: nftables_cfg
register: nftables_conf
- name: Enable/start/restart nftables
- name: Enable/start nftables
service:
name: nftables
state: started
enabled: yes
- name: Restart nftables
service:
name: nftables
state: restarted
enabled: yes
when:
nftables_install is changed or
nftables_cfg is changed
nftables_conf is changed
# ----------------------------------------------------------------------------------------------
# NTP configuration.
@ -101,14 +104,13 @@
- postfix
- ca-certificates
- libsasl2-modules
register: mail_postfix_install
- name: Configure postfix
template:
src: ./root/etc/postfix/main.cf.j2
dest: /etc/postfix/main.cf
mode: 0644
register: mail_postfix_cfg
register: mail_postfix_conf
- name: Configure credentials
template:
@ -127,16 +129,20 @@
path: /etc/postfix/sasl_passwd.db
mode: 0600
- name: Enable/start/restart postfix
- name: Enable/start postfix
service:
name: postfix
enabled: yes
state: started
- name: Restart postfix
service:
name: postfix
state: restarted
when:
mail_mailname is changed or
mail_aliases is changed or
mail_postfix_install is changed or
mail_postfix_cfg is changed or
mail_postfix_conf is changed or
mail_postfix_credentials is changed
# ----------------------------------------------------------------------------------------------
@ -255,20 +261,23 @@
- name: Install acpupsd
apt:
name: apcupsd
register: apcupsd_install
- name: Apcupsd configuration
copy:
src: ./root/etc/apcupsd/apcupsd.conf
dest: /etc/apcupsd/apcupsd.conf
mode: 0644
register: apcupsd_cfg
register: apcupsd_conf
- name: Enable/start/restart apcupsd
- name: Enable/start apcupsd
service:
name: apcupsd
enabled: yes
state: started
- name: Restart apcupsd
service:
name: apcupsd
state: restarted
when:
apcupsd_install is changed or
apcupsd_cfg is changed
apcupsd_conf is changed