--- - name: Check if LXC exists no_log: true # Authorization header carries the API token delegate_to: localhost ansible.builtin.uri: url: "https://{{ pve_lxc_api_host }}:8006/api2/json/nodes/{{ pve_lxc_node }}/lxc/{{ pve_lxc_vmid }}/config" method: GET headers: Authorization: "{{ __pve_lxc_api_auth_header }}" status_code: [200, 404, 500] register: __pve_lxc_config check_mode: false - name: Set LXC existence fact ansible.builtin.set_fact: pve_lxc_exists: "{{ __pve_lxc_config.status == 200 }}" - name: Set public LXC presence API ansible.builtin.set_fact: pve_lxc_present: "{{ pve_lxc_exists and pve_lxc_state != 'absent' }}"