Open nginx service:
ansible all -m service -a ‘name=nginx state=started’
Stop nginx service:
ansible all -m service -a ‘name=nginx state=stopped’
Restart the nginx service:
ansible all -m service -a ‘name=nginx state=restarted’
Reload the httpd service:
ansible all -m service -a ‘name=httpd state=reloaded’
Start the nginx service, and set it to start automatically after booting:
ansible all -m service -a ‘name=nginx state=started enabled=yes’