[Ansible]Systemd 模块
- deamon_reload 重新载入systemd
- enabled 开机是否启动
- name 必选项
- state (reloaded、restarted、started、stopped)
# 刷新服务
ansible webservers -m systemd -a "deamon_reload=yes"
# 启动服务并开机启动
ansible webservers -m systemd -a "name=nginx enabled=yes state=started"
# 停止服务 开机禁止启动
ansible webservers -m systemd -a "name=nginx enabled=no state=stopped"
# 重启服务
ansible webservers -m systemd -a "name=nginx state=restarted"