Skip to content

Instantly share code, notes, and snippets.

@kjlubick
Created January 22, 2015 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjlubick/c42bd229c46cf44d22b6 to your computer and use it in GitHub Desktop.
Save kjlubick/c42bd229c46cf44d22b6 to your computer and use it in GitHub Desktop.
Ansible Runner to stop nginx
import ansible.runner
from ansible.inventory import Inventory
runner = ansible.runner.Runner(
module_name='shell',
module_args='nginx -s stop',
pattern='*',
sudo=True,
forks=10,
inventory=Inventory('inventory')
)
datastructure = runner.run()
print( datastructure )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment