1、启动服务:
ansible all -m service -a "name=nagios state=started"
2、停止服务:
ansible all -m service -a "name=nagios state=stopped"
3、重启服务:
ansible all -m service -a "name=nagios state=restarted"
4、开机启动:
ansible all -m service -a "name=nagios enable=yes"
5、停止开机启动:
ansible all -m service -a "name=nagios enable=no"
6、带参数启动:
ansible all -m service -a "name=network state=restarted args=eth0"