From de36867075d21c2a8514f9ee8f168afedbaa7e06 Mon Sep 17 00:00:00 2001 From: Semaphore Date: Wed, 11 Mar 2026 12:00:33 -0700 Subject: [PATCH] =?UTF-8?q?Fix=20XCP-NG=20delegate=5Fto=20=E2=80=94=20use?= =?UTF-8?q?=20inline=20conditional=20to=20avoid=20empty=20hostname=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/snapshot/tasks/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/snapshot/tasks/main.yml b/roles/snapshot/tasks/main.yml index 10bdd0a..23e8ee9 100644 --- a/roles/snapshot/tasks/main.yml +++ b/roles/snapshot/tasks/main.yml @@ -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 }}" register: xcpng_snapshot_result changed_when: xcpng_snapshot_result.rc == 0 - when: hypervisor_type == "xcpng" and xcpng_host != "" - delegate_to: "{{ xcpng_host | default('localhost') }}" + when: hypervisor_type == "xcpng" and xcpng_host | length > 0 + delegate_to: "{{ xcpng_host if xcpng_host | length > 0 else 'localhost' }}" - name: Store XCP-NG snapshot UUID ansible.builtin.set_fact: @@ -50,8 +50,8 @@ register: xcpng_snap_verify changed_when: false failed_when: xcpng_snap_verify.stdout == "" - when: hypervisor_type == "xcpng" and xcpng_host != "" - delegate_to: "{{ xcpng_host | default('localhost') }}" + when: hypervisor_type == "xcpng" and xcpng_host | length > 0 + delegate_to: "{{ xcpng_host if xcpng_host | length > 0 else 'localhost' }}" - name: Assert snapshot exists before proceeding ansible.builtin.assert: