开启nginx服务:
ansible all -m service -a ‘name=nginx state=started’
停止nginx服务:
ansible all -m service -a ‘name=nginx state=stopped’
重启nginx服务:
ansible all -m service -a ‘name=nginx state=restarted’
重新加载httpd服务:
ansible all -m service -a ‘name=httpd state=reloaded’
开启nginx服务,同时设置开机自动启动:
ansible all -m service -a ‘name=nginx state=started enabled=yes’