Skip to content

Commit f280027

Browse files
committed
backup-and-restore: fix check on 'target_node' variable
If the user doesn't pass a valid name (present in the inventory) the playbook will fail like following: ``` fatal: [localhost -> {{ target_node }}]: FAILED! => msg: |- The task includes an option with an undefined variable. The error was: "hostvars['10.70.46.40']" is undefined ``` Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2051640 Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com> (cherry picked from commit b18a1aa)
1 parent 1db668d commit f280027

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

infrastructure-playbooks/backup-and-restore-ceph-files.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
msg: >
2929
"You must pass the node name: -e target_node=<inventory_name>.
3030
The name must match what is set in your inventory."
31-
when: target_node is not defined
31+
when:
32+
- target_node is not defined
33+
or target_node not in groups.get('all', [])
3234

3335
- name: exit playbook, if user did not set the backup directory
3436
fail:

0 commit comments

Comments
 (0)