diff --git a/linuxinstaller/AnsibleActions.py b/linuxinstaller/AnsibleActions.py index 8540298..565876c 100644 --- a/linuxinstaller/AnsibleActions.py +++ b/linuxinstaller/AnsibleActions.py @@ -8,6 +8,9 @@ def runAnsiblePlaybook(config, key, extra_vars={}): if 'questions' in config['ansible_playbooks'][key]: for question in config['ansible_playbooks'][key]['questions'].copy(): var_name = question.pop('var_name') + # Si on a une fonction de validation dans le dictionnaire, alors on remplace la lambda sous forme de chaine par la fonction + if 'validate' in question: + question['validate'] = eval(question['validate']) extra_vars[var_name] = prompt(question)[0] if 'extra_vars' in config['ansible_playbooks'][key]: @@ -34,7 +37,6 @@ def runLocalAnsiblePlaybook(playbook, chdir, extra_vars={}): def runPulledAnsiblePlaybook(playbook, url, extra_vars={}): if len(extra_vars) > 0: subprocess.check_call(['ansible-playbook', playbook, - '--extra-vars', json.dumps(extra_vars) ], - cwd=chdir) + '--extra-vars', json.dumps(extra_vars) ]) else: subprocess.check_call(['ansible-pull', '-U', url, playbook])