Make explicit fact gathering timeout configurable

Implicit fact gathering performed at the beginning of a play uses the
DEFAULT_GATHER_TIMEOUT [1] config option. Invoking the setup module
directly does not use this option, instead takes a gather_timeout module
argument.

This change adds a fact_gather_timeout variable that is used when
invoking the setup module directly. The default value is given by the
DEFAULT_GATHER_TIMEOUT config option.

[1]
https://docs.ansible.com/ansible/2.4/config.html#default-gather-timeout

Change-Id: I50bcfc264b61686ffcb1341b737f4354067bd03c
This commit is contained in:
Mark Goddard 2019-01-21 12:23:17 +00:00
parent 225198e050
commit 53fa0c9eaa
8 changed files with 16 additions and 0 deletions

View File

@ -20,3 +20,6 @@ noauth_mode: true
# Ironic to show the instance in Active state. # Ironic to show the instance in Active state.
wait_for_node_deploy: false wait_for_node_deploy: false
wait_timeout: 1800 wait_timeout: 1800
# Timeout for gathering facts.
fact_gather_timeout: "{{ lookup('config', 'DEFAULT_GATHER_TIMEOUT', on_missing='skip') | default(omit, true) }}"

View File

@ -19,6 +19,7 @@
# to be inspected. # to be inspected.
- name: "Obtain setup facts" - name: "Obtain setup facts"
setup: setup:
gather_timeout: "{{ fact_gather_timeout }}"
- name: "If in noauth mode, unset authentication parameters." - name: "If in noauth mode, unset authentication parameters."
set_fact: set_fact:

View File

@ -287,3 +287,6 @@ ironic_inspector:
# NOTE(hwoarang): openSUSE distros may come with recent pip versions so # NOTE(hwoarang): openSUSE distros may come with recent pip versions so
# upgrade only what's necessary # upgrade only what's necessary
pip_opts: "{{ ((ansible_os_family | lower == 'suse') or (enable_venv | bool)) | ternary('--upgrade-strategy only-if-needed', '--force-reinstall') }}" pip_opts: "{{ ((ansible_os_family | lower == 'suse') or (enable_venv | bool)) | ternary('--upgrade-strategy only-if-needed', '--force-reinstall') }}"
# Timeout for gathering facts.
fact_gather_timeout: "{{ lookup('config', 'DEFAULT_GATHER_TIMEOUT', on_missing='skip') | default(omit, true) }}"

View File

@ -168,6 +168,7 @@
# NOTE(pas-ha) needed to e.g. pick up new interfaces after libvirt install # NOTE(pas-ha) needed to e.g. pick up new interfaces after libvirt install
- name: "Refresh facts" - name: "Refresh facts"
setup: setup:
gather_timeout: "{{ fact_gather_timeout }}"
- name: "Generate ironic Configuration" - name: "Generate ironic Configuration"
include: ironic_config.yml include: ironic_config.yml

View File

@ -15,3 +15,6 @@ ipa_kernel_url: "{{ ipa_file_protocol }}://{{ hostvars[inventory_hostname]['ansi
ipa_ramdisk_url: "{{ ipa_file_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + network_interface | replace('-', '_')]['ipv4']['address'] }}:{{file_url_port}}/ipa.initramfs" ipa_ramdisk_url: "{{ ipa_file_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + network_interface | replace('-', '_')]['ipv4']['address'] }}:{{file_url_port}}/ipa.initramfs"
noauth_mode: true noauth_mode: true
# Timeout for gathering facts.
fact_gather_timeout: "{{ lookup('config', 'DEFAULT_GATHER_TIMEOUT', on_missing='skip') | default(omit, true) }}"

View File

@ -14,6 +14,7 @@
--- ---
- name: "Collect facts" - name: "Collect facts"
setup: setup:
gather_timeout: "{{ fact_gather_timeout }}"
- name: "If in noauth mode, unset authentication parameters." - name: "If in noauth mode, unset authentication parameters."
set_fact: set_fact:

View File

@ -5,3 +5,6 @@ inspection_wait_timeout: 1800
inventory_dhcp: false inventory_dhcp: false
inventory_dhcp_static_ip: true inventory_dhcp_static_ip: true
inventory_dns: false inventory_dns: false
# Timeout for gathering facts.
fact_gather_timeout: "{{ lookup('config', 'DEFAULT_GATHER_TIMEOUT', on_missing='skip') | default(omit, true) }}"

View File

@ -14,6 +14,7 @@
--- ---
- name: "Collect facts" - name: "Collect facts"
setup: setup:
gather_timeout: "{{ fact_gather_timeout }}"
- name: "If in noauth mode, unset authentication parameters." - name: "If in noauth mode, unset authentication parameters."
set_fact: set_fact: