mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 15:36:27 +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:
|
ansible:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
extra_vars: {type: string}
|
extra_vars:
|
||||||
|
type: object
|
||||||
|
minItems: 1
|
||||||
tags:
|
tags:
|
||||||
type: array
|
type: array
|
||||||
flag: {type: string}
|
items: {type: string}
|
||||||
minItems: 1
|
minItems: 1
|
||||||
skip_tags:
|
skip_tags:
|
||||||
type: array
|
type: array
|
||||||
flag: {type: string}
|
items: {type: string}
|
||||||
minItems: 1
|
minItems: 1
|
||||||
opt_flags:
|
opt_flags:
|
||||||
type: array
|
type: array
|
||||||
flag: {type: string}
|
items: {type: string}
|
||||||
minItems: 1
|
minItems: 1
|
||||||
groups:
|
groups:
|
||||||
type: array
|
type: array
|
||||||
|
|
|
@ -3,6 +3,7 @@ from bootstrapvz.common.tasks import host
|
||||||
from bootstrapvz.common import phases
|
from bootstrapvz.common import phases
|
||||||
from bootstrapvz.common.tools import rel_path
|
from bootstrapvz.common.tools import rel_path
|
||||||
import os
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
class AddRequiredCommands(Task):
|
class AddRequiredCommands(Task):
|
||||||
|
@ -68,14 +69,11 @@ class RunAnsiblePlaybook(Task):
|
||||||
# build the ansible command
|
# build the ansible command
|
||||||
cmd = ['ansible-playbook', '-i', inventory, playbook]
|
cmd = ['ansible-playbook', '-i', inventory, playbook]
|
||||||
if 'extra_vars' in info.manifest.plugins['ansible']:
|
if 'extra_vars' in info.manifest.plugins['ansible']:
|
||||||
tmp_cmd = ['--extra-vars', '\"{}\"'.format(info.manifest.plugins['ansible']['extra_vars'])]
|
cmd.extend(['--extra-vars', json.dumps(info.manifest.plugins['ansible']['extra_vars'])])
|
||||||
cmd.extend(tmp_cmd)
|
|
||||||
if 'tags' in info.manifest.plugins['ansible']:
|
if 'tags' in info.manifest.plugins['ansible']:
|
||||||
tmp_cmd = ['--tags={}'.format(','.join(info.manifest.plugins['ansible']['tags']))]
|
cmd.extend(['--tags', ','.join(info.manifest.plugins['ansible']['tags'])])
|
||||||
cmd.extend(tmp_cmd)
|
|
||||||
if 'skip_tags' in info.manifest.plugins['ansible']:
|
if 'skip_tags' in info.manifest.plugins['ansible']:
|
||||||
tmp_cmd = ['--skip-tags={}'.format(','.join(info.manifest.plugins['ansible']['skip_tags']))]
|
cmd.extend(['--skip-tags' , ','.join(info.manifest.plugins['ansible']['skip_tags'])])
|
||||||
cmd.extend(tmp_cmd)
|
|
||||||
if 'opt_flags' in info.manifest.plugins['ansible']:
|
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.
|
# 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'])
|
cmd.extend(info.manifest.plugins['ansible']['opt_flags'])
|
||||||
|
|
Loading…
Add table
Reference in a new issue