Skip to content

Commit

Permalink
backup-and-restore: fix check on 'target_node' variable
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
guits committed Jun 29, 2022
1 parent 1db668d commit f280027
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion infrastructure-playbooks/backup-and-restore-ceph-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
msg: >
"You must pass the node name: -e target_node=<inventory_name>.
The name must match what is set in your inventory."
when: target_node is not defined
when:
- target_node is not defined
or target_node not in groups.get('all', [])

- name: exit playbook, if user did not set the backup directory
fail:
Expand Down

0 comments on commit f280027

Please sign in to comment.