Use fqdn for ansible.builtin modules

This commit is contained in:
2025-11-15 21:49:12 +01:00
parent ec2b3b7edc
commit ff691bae3d
8 changed files with 101 additions and 101 deletions

View File

@@ -2,17 +2,17 @@
# create-vm.yml - Create base VM on Proxmox
- name: "[VM] Check if VM already exists"
stat:
ansible.builtin.stat:
path: "/etc/pve/qemu-server/{{ vm_id }}.conf"
register: vm_conf
changed_when: false
- name: "[VM] Display VM status"
debug:
ansible.builtin.debug:
msg: "VM {{ vm_id }} ({{ hostname }}) - Status: {{ 'ALREADY EXISTS' if vm_conf.stat.exists else 'WILL BE CREATED' }}"
- name: "[VM] Create base VM"
command: >
ansible.builtin.command: >
qm create {{ vm_id }}
--name {{ hostname }}
--memory {{ memory }}
@@ -25,7 +25,7 @@
changed_when: vm_create.rc == 0
- name: "[VM] Handle VM creation error"
fail:
ansible.builtin.fail:
msg: |
Failed to create VM {{ vm_id }}:
{{ vm_create.stderr | default('No error message') }}
@@ -34,13 +34,13 @@
- vm_create is failed
- name: "[VM] Verify VM was created"
stat:
ansible.builtin.stat:
path: "/etc/pve/qemu-server/{{ vm_id }}.conf"
register: vm_conf_verify
changed_when: false
failed_when: not vm_conf_verify.stat.exists
- name: "[VM] Display VM creation result"
debug:
ansible.builtin.debug:
msg: "✓ VM {{ vm_id }} created successfully"
when: not vm_conf.stat.exists