| import ansible.constants as C |
| import ansible.utils.template |
| from ansible import errors |
| from ansible import callbacks |
| from ansible import utils |
| from subprocess import call |
| def config_push(self, service_name, user, playbook_name,hostfile): |
| '''stats = callbacks.AggregateStats() |
| playbook_cb = callbacks.PlaybookCallbacks(verbose=utils.VERBOSITY) |
| runner_cb = callbacks.PlaybookRunnerCallbacks(stats, verbose=utils.VERBOSITY) |
| pb = ansible.playbook.PlayBook(playbook="playbook/site.yml", |
| runner_callbacks=runner_cb, |
| call("ansible-playbook --private-key=planetw "+playbook_name+" -i "+hostfile+" -u "+user+" --extra-vars \"name="+service_name+"\"", shell=True) |
| if __name__ == "__main__": |