Skip to content

Commit

Permalink
Don't try to set devices fact when osd_auto_discovery was skipped
Browse files Browse the repository at this point in the history
Right now, under certain OS and Ansible versions, ie Rocky Linux and
ansible-core 2.17, `devices_check` variable is getting defined even if
task was skipped.

That results in set_fact to fail, as resulting variable has no `results`
key in it.

Structure of such variable looks like that:
```
"devices_check": {
    "changed": false,
    "false_condition": "osd_auto_discovery | default(False) | bool",
    "skip_reason": "Conditional result was False",
    "skipped": true
}
```

Checking for task not being skipped solves such issues.

Signed-off-by: Dmitriy Rabotyagov <noonedeadpunk@gmail.com>
  • Loading branch information
Dmitriy Rabotyagov authored and clwluvw committed Oct 28, 2024
1 parent c9ffb2e commit 9405558
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions roles/ceph-facts/tasks/devices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@
loop: "{{ devices_check.results }}"
when:
- devices_check is defined
- devices_check is not skipped
- not item.skipped | default(false)
- not item.failed | default(false)

0 comments on commit 9405558

Please sign in to comment.