Files
ansible-collection-infrastr…/roles/proxmox_lxc_provision/tasks/check-exists.yml

16 lines
386 B
YAML

---
- name: Query Proxmox for existing LXCs
community.proxmox.proxmox_lxc_info:
<<: "{{ proxmox_api_connection }}"
register: proxmox_lxcs
- name: Check if LXC with hostname already exists
ansible.builtin.set_fact:
lxc_exists: >-
{{
proxmox_lxcs.proxmox_lxcs
| selectattr('name', 'equalto', lxc_hostname)
| list
| length > 0
}}