Fix XCP-NG tasks — skip when xcpng_host is empty, default delegate_to localhost

This commit is contained in:
Semaphore
2026-03-11 11:56:55 -07:00
parent 7368701e85
commit bd1b99f47d

View File

@@ -23,8 +23,8 @@
xe vm-snapshot vm={{ xcpng_vm_uuid }} new-name-label="{{ snapshot_name_prefix }}-{{ ansible_date_time.date }}-{{ ansible_date_time.hour }}{{ ansible_date_time.minute }}" xe vm-snapshot vm={{ xcpng_vm_uuid }} new-name-label="{{ snapshot_name_prefix }}-{{ ansible_date_time.date }}-{{ ansible_date_time.hour }}{{ ansible_date_time.minute }}"
register: xcpng_snapshot_result register: xcpng_snapshot_result
changed_when: xcpng_snapshot_result.rc == 0 changed_when: xcpng_snapshot_result.rc == 0
when: hypervisor_type == "xcpng" when: hypervisor_type == "xcpng" and xcpng_host != ""
delegate_to: "{{ xcpng_host }}" delegate_to: "{{ xcpng_host | default('localhost') }}"
- name: Store XCP-NG snapshot UUID - name: Store XCP-NG snapshot UUID
ansible.builtin.set_fact: ansible.builtin.set_fact:
@@ -50,8 +50,8 @@
register: xcpng_snap_verify register: xcpng_snap_verify
changed_when: false changed_when: false
failed_when: xcpng_snap_verify.stdout == "" failed_when: xcpng_snap_verify.stdout == ""
when: hypervisor_type == "xcpng" when: hypervisor_type == "xcpng" and xcpng_host != ""
delegate_to: "{{ xcpng_host }}" delegate_to: "{{ xcpng_host | default('localhost') }}"
- name: Assert snapshot exists before proceeding - name: Assert snapshot exists before proceeding
ansible.builtin.assert: ansible.builtin.assert: