ansible-service

#service
#查询服务状态

ansible server01 -m service -a "name=httpd state=started"

#停止服务

ansible server01 -m service -a "name=httpd state=stopped"

#启动服务

ansible server01 -m command -a 'service httpd start'

#重启服务

ansible server01 -m command -a 'service httpd restart'
ansible server01 -m service -a "name=httpd state=restarted"

#查看服务启动级别

ansible server01 -m command -a "chkconfig --list httpd"

 

posted @ 2018-07-26 11:05  love19791125  阅读(608)  评论(0编辑  收藏  举报