Allow deployers to define the container type

The variable `lxc_user_defined_container` has been added which allows a
deployer to define the container variable file in use for a given
container type.

Depends-On: https://review.openstack.org/554383
Change-Id: Ia1373bfa916b4add49a8444d2e4553f898650328
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-03-19 19:24:19 -05:00 committed by Kevin Carter (cloudnull)
parent 883bc78164
commit 846b4f9ed2
4 changed files with 20 additions and 1 deletions

View File

@ -163,5 +163,14 @@ lxc_container_veth_wiring: false
# Enable systemd-resolved
lxc_container_enable_resolved: true
# User defined variable pointing to a specific variable file used when setting
# up the base container image. Deployers can use the provided container variable
# files by simply inputting the file name
# "{{ ansible_distribution }}-{{ ansible_distribution_version }}-container.yml"
# or by providing the full path to a local file containing all of the variables
# needed to prepare a container. built-in supported values are:
# [redhat-7.yml, suse-42.yml, ubuntu-16.04.yml]
lxc_user_defined_container: null
# Dictionary of settings for containers
properties: {}

View File

@ -0,0 +1,9 @@
---
features:
- The variable ``lxc_user_defined_container`` has been added to the
lxc_container_create role allowing deployers to define the variable
file loaded when creating a container. This option defaults to **null**
which will instruct the role to create a container using the OS most closely
assosiated with the underlying OS. This option can be set to either one of
the roles built-in container types or use any variable file local to the
deployment host.

View File

@ -49,6 +49,7 @@
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- "{{ lxc_user_defined_container }}"
- "{{ hostvars[physical_host]['ansible_distribution'] | lower }}-{{ hostvars[physical_host]['ansible_distribution_version'] | lower }}.yml"
- "{{ hostvars[physical_host]['ansible_distribution'] | lower }}-{{ hostvars[physical_host]['ansible_distribution_major_version'] | lower }}.yml"
- "{{ hostvars[physical_host]['ansible_os_family'] | lower }}-{{ hostvars[physical_host]['ansible_distribution_major_version'] | lower }}.yml"

View File

@ -30,7 +30,7 @@ lxc_container_enable_resolved: false
lxc_container_map:
distro: opensuse
arch: amd64
release: "{{ hostvars[physical_host]['ansible_distribution_version'] }}"
release: "42.3"
### REMOVE IN "S"
# The machine-id is not removed in the base container. Remove the machine-id