Ensure facts are updated for new containers
When the new containers are built, we currently only collect a minimal amount of facts afterwards. This patch ensures that a broader set of facts are updated to ensure that we have the updated distribution information, networking and storage facts. We do this for both types of containers to ensure consistency in the approach. Related-Bug: 1765438 Change-Id: I620e35d0942a6d4a55e05ae441d0e6ee2e4a67c4
This commit is contained in:
parent
52a11834ef
commit
f4e74ea714
@ -40,10 +40,18 @@
|
||||
delay: "{{ lxc_container_wait_params.delay | default(omit) }}"
|
||||
sleep: "{{ lxc_container_wait_params.sleep | default(omit) }}"
|
||||
timeout: "{{ lxc_container_wait_params.timeout | default(omit) }}"
|
||||
- name: Set local facts for new container(s)
|
||||
|
||||
# When using gather_facts with smart gathering,
|
||||
# the facts aren't fully updated unless they
|
||||
# are old. Using the setup module in a task
|
||||
# does a more thorough collection.
|
||||
# Given we've just created the container, it is
|
||||
# best that we do a full collection of facts -
|
||||
# otherwise we end up with a stale set which
|
||||
# has stuff like the hostname = localhost.
|
||||
- name: Gather facts for new container(s)
|
||||
setup:
|
||||
filter: ansible_local
|
||||
gather_subset: "!all"
|
||||
gather_subset: "network,hardware,virtual"
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
tags:
|
||||
- lxc-containers-create
|
||||
|
@ -37,6 +37,25 @@
|
||||
user: root
|
||||
roles:
|
||||
- role: "nspawn_container_create"
|
||||
post_tasks:
|
||||
- name: Wait for container connectivity
|
||||
wait_for_connection:
|
||||
connect_timeout: "{{ lxc_container_wait_params.connect_timeout | default(omit) }}"
|
||||
delay: "{{ lxc_container_wait_params.delay | default(omit) }}"
|
||||
sleep: "{{ lxc_container_wait_params.sleep | default(omit) }}"
|
||||
timeout: "{{ lxc_container_wait_params.timeout | default(omit) }}"
|
||||
|
||||
# When using gather_facts with smart gathering,
|
||||
# the facts aren't fully updated unless they
|
||||
# are old. Using the setup module in a task
|
||||
# does a more thorough collection.
|
||||
# Given we've just created the container, it is
|
||||
# best that we do a full collection of facts -
|
||||
# otherwise we end up with a stale set which
|
||||
# has stuff like the hostname = localhost.
|
||||
- name: Gather facts for new container(s)
|
||||
setup:
|
||||
gather_subset: "network,hardware,virtual"
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
tags:
|
||||
- nspawn-containers-create
|
||||
|
Loading…
Reference in New Issue
Block a user