Don't try to set devices fact when osd_auto_discovery was skipped

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>
(cherry picked from commit 9405558d03)
stable-8.0
Dmitriy Rabotyagov 2024-10-28 17:54:12 +01:00 committed by Seena Fallah
parent de7300e74b
commit 88b6ecef51
1 changed files with 1 additions and 0 deletions

View File

@ -76,5 +76,6 @@
loop: "{{ devices_check.results }}" loop: "{{ devices_check.results }}"
when: when:
- devices_check is defined - devices_check is defined
- devices_check is not skipped
- not item.skipped | default(false) - not item.skipped | default(false)
- not item.failed | default(false) - not item.failed | default(false)