mirror of
https://github.com/Rudd-O/ansible-qubes.git
synced 2025-03-01 14:22:33 +01:00
Update qubesformation.py
This commit is contained in:
parent
45cd87d984
commit
f750054efa
@ -8,30 +8,21 @@ from ansible.plugins.action.template import ActionModule as template
|
|||||||
sys.path.insert(0, os.path.dirname(__file__))
|
sys.path.insert(0, os.path.dirname(__file__))
|
||||||
import commonlib
|
import commonlib
|
||||||
|
|
||||||
|
|
||||||
contents = """{{ vms | to_nice_yaml }}"""
|
contents = """{{ vms | to_nice_yaml }}"""
|
||||||
topcontents = "{{ saltenv }}:\n '*':\n - {{ recipename }}\n"
|
topcontents = "{{ saltenv }}:\n '*':\n - {{ recipename }}\n"
|
||||||
|
|
||||||
|
|
||||||
def generate_datastructure(vms, task_vars):
|
def generate_datastructure(vms, task_vars):
|
||||||
dc = collections.OrderedDict
|
dc = collections.OrderedDict
|
||||||
d = dc()
|
d = dc()
|
||||||
for n, data in vms.items():
|
for n, data in vms.items():
|
||||||
print(n)
|
|
||||||
# This block will skip any VMs that are not in the groups defined in the 'formation_vm_groups' variable
|
# This block will skip any VMs that are not in the groups defined in the 'formation_vm_groups' variable
|
||||||
# This allows you to deploy in multiple stages which is useful in cases
|
# This allows you to deploy in multiple stages which is useful in cases
|
||||||
# where you want to create a template after another template is already provisioned.
|
# where you want to create a template after another template is already provisioned.
|
||||||
print("hostvars")
|
if 'formation_vm_groups' in task_vars:
|
||||||
print(task_vars['hostvars'][n])
|
continueLoop = True
|
||||||
print("testy")
|
for group in task_vars['formation_vm_groups']:
|
||||||
print(task_vars['hostvars'][n]['formation_vm_groups'])
|
if n in task_vars['hostvars'][n]['groups'][group]:
|
||||||
if hasattr(task_vars.ansible_facts, 'formation_vm_groups'):
|
continueLoop = False
|
||||||
continueLoop = true
|
|
||||||
for group in task_vars.ansible_facts['formation_vm_groups']:
|
|
||||||
print("group vars")
|
|
||||||
print(task_vars.ansible_facts.groups[group])
|
|
||||||
if n in task_vars.ansible_facts.groups[group]:
|
|
||||||
continueLoop = false
|
|
||||||
if continueLoop:
|
if continueLoop:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -108,7 +99,6 @@ def generate_datastructure(vms, task_vars):
|
|||||||
|
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
class ActionModule(template):
|
class ActionModule(template):
|
||||||
|
|
||||||
TRANSFERS_FILES = True
|
TRANSFERS_FILES = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user