Optimize and fix known container hosts group
1) Optimizes the generation of the known container hosts list. 2) Re-add the "lxc_host_group" operator override var which was accidentally removed in I99eb876f1d089a73ae162f5629422dc492a99d09. Change-Id: Ifb995bd29a62d81f6e5683f3cd1a49077cdbb035
This commit is contained in:
parent
8cc6364d40
commit
e2341fcd69
@ -18,17 +18,19 @@
|
||||
connection: local
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- set_fact:
|
||||
_container_hosts: >
|
||||
{%- for item in groups['all_containers'] -%}
|
||||
{%- if hostvars[item]['physical_host'] | default(false) != item -%}
|
||||
{{ hostvars[item]['physical_host'] }}{% if not loop.last %},{% endif %}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
- set_fact:
|
||||
_known_container_hosts: "{{ _container_hosts | replace('\n', '') }}"
|
||||
- name: Create known container hosts fact
|
||||
set_fact:
|
||||
_known_container_hosts: >
|
||||
{% set _var = [] -%}
|
||||
{% for item in groups['all_containers'] -%}
|
||||
{% if hostvars[item]['physical_host'] | default(false) != item -%}
|
||||
{% if _var.append(hostvars[item]['physical_host']) -%}
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
{{ _var | unique }}
|
||||
- name: Create dynamic lxc_host group
|
||||
add_host:
|
||||
hostname: "{{ item }}"
|
||||
groups: "known_container_hosts"
|
||||
with_items: "{{ _known_container_hosts.split(',') | unique }}"
|
||||
with_items: "{{ _known_container_hosts }}"
|
||||
|
@ -16,7 +16,7 @@
|
||||
- include: common-plays/generate-lxc-container-hosts.yml
|
||||
|
||||
- name: Basic lxc host setup
|
||||
hosts: known_container_hosts
|
||||
hosts: "{{ lxc_host_group | default('known_container_hosts') }}"
|
||||
gather_facts: "{{ gather_facts | default(True) }}"
|
||||
max_fail_percentage: 20
|
||||
user: root
|
||||
|
Loading…
x
Reference in New Issue
Block a user