| step_dir = Config().observer_steps_dir |
| step_dir = '/opt/planetstack/observer/steps' |
| os_template_loader = jinja2.FileSystemLoader( searchpath=step_dir) |
| os_template_env = jinja2.Environment(loader=os_template_loader) |
| magic_str = 'ok: [127.0.0.1] => ' |
| magic_str2 = 'changed: [127.0.0.1] => ' |
| if (l.startswith(magic_str)): |
| elif (l.startswith(magic_str2)): |
| def run_template(name, opts): |
| template = os_template_env.get_template(name) |
| buffer = template.render(opts) |
| f = tempfile.NamedTemporaryFile(mode='w') |
| run = os.popen('/opt/planetstack/observer/run_ansible '+f.name) |
| ok_results = parse_output(msg) |
| run_template('ansible/sync_user_deployments.yaml',{ "endpoint" : "http://172.31.38.128:5000/v2.0/", |
| "email": "gwsapan@gmail.com", |
| "admin_password":"6a789bf69dd647e2", |
| "roles":['user','admin'] }) |