extra_vars pour firstboot

This commit is contained in:
Navas 2024-10-19 15:43:10 +02:00
parent 60031d72cd
commit dba429c1c6

View file

@ -2,12 +2,12 @@ import subprocess
import json import json
def runAnsiblePlaybook(config, key): def runAnsiblePlaybook(config, key):
if config['ansiblemenu'][key]['extra_vars'] is None: if 'extra_vars' in config['ansiblemenu'][key]:
subprocess.check_call(['ansible-playbook', config['ansiblemenu'][key]['playbook']], cwd=config['base_path'])
else:
subprocess.check_call(['ansible-playbook', config['ansiblemenu'][key]['playbook'], subprocess.check_call(['ansible-playbook', config['ansiblemenu'][key]['playbook'],
'--extra-vars', json.dumps(config['ansiblemenu'][key]['extra_vars']) ], '--extra-vars', json.dumps(config['ansiblemenu'][key]['extra_vars']) ],
cwd=config['base_path']) cwd=config['base_path'])
else:
subprocess.check_call(['ansible-playbook', config['ansiblemenu'][key]['playbook']], cwd=config['base_path'])
def pullAnsiblePlaybook(url, playbook): def pullAnsiblePlaybook(url, playbook):
subprocess.check_call(['ansible-pull', '-U', url, playbook]) subprocess.check_call(['ansible-pull', '-U', url, playbook])