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:
Alan Orth 2017-11-02 18:55:20 +02:00
parent 0e409792ca
commit 0a92f3ae8f
2 changed files with 4 additions and 4 deletions

View File

@ -8,10 +8,10 @@
service: name=iptables-persistent state=restarted
- name: reload sshd
service: name={{ sshd_service_name }} state=reloaded
systemd: name={{ sshd_service_name }} state=reloaded
- name: reload sysctl
command: sysctl -p /etc/sysctl.conf
- name: restart firewalld
service: name=firewalld state=restarted
systemd: name=firewalld state=restarted

View File

@ -8,9 +8,9 @@
command: /usr/bin/timedatectl set-timezone {{ timezone }}
tags: timezone
- name: Enable systemd's NTP client
- name: Start and enable systemd's NTP client
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
apt: name=ntp state=absent update_cache=yes