Merge "Support custom Kolla group_vars"
This commit is contained in:
@@ -295,6 +295,7 @@
|
|||||||
kolla_external_fqdn_cert: "{{ kolla_config_path }}/certificates/haproxy.pem"
|
kolla_external_fqdn_cert: "{{ kolla_config_path }}/certificates/haproxy.pem"
|
||||||
kolla_internal_fqdn_cert: "{{ kolla_config_path }}/certificates/haproxy-internal.pem"
|
kolla_internal_fqdn_cert: "{{ kolla_config_path }}/certificates/haproxy-internal.pem"
|
||||||
kolla_ansible_passwords_path: "{{ kayobe_config_path }}/kolla/passwords.yml"
|
kolla_ansible_passwords_path: "{{ kayobe_config_path }}/kolla/passwords.yml"
|
||||||
|
kolla_overcloud_group_vars_path: "{{ kayobe_config_path }}/kolla/inventory/group_vars"
|
||||||
# NOTE: This differs from the default SELinux mode in kolla ansible,
|
# NOTE: This differs from the default SELinux mode in kolla ansible,
|
||||||
# which is permissive. The justification for using this mode is twofold:
|
# which is permissive. The justification for using this mode is twofold:
|
||||||
# 1. it avoids filling up the audit log
|
# 1. it avoids filling up the audit log
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ kolla_ansible_become: true
|
|||||||
# Full custom seed inventory contents.
|
# Full custom seed inventory contents.
|
||||||
kolla_seed_inventory_custom:
|
kolla_seed_inventory_custom:
|
||||||
|
|
||||||
|
# Directory containing custom Kolla-Ansible group vars.
|
||||||
|
kolla_overcloud_group_vars_path:
|
||||||
|
|
||||||
# List of names of host variables to pass through from kayobe hosts to
|
# List of names of host variables to pass through from kayobe hosts to
|
||||||
# the kolla-ansible seed host, if set. See also
|
# the kolla-ansible seed host, if set. See also
|
||||||
# kolla_seed_inventory_pass_through_host_vars_map.
|
# kolla_seed_inventory_pass_through_host_vars_map.
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
- "{{ kolla_config_path }}"
|
- "{{ kolla_config_path }}"
|
||||||
- "{{ kolla_seed_inventory_path }}/host_vars"
|
- "{{ kolla_seed_inventory_path }}/host_vars"
|
||||||
- "{{ kolla_overcloud_inventory_path }}/host_vars"
|
- "{{ kolla_overcloud_inventory_path }}/host_vars"
|
||||||
|
- "{{ kolla_overcloud_inventory_path }}/group_vars"
|
||||||
- "{{ kolla_node_custom_config_path }}"
|
- "{{ kolla_node_custom_config_path }}"
|
||||||
|
|
||||||
- name: Ensure the Kolla global configuration file exists
|
- name: Ensure the Kolla global configuration file exists
|
||||||
@@ -72,6 +73,17 @@
|
|||||||
dest: "{{ kolla_overcloud_inventory_path }}/hosts"
|
dest: "{{ kolla_overcloud_inventory_path }}/hosts"
|
||||||
mode: 0640
|
mode: 0640
|
||||||
|
|
||||||
|
- name: Look for custom Kolla overcloud group vars
|
||||||
|
stat:
|
||||||
|
path: "{{ kolla_overcloud_group_vars_path }}"
|
||||||
|
register: kolla_ansible_custom_overcloud_group_vars
|
||||||
|
|
||||||
|
- name: Copy over custom Kolla overcloud group vars
|
||||||
|
copy:
|
||||||
|
src: "{{ kolla_overcloud_group_vars_path }}"
|
||||||
|
dest: "{{ kolla_overcloud_inventory_path }}/"
|
||||||
|
when: kolla_ansible_custom_overcloud_group_vars.stat.exists
|
||||||
|
|
||||||
- name: Ensure the Kolla overcloud host vars files exist
|
- name: Ensure the Kolla overcloud host vars files exist
|
||||||
template:
|
template:
|
||||||
src: host-vars.j2
|
src: host-vars.j2
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
kolla_ansible_venv: "{{ temp_path }}/venv"
|
kolla_ansible_venv: "{{ temp_path }}/venv"
|
||||||
kolla_config_path: "{{ temp_path }}/etc/kolla"
|
kolla_config_path: "{{ temp_path }}/etc/kolla"
|
||||||
kolla_node_custom_config_path: "{{ temp_path }}/etc/kolla/config"
|
kolla_node_custom_config_path: "{{ temp_path }}/etc/kolla/config"
|
||||||
|
# Purposely does not exist to simulate the case when no group vars
|
||||||
|
# are provided
|
||||||
|
kolla_overcloud_group_vars_path: "{{ temp_path }}/etc/kayobe/kolla/inventory/group_vars"
|
||||||
kolla_ansible_passwords_path: "{{ temp_path }}/passwords.yml"
|
kolla_ansible_passwords_path: "{{ temp_path }}/passwords.yml"
|
||||||
# Required config.
|
# Required config.
|
||||||
kolla_base_distro: "fake-distro"
|
kolla_base_distro: "fake-distro"
|
||||||
@@ -131,6 +134,7 @@
|
|||||||
- seed/host_vars
|
- seed/host_vars
|
||||||
- overcloud
|
- overcloud
|
||||||
- overcloud/host_vars
|
- overcloud/host_vars
|
||||||
|
- overcloud/group_vars
|
||||||
register: inventory_stat
|
register: inventory_stat
|
||||||
|
|
||||||
- name: Validate inventory files
|
- name: Validate inventory files
|
||||||
@@ -142,6 +146,18 @@
|
|||||||
Inventory file {{ item.item }} was not found.
|
Inventory file {{ item.item }} was not found.
|
||||||
with_items: "{{ inventory_stat.results }}"
|
with_items: "{{ inventory_stat.results }}"
|
||||||
|
|
||||||
|
- name: Look for custom overcloud group vars
|
||||||
|
find:
|
||||||
|
paths: "{{ temp_path ~ '/etc/kolla/inventory/group_vars' }}"
|
||||||
|
register: kolla_ansible_overcloud_group_vars
|
||||||
|
|
||||||
|
- name: Check that no overcloud group vars are set
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- kolla_ansible_overcloud_group_vars.matched == 0
|
||||||
|
msg: >
|
||||||
|
Overcloud group vars were found when they should not be set.
|
||||||
|
|
||||||
- name: Validate passwords.yml contents
|
- name: Validate passwords.yml contents
|
||||||
assert:
|
assert:
|
||||||
that: item in passwords_yml
|
that: item in passwords_yml
|
||||||
|
|||||||
@@ -49,6 +49,25 @@
|
|||||||
state: directory
|
state: directory
|
||||||
register: tempfile_result
|
register: tempfile_result
|
||||||
|
|
||||||
|
- name: Create directory for custom overcloud foo group vars
|
||||||
|
file:
|
||||||
|
path: "{{ tempfile_result.path ~ '/etc/kayobe/kolla/inventory/group_vars/foo_group' }}"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Create custom overcloud foo group vars
|
||||||
|
copy:
|
||||||
|
dest: "{{ tempfile_result.path ~ '/etc/kayobe/kolla/inventory/group_vars/foo_group/all' }}"
|
||||||
|
content: |
|
||||||
|
---
|
||||||
|
foo_port: "1234"
|
||||||
|
|
||||||
|
- name: Create custom overcloud bar group vars
|
||||||
|
copy:
|
||||||
|
dest: "{{ tempfile_result.path ~ '/etc/kayobe/kolla/inventory/group_vars/bar_group' }}"
|
||||||
|
content: |
|
||||||
|
---
|
||||||
|
bar_port: "4567"
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Test the kolla-ansible role with default values
|
- name: Test the kolla-ansible role with default values
|
||||||
include_role:
|
include_role:
|
||||||
@@ -61,6 +80,7 @@
|
|||||||
kolla_ansible_venv: "{{ temp_path }}/venv"
|
kolla_ansible_venv: "{{ temp_path }}/venv"
|
||||||
kolla_ansible_vault_password: "fake-password"
|
kolla_ansible_vault_password: "fake-password"
|
||||||
kolla_config_path: "{{ temp_path }}/etc/kolla"
|
kolla_config_path: "{{ temp_path }}/etc/kolla"
|
||||||
|
kolla_overcloud_group_vars_path: "{{ temp_path }}/etc/kayobe/kolla/inventory/group_vars"
|
||||||
kolla_node_custom_config_path: "{{ temp_path }}/etc/kolla/config"
|
kolla_node_custom_config_path: "{{ temp_path }}/etc/kolla/config"
|
||||||
kolla_ansible_passwords_path: "{{ temp_path }}/passwords.yml"
|
kolla_ansible_passwords_path: "{{ temp_path }}/passwords.yml"
|
||||||
# Config.
|
# Config.
|
||||||
@@ -496,6 +516,46 @@
|
|||||||
neutron_external_interface: "eth4,eth5"
|
neutron_external_interface: "eth4,eth5"
|
||||||
neutron_bridge_name: "br0,br1"
|
neutron_bridge_name: "br0,br1"
|
||||||
|
|
||||||
|
- name: Check whether inventory group vars files exist
|
||||||
|
stat:
|
||||||
|
path: "{{ temp_path ~ '/etc/kolla/inventory/overcloud/group_vars/' ~ item }}"
|
||||||
|
with_items:
|
||||||
|
- foo_group/all
|
||||||
|
- bar_group
|
||||||
|
register: group_vars_stat
|
||||||
|
|
||||||
|
- name: Validate inventory group vars files
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- item.stat.exists
|
||||||
|
- item.stat.size > 0
|
||||||
|
msg: >
|
||||||
|
Inventory file {{ item.item }} was not found.
|
||||||
|
with_items: "{{ group_vars_stat.results }}"
|
||||||
|
|
||||||
|
- name: Read inventory group vars files
|
||||||
|
slurp:
|
||||||
|
src: "{{ item.stat.path }}"
|
||||||
|
with_items: "{{ group_vars_stat.results }}"
|
||||||
|
register: group_vars_slurp
|
||||||
|
|
||||||
|
- name: Validate inventory group vars file contents
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- group_vars_content is defined
|
||||||
|
- group_vars_content == item.1
|
||||||
|
with_together:
|
||||||
|
- "{{ group_vars_slurp.results }}"
|
||||||
|
- "{{ expected_contents }}"
|
||||||
|
vars:
|
||||||
|
group_vars_content: "{{ item.0.content | b64decode }}"
|
||||||
|
expected_contents:
|
||||||
|
- |
|
||||||
|
---
|
||||||
|
foo_port: "1234"
|
||||||
|
- |
|
||||||
|
---
|
||||||
|
bar_port: "4567"
|
||||||
always:
|
always:
|
||||||
- name: Ensure the temporary directory is removed
|
- name: Ensure the temporary directory is removed
|
||||||
file:
|
file:
|
||||||
|
|||||||
@@ -299,6 +299,34 @@ to enable debug logging for Nova services:
|
|||||||
---
|
---
|
||||||
nova_logging_debug: true
|
nova_logging_debug: true
|
||||||
|
|
||||||
|
Custom Group Variables
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
Group variables can be used to set configuration for all hosts in a group. They
|
||||||
|
can be set in Kolla Ansible by placing files in
|
||||||
|
``${KAYOBE_CONFIG_PATH}/kolla/inventory/group_vars/*``. Since this
|
||||||
|
directory is copied directly into the Kolla Ansible inventory, Kolla
|
||||||
|
Ansible group names should be used. It should be noted that
|
||||||
|
``extra-vars`` and ``host_vars`` take precedence over ``group_vars``. For
|
||||||
|
more information on variable precedence see the Ansible `documentation
|
||||||
|
<http://docs.ansible.com/ansible/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable>`_.
|
||||||
|
|
||||||
|
Example: configure a Nova cell
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
In Kolla Ansible, :kolla-ansible-doc:`Nova cells are configured
|
||||||
|
<reference/compute/nova-cells-guide>` via group variables. For example, to
|
||||||
|
configure ``cell0001`` the following file could be created:
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
:caption: ``$KAYOBE_CONFIG_PATH/kolla/inventory/group_vars/cell0001/all``
|
||||||
|
|
||||||
|
---
|
||||||
|
nova_cell_name: cell0001
|
||||||
|
nova_cell_novncproxy_group: cell0001-vnc
|
||||||
|
nova_cell_conductor_group: cell0001-control
|
||||||
|
nova_cell_compute_group: cell0001-compute
|
||||||
|
|
||||||
Passwords
|
Passwords
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Adds support for passing through group vars to Kolla Ansible.
|
||||||
Reference in New Issue
Block a user