Fix additional facts gathering in ceph-install.yml

As of Ansible 2.11, the type of 'filter' in setup module has changed from string to list and the default has became an empty list. A simple string is still accepted and works as a single pattern[1].
However, there are some corner cases when a simple string misbehaves and it happened here where ansible tries to create a list when it's not necessary:

"invocation": {
  "module_args": {
    "gather_subset": ["!all", "network"],
    "filter": ["ansible_all_ipv[4", "6]_addresses"],
    "gather_timeout": 10,
    "fact_path": "/etc/ansible/facts.d"
  }
}

Previously I tried to fix it differently in Change #823437 but Andrew Bonney proposed a better way of handling this issue.

[1] https://docs.ansible.com/ansible/latest/collections/ansible/builtin/setup_module.html#parameter-filter

Co-authored-by: Andrew Bonney <andrew.bonney@bbc.co.uk>
Change-Id: I263315b13669a0b9b2fe318f86fe8d0cf1e3fafd
This commit is contained in:
Damian Dabrowski 2022-01-07 13:54:42 +01:00
parent 954567346e
commit 61c550d083

View File

@ -30,7 +30,7 @@
- name: Gather additional facts for monitor_address_block - name: Gather additional facts for monitor_address_block
include_tasks: "common-tasks/gather-hardware-facts.yml" include_tasks: "common-tasks/gather-hardware-facts.yml"
vars: vars:
deployment_extra_facts_filter: "ansible_all_ipv[4,6]_addresses" deployment_extra_facts_filter: "ansible_all_ipv[4|6]_addresses"
deployment_extra_facts_subset: "!all,network" deployment_extra_facts_subset: "!all,network"
when: monitor_address_block is defined when: monitor_address_block is defined
tags: tags: