Skip to content

Instantly share code, notes, and snippets.

@vccabral
Created April 19, 2016 15:18
Show Gist options
  • Save vccabral/80799ed829f79fb259282f97d5ece196 to your computer and use it in GitHub Desktop.
Save vccabral/80799ed829f79fb259282f97d5ece196 to your computer and use it in GitHub Desktop.
os.environ["ANSIBLE_HOST_KEY_CHECKING"] = "False"
ansible.utils.VERBOSITY = 4
hosts = [self.address]
webInventory = ansible.inventory.Inventory(hosts)
from ansible import callbacks
from ansible import utils
stats = callbacks.AggregateStats()
playbook_cb = callbacks.PlaybookCallbacks(verbose=utils.VERBOSITY)
runner_cb = callbacks.PlaybookRunnerCallbacks(stats, verbose=utils.VERBOSITY)
ansible_response_1 = ansible.playbook.PlayBook(**{
"playbook": cloned_play_file_loc,
"inventory": webInventory,
"remote_user": self.username,
"private_key_file": self.private_key,
"callbacks": playbook_cb,
"runner_callbacks": runner_cb,
"stats": stats
}).run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment