roles/common: Use systemd module instead of "service"
This was new in Ansible 2.2 but I didn't notice until now. All of our servers are running distributions with systemd so let's just use this.
This commit is contained in:
parent
0e409792ca
commit
0a92f3ae8f
@ -8,10 +8,10 @@
|
|||||||
service: name=iptables-persistent state=restarted
|
service: name=iptables-persistent state=restarted
|
||||||
|
|
||||||
- name: reload sshd
|
- name: reload sshd
|
||||||
service: name={{ sshd_service_name }} state=reloaded
|
systemd: name={{ sshd_service_name }} state=reloaded
|
||||||
|
|
||||||
- name: reload sysctl
|
- name: reload sysctl
|
||||||
command: sysctl -p /etc/sysctl.conf
|
command: sysctl -p /etc/sysctl.conf
|
||||||
|
|
||||||
- name: restart firewalld
|
- name: restart firewalld
|
||||||
service: name=firewalld state=restarted
|
systemd: name=firewalld state=restarted
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
command: /usr/bin/timedatectl set-timezone {{ timezone }}
|
command: /usr/bin/timedatectl set-timezone {{ timezone }}
|
||||||
tags: timezone
|
tags: timezone
|
||||||
|
|
||||||
- name: Enable systemd's NTP client
|
- name: Start and enable systemd's NTP client
|
||||||
when: ansible_service_mgr == 'systemd'
|
when: ansible_service_mgr == 'systemd'
|
||||||
service: name=systemd-timesyncd enabled=yes
|
systemd: name=systemd-timesyncd state=started enabled=yes
|
||||||
|
|
||||||
- name: Uninstall ntp on modern Ubuntu/Debian
|
- name: Uninstall ntp on modern Ubuntu/Debian
|
||||||
apt: name=ntp state=absent update_cache=yes
|
apt: name=ntp state=absent update_cache=yes
|
||||||
|
Loading…
Reference in New Issue
Block a user