Hi all,
I have a dictionary with a nested dictionary defined in defaults/main.yml
of my role:
file_system_system_vg:
name: "A Name"
lv: {}
where lv is the nested dictionary.
I can use the nested dictionary in a task like this:
- name: Create Logicals Volumes on primary VG
lvol: vg={{ file_system_system_vg.name }} lv={{ item.value.name }} size={{
item.value.size }}
with_dict: *file_system_system_vg.lv*
This all works fine when file_system_system_vg is defined, but i would like
to remove it from defaults/main.yml and only run the task when
file_system_system_vg.*lv* is defined elsewhere, so I have tried this:
- name: Create Logicals Volumes on primary VG
lvol: vg={{ file_system_system_vg.name }} lv={{ item.value.name }} size={{
item.value.size }}
with_dict: *file_system_system_vg.lv | default ({})*
but it throws an error:
TASK: [file_system | Create Logicals Volumes on primary VG]
*******************
fatal: [dsdptgfc06v.devqa.exch.int] => with_dict expects a dict
Please note that file_system_system_vg is not defined here and neither is
file_system_system_vg.lv.
Does this make sense?
How can I make ansible skip this task when both file_system_system_vg and
file_system_system_vg.lv
are undefined?
N.B when I run the task I need to use the dictionaries within
file_system_system_vg.lv
Thanks in advance
Paddy
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/7316a29e-b7f8-4a18-bdfa-40410c73d2fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.