blob: 857de8b19b2c406432699036896125f50eef1c15 [file] [log] [blame]
Scott Baker2290b052014-05-08 10:28:22 -07001import ansible.playbook
2import ansible.constants as C
3import ansible.utils.template
4from ansible import errors
5from ansible import callbacks
6from ansible import utils
7from subprocess import call
8
9class ConfigurationPush:
10 def __init__(self):
11 pass
12
13 def config_push(self, service_name, user, playbook_name,hostfile):
14 '''stats = callbacks.AggregateStats()
15 playbook_cb = callbacks.PlaybookCallbacks(verbose=utils.VERBOSITY)
16 runner_cb = callbacks.PlaybookRunnerCallbacks(stats, verbose=utils.VERBOSITY)
17 pb = ansible.playbook.PlayBook(playbook="playbook/site.yml",
18 callbacks=playbook_cb,
19 runner_callbacks=runner_cb,
20 stats=stats
21 )
22 result = pb.run()
23 print result
24 '''
25
26 call("ansible-playbook --private-key=planetw "+playbook_name+" -i "+hostfile+" -u "+user+" --extra-vars \"name="+service_name+"\"", shell=True)
27
28
29if __name__ == "__main__":
30 main()