mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 18:00:35 +00:00
ansible: Fix extra_vars so that it actually works
Also remove tmp_cmd var and fix manifest schema
This commit is contained in:
parent
84db19605a
commit
ddaf40289b
2 changed files with 10 additions and 10 deletions
|
@ -9,18 +9,20 @@ properties:
|
|||
ansible:
|
||||
type: object
|
||||
properties:
|
||||
extra_vars: {type: string}
|
||||
extra_vars:
|
||||
type: object
|
||||
minItems: 1
|
||||
tags:
|
||||
type: array
|
||||
flag: {type: string}
|
||||
items: {type: string}
|
||||
minItems: 1
|
||||
skip_tags:
|
||||
type: array
|
||||
flag: {type: string}
|
||||
items: {type: string}
|
||||
minItems: 1
|
||||
opt_flags:
|
||||
type: array
|
||||
flag: {type: string}
|
||||
items: {type: string}
|
||||
minItems: 1
|
||||
groups:
|
||||
type: array
|
||||
|
|
|
@ -3,6 +3,7 @@ from bootstrapvz.common.tasks import host
|
|||
from bootstrapvz.common import phases
|
||||
from bootstrapvz.common.tools import rel_path
|
||||
import os
|
||||
import json
|
||||
|
||||
|
||||
class AddRequiredCommands(Task):
|
||||
|
@ -68,14 +69,11 @@ class RunAnsiblePlaybook(Task):
|
|||
# build the ansible command
|
||||
cmd = ['ansible-playbook', '-i', inventory, playbook]
|
||||
if 'extra_vars' in info.manifest.plugins['ansible']:
|
||||
tmp_cmd = ['--extra-vars', '\"{}\"'.format(info.manifest.plugins['ansible']['extra_vars'])]
|
||||
cmd.extend(tmp_cmd)
|
||||
cmd.extend(['--extra-vars', json.dumps(info.manifest.plugins['ansible']['extra_vars'])])
|
||||
if 'tags' in info.manifest.plugins['ansible']:
|
||||
tmp_cmd = ['--tags={}'.format(','.join(info.manifest.plugins['ansible']['tags']))]
|
||||
cmd.extend(tmp_cmd)
|
||||
cmd.extend(['--tags', ','.join(info.manifest.plugins['ansible']['tags'])])
|
||||
if 'skip_tags' in info.manifest.plugins['ansible']:
|
||||
tmp_cmd = ['--skip-tags={}'.format(','.join(info.manifest.plugins['ansible']['skip_tags']))]
|
||||
cmd.extend(tmp_cmd)
|
||||
cmd.extend(['--skip-tags' , ','.join(info.manifest.plugins['ansible']['skip_tags'])])
|
||||
if 'opt_flags' in info.manifest.plugins['ansible']:
|
||||
# Should probably do proper validation on these, but I don't think it should be used very often.
|
||||
cmd.extend(info.manifest.plugins['ansible']['opt_flags'])
|
||||
|
|
Loading…
Add table
Reference in a new issue