service模組:管理服務
相關選項:
name:服務名稱
state:started/stopped/restarted
enabled:true/false
runlevel:執行級別
1、啟動服務:
ansible all -m service -a “name=httpd state=started”
2、停止服務:
ansible all -m service -a “name=httpd state=stopped”
3、重啟服務:
ansible all -m service -a “name=httpd state=restarted”
4、開機啟動:
ansible all -m service -a “name=httpd enable=yes”
5、停止開機啟動:
ansible all -m service -a “name=httpd enable=no”
6、帶引數啟動:
ansible all -m service -a “name=network state=restarted args=eth0”
關注點贊不迷路[害羞]