Packer.Images/ansible/roles/firstboot/files/ansible_payload/roles/vapp/tasks/main.yml

22 lines
717 B
YAML

- name: Store current ovfEnvironment
ansible.builtin.shell:
cmd: /usr/bin/vmtoolsd --cmd "info-get guestinfo.ovfEnv"
register: ovfenv
- name: Parse XML for vApp properties
community.general.xml:
xmlstring: "{{ ovfenv.stdout }}"
namespaces:
ns: http://schemas.dmtf.org/ovf/environment/1
xpath: /ns:Environment/ns:PropertySection/ns:Property
content: attribute
register: ovfenv
- name: Assign vApp properties to dictionary
ansible.builtin.set_fact:
ovfproperties: >-
{{ ovfproperties | default({}) |
combine({((item.values() | list)[0].values() | list)[0]:
((item.values() | list)[0].values() | list)[1]})
}}
loop: "{{ ovfenv.matches }}"
no_log: true