From 23de34cd78191ea75e59bd264ff5cd5386e091d4 Mon Sep 17 00:00:00 2001 From: Kees Bakker Date: Thu, 27 Jun 2024 20:21:13 +0200 Subject: [PATCH] ansible: avoid lvmcluster tasks for empty cluster name Signed-off-by: Kees Bakker --- ansible/books/lvmcluster.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ansible/books/lvmcluster.yaml b/ansible/books/lvmcluster.yaml index bfddb88..8d2986d 100644 --- a/ansible/books/lvmcluster.yaml +++ b/ansible/books/lvmcluster.yaml @@ -32,6 +32,7 @@ template: src: "../files/lvmcluster/host_id.yaml.tpl" dest: "../data/lvmcluster/{{ task_name }}/host_id.yaml" + when: 'task_name' vars: task_host_ids: "{{ lookup('file', '../data/lvmcluster/' + task_name + '/host_id.yaml') | from_yaml }}" @@ -57,6 +58,7 @@ template: src: ../files/lvmcluster/lvmlocal.conf.tpl dest: /etc/lvm/lvmlocal.conf + when: 'task_name' - name: LVM Cluster - Create VGs hosts: all @@ -70,7 +72,7 @@ shell: cmd: "vgs {{ item }}" register: check - loop: "{{ lvmcluster_vgs.keys() }}" + loop: "{{ task_vgs.keys() }}" run_once: true changed_when: false failed_when: "check.rc not in (0, 5)"