Ansibleservice模块
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"
关注点赞不迷路[害羞]