--- - name: Save kind set_fact: _kind: "{{ kind }}" - name: Get AWX object definition from pvc k8s_exec: namespace: "{{ backup_pvc_namespace }}" pod: "{{ meta.name }}-db-management" command: >- bash -c "cat '{{ backup_dir }}/awx_object'" register: awx_object - name: Create temp file for spec dict tempfile: state: file register: tmp_spec - name: Write spec vars to temp file copy: content: "{{ awx_object.stdout }}" dest: "{{ tmp_spec.path }}" mode: '0644' - name: Include spec vars to save them as a dict include_vars: "{{ tmp_spec.path }}" register: spec - name: Use include_vars to read in spec as a dict (because spec doesn't have quotes) set_fact: awx_spec: "{{ spec.ansible_facts }}" - name: Restore kind set_fact: kind: "{{ _kind }}" - name: Deploy AWX k8s: state: "{{ state | default('present') }}" namespace: "{{ meta.namespace }}" apply: yes template: awx_object.yml.j2 wait: true wait_condition: type: "Running" status: "True" - name: Remove ownerReferences to prevent garbage collection of new AWX CRO k8s: definition: apiVersion: '{{ api_version }}' kind: AWX metadata: name: '{{ deployment_name }}' namespace: '{{ meta.namespace }}' ownerReferences: null