上QQ阅读APP看书,第一时间看更新
The systemd module
For more advanced service management, we can use systemd as an alternative to service. The systemd module should be able to manage services on all Linux operating systems because it has the advantage of having a status special return value containing a lot of useful service data. An example playbook of how to use it is shown here:
- name: start and enable ntp service using systemd
systemd:
name: ntp
state: started
enabled: yes
masked: no
daemon_reload: yes
register: systemd
- debug:
var: systemd.status.Description
The playbook output should look as follows: