extra_vars pour firstboot
This commit is contained in:
parent
af32a4570e
commit
fae0fe36b6
3 changed files with 16 additions and 2 deletions
|
@ -20,3 +20,8 @@
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: linuxinstaller-firstboot
|
name: linuxinstaller-firstboot
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
|
- name: Ajoute extra_packages
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: "{{ extra_packages }}"
|
||||||
|
when: extra_packages is defined
|
||||||
|
|
|
@ -5,6 +5,9 @@ ansiblemenu:
|
||||||
argument_help: Ne présente pas le menu et prépare le système au premier démarrage
|
argument_help: Ne présente pas le menu et prépare le système au premier démarrage
|
||||||
playbook: firstboot.yml
|
playbook: firstboot.yml
|
||||||
menu_hidden: true
|
menu_hidden: true
|
||||||
|
extra_vars:
|
||||||
|
extra_packages:
|
||||||
|
- apt-auto-update
|
||||||
|
|
||||||
update:
|
update:
|
||||||
menu_title: Exécuter la mise à jour des paquets
|
menu_title: Exécuter la mise à jour des paquets
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import json
|
||||||
|
|
||||||
def runAnsiblePlaybook(config, key):
|
def runAnsiblePlaybook(config, key):
|
||||||
subprocess.check_call(['ansible-playbook', config['ansiblemenu'][key]['playbook']], cwd=config['base_path'])
|
if config['ansiblemenu'][key]['extra_vars'] is null:
|
||||||
|
subprocess.check_call(['ansible-playbook', config['ansiblemenu'][key]['playbook']], cwd=config['base_path'])
|
||||||
|
else:
|
||||||
|
subprocess.check_call(['ansible-playbook', config['ansiblemenu'][key]['playbook'],
|
||||||
|
'--extra-vars', json.dumps(config['ansiblemenu'][key]['extra_vars']) ],
|
||||||
|
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])
|
||||||
|
|
Loading…
Reference in a new issue