diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/vapp/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/roles/vapp/tasks/main.yml index 07615b3..3abfe05 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/vapp/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/roles/vapp/tasks/main.yml @@ -3,6 +3,20 @@ cmd: /usr/bin/vmtoolsd --cmd "info-get guestinfo.ovfEnv" register: ovfenv +- name: Parse XML for MoRef ID + community.general.xml: + xmlstring: "{{ ovfenv.stdout }}" + namespaces: + ns: http://schemas.dmtf.org/ovf/environment/1 + ve: http://www.vmware.com/schema/ovfenv + xpath: /ns:Environment + content: attribute + register: environment_attribute + +- name: Store MoRef ID + ansible.builtin.set_fact: + moref_id: "{{ ((environment_attribute.matches[0].values() | list)[0].values() | list)[1] }}" + - name: Parse XML for vApp properties community.general.xml: xmlstring: "{{ ovfenv.stdout }}" @@ -10,7 +24,7 @@ ns: http://schemas.dmtf.org/ovf/environment/1 xpath: /ns:Environment/ns:PropertySection/ns:Property content: attribute - register: ovfenv + register: property_section - name: Assign vApp properties to dictionary ansible.builtin.set_fact: @@ -19,5 +33,5 @@ combine({((item.values() | list)[0].values() | list)[0]: ((item.values() | list)[0].values() | list)[1]}) }} - loop: "{{ ovfenv.matches }}" + loop: "{{ property_section.matches }}" no_log: true