Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654 Change-Id: If6b30e40bf71f60ee72fdc1459ce5e5a9f4f7d93
This commit is contained in:
parent
9a397730b4
commit
5d22a389c2
defaults
tasks
tests
vars
@ -160,7 +160,7 @@ lxc_container_enable_resolved: true
|
|||||||
# User defined variable pointing to a specific variable file used when setting
|
# User defined variable pointing to a specific variable file used when setting
|
||||||
# up the base container image. Deployers can use the provided container variable
|
# up the base container image. Deployers can use the provided container variable
|
||||||
# files by simply inputting the file name
|
# files by simply inputting the file name
|
||||||
# "{{ ansible_distribution }}-{{ ansible_distribution_version }}-container.yml"
|
# "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_version'] }}-container.yml"
|
||||||
# or by providing the full path to a local file containing all of the variables
|
# or by providing the full path to a local file containing all of the variables
|
||||||
# needed to prepare a container.
|
# needed to prepare a container.
|
||||||
#lxc_user_defined_container: null
|
#lxc_user_defined_container: null
|
||||||
|
@ -30,32 +30,15 @@
|
|||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|
||||||
- name: Collect physical host facts if missing
|
|
||||||
action:
|
|
||||||
module: setup
|
|
||||||
delegate_to: "{{ physical_host }}"
|
|
||||||
delegate_facts: yes
|
|
||||||
when:
|
|
||||||
- hostvars[physical_host]['ansible_kernel'] is not defined
|
|
||||||
|
|
||||||
- name: Kernel version and LXC backing store check
|
|
||||||
debug:
|
|
||||||
msg: "Using overlayfs is not recommended when using Kernel version < 3.18"
|
|
||||||
when:
|
|
||||||
- lxc_container_backing_store == "overlayfs"
|
|
||||||
- hostvars[physical_host]['ansible_kernel'] is version('3.18.0-0-generic', '<')
|
|
||||||
tags:
|
|
||||||
- always
|
|
||||||
|
|
||||||
- name: Gather variables for each operating system
|
- name: Gather variables for each operating system
|
||||||
include_vars: "{{ item }}"
|
include_vars: "{{ item }}"
|
||||||
with_first_found:
|
with_first_found:
|
||||||
- "{{ lxc_user_defined_container | default([]) }}"
|
- "{{ lxc_user_defined_container | default([]) }}"
|
||||||
- "{{ hostvars[physical_host]['ansible_distribution'] | lower }}-{{ hostvars[physical_host]['ansible_distribution_version'] | lower }}.yml"
|
- "{{ hostvars[physical_host]['ansible_facts']['distribution'] | lower }}-{{ hostvars[physical_host]['ansible_facts']['distribution_version'] | lower }}.yml"
|
||||||
- "{{ hostvars[physical_host]['ansible_distribution'] | lower }}-{{ hostvars[physical_host]['ansible_distribution_major_version'] | lower }}.yml"
|
- "{{ hostvars[physical_host]['ansible_facts']['distribution'] | lower }}-{{ hostvars[physical_host]['ansible_facts']['distribution_major_version'] | lower }}.yml"
|
||||||
- "{{ hostvars[physical_host]['ansible_os_family'] | lower }}-{{ hostvars[physical_host]['ansible_distribution_major_version'] | lower }}.yml"
|
- "{{ hostvars[physical_host]['ansible_facts']['os_family'] | lower }}-{{ hostvars[physical_host]['ansible_facts']['distribution_major_version'] | lower }}.yml"
|
||||||
- "{{ hostvars[physical_host]['ansible_distribution'] | lower }}.yml"
|
- "{{ hostvars[physical_host]['ansible_facts']['distribution'] | lower }}.yml"
|
||||||
- "{{ hostvars[physical_host]['ansible_os_family'] | lower }}.yml"
|
- "{{ hostvars[physical_host]['ansible_facts']['os_family'] | lower }}.yml"
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
- block:
|
- block:
|
||||||
- name: Install BTRFS packages
|
- name: Install BTRFS packages
|
||||||
package:
|
package:
|
||||||
name: "{{ btrfs_package[ansible_pkg_mgr | lower] }}"
|
name: "{{ btrfs_package[ansible_facts['pkg_mgr'] | lower] }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Create base directories
|
- name: Create base directories
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
lxc_container_map:
|
lxc_container_map:
|
||||||
distro: debian
|
distro: debian
|
||||||
arch: "{{ lxc_architecture_mapping.get( hostvars[physical_host]['ansible_architecture'] | lower ) }}"
|
arch: "{{ lxc_architecture_mapping.get( hostvars[physical_host]['ansible_facts']['architecture'] | lower ) }}"
|
||||||
release: "{{ hostvars[physical_host]['ansible_distribution_major_version'] }}"
|
release: "{{ hostvars[physical_host]['ansible_facts']['distribution_major_version'] }}"
|
||||||
|
|
||||||
lxc_container_default_config_list:
|
lxc_container_default_config_list:
|
||||||
- "lxc.start.auto=1"
|
- "lxc.start.auto=1"
|
||||||
|
@ -18,7 +18,7 @@ lxc_container_backing_store: machinectl
|
|||||||
|
|
||||||
lxc_container_map:
|
lxc_container_map:
|
||||||
distro: gentoo
|
distro: gentoo
|
||||||
arch: "{{ lxc_architecture_mapping.get( hostvars[physical_host]['ansible_architecture'] | lower ) }}"
|
arch: "{{ lxc_architecture_mapping.get( hostvars[physical_host]['ansible_facts']['architecture'] | lower ) }}"
|
||||||
release: 17.0-systemd
|
release: 17.0-systemd
|
||||||
|
|
||||||
lxc_container_default_config_list:
|
lxc_container_default_config_list:
|
||||||
|
@ -19,7 +19,7 @@ lxc_container_enable_resolved: false
|
|||||||
lxc_container_map:
|
lxc_container_map:
|
||||||
distro: opensuse
|
distro: opensuse
|
||||||
arch: amd64
|
arch: amd64
|
||||||
release: "{{ hostvars[physical_host]['ansible_distribution_version'] }}"
|
release: "{{ hostvars[physical_host]['ansible_facts']['distribution_version'] }}"
|
||||||
|
|
||||||
lxc_container_default_config_list:
|
lxc_container_default_config_list:
|
||||||
- "lxc.autodev=1"
|
- "lxc.autodev=1"
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
lxc_container_map:
|
lxc_container_map:
|
||||||
distro: ubuntu
|
distro: ubuntu
|
||||||
arch: "{{ lxc_architecture_mapping.get( hostvars[physical_host]['ansible_architecture'] | lower ) }}"
|
arch: "{{ lxc_architecture_mapping.get( hostvars[physical_host]['ansible_facts']['architecture'] | lower ) }}"
|
||||||
release: "{{ hostvars[physical_host].ansible_distribution_release }}"
|
release: "{{ hostvars[physical_host]['ansible_facts']['distribution_release'] }}"
|
||||||
|
|
||||||
lxc_container_default_config_list:
|
lxc_container_default_config_list:
|
||||||
- "lxc.start.auto=1"
|
- "lxc.start.auto=1"
|
||||||
|
Loading…
Reference in New Issue
Block a user