Specify changed_when for shell commands

This commit is contained in:
sandwich committed 2024-10-28 19:20:05 +01:00
1 parent 5312ec8cc6
commit e37b5a535b
9 files changed
+71 -1

No files matched your search

+4
View File
@@ -9,6 +9,8 @@
when: not vm_disk_stat.stat.exists
delegate_to: localhost
ansible.builtin.command: qemu-img create -f qcow2 {{ vm_path | default('/var/lib/libvirt/images/') }}{{ hostname }}.qcow2 {{ vm_size }}G
changed_when: result.rc == 0
register: result
- name: Generate Random MAC Address
delegate_to: localhost
@@ -32,6 +34,8 @@
{{ vm_path | default('/var/lib/libvirt/images/') }}
{{ hostname }}-cloudinit.iso /tmp/cloud-user-data-{{ hostname }}.yml
-N /tmp/cloud-network-config-{{ hostname }}.yml
changed_when: result.rc == 0
register: result
- name: Create VM using libvirt
delegate_to: localhost