kayobe/ansible/roles/kolla-ansible/tests/test-defaults.yml
Will Szumski 35405d0a2d Remove unused kolla bootstrap-servers variables
We no longer use these variables since we switched to the kolla Ansible
collection.

TrivialFix

Change-Id: I50238dd694edc7ee02be4bfdc56ebf3a603e05d2
2023-12-01 16:23:20 +01:00

168 lines
6.7 KiB
YAML

---
- name: Test kolla-ansible role defaults
hosts: localhost
connection: local
tasks:
- name: Create a temporary directory
tempfile:
state: directory
register: tempfile_result
- block:
- name: Test the kolla-ansible role with default values
include_role:
name: ../../kolla-ansible
vars:
kolla_ansible_source_path: "{{ temp_path }}/src"
kolla_ansible_ctl_install_type: "source"
kolla_ansible_source_url: "http://github.com/openstack/kolla-ansible"
kolla_ansible_source_version: "{{ openstack_branch }}"
kolla_ansible_venv: "{{ temp_path }}/venv"
kolla_config_path: "{{ temp_path }}/etc/kolla"
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_inventory_search_paths:
- "{{ temp_path }}/etc/kayobe/"
kolla_ansible_passwords_path: "{{ temp_path }}/passwords.yml"
# Required config.
kolla_base_distro: "fake-distro"
kolla_base_distro_version: "1.23"
kolla_docker_namespace: "fake-namespace"
kolla_openstack_release: "fake-release"
kolla_internal_vip_address: "10.0.0.1"
kolla_internal_fqdn: "fake.internal.fqdn"
kolla_external_vip_address: "10.0.0.2"
kolla_external_fqdn: "fake.external.fqdn"
kolla_ansible_certificates_path: "{{ temp_path }}/etc/kayobe/kolla/certificates"
kolla_enable_tls_external: False
kolla_enable_tls_internal: False
kolla_enable_grafana: False
kolla_openstack_logging_debug: False
kolla_globals_paths_extra:
- "{{ tempfile_result.path ~ '/etc/kayobe/' }}"
apt_cache_valid_time: 3600
- name: Verify kolla-ansible installation
shell: ". {{ temp_path }}/venv/bin/activate && kolla-ansible -h"
changed_when: False
- name: Verify ansible installation
command: "{{ temp_path }}/venv/bin/ansible -h"
changed_when: False
- name: Validate globals.yml contents
assert:
that:
- item.key in globals_yml
- globals_yml[item.key] == item.value
msg: >
Unexpected value for variable "{{ item.key }}" in globals.yml.
Expected "{{ item.value }}", actual
"{{ globals_yml.get(item.key, '<missing>') }}".
with_dict: "{{ expected_variables }}"
vars:
# NOTE: Can't use set_fact for this, as it causes kolla-ansible
# Jinja expressions to be evaluated.
globals_yml: "{{ lookup('file', temp_path ~ '/etc/kolla/globals.yml') | from_yaml }}"
expected_variables:
config_strategy: "COPY_ALWAYS"
kolla_base_distro: "fake-distro"
kolla_base_distro_version: "1.23"
openstack_release: "fake-release"
kolla_internal_vip_address: "10.0.0.1"
kolla_internal_fqdn: "fake.internal.fqdn"
kolla_external_vip_address: "10.0.0.2"
kolla_external_fqdn: "fake.external.fqdn"
node_custom_config: "{{ temp_path }}/etc/kolla/config"
docker_namespace: "fake-namespace"
neutron_plugin_agent: "openvswitch"
kolla_enable_tls_external: False
kolla_enable_tls_internal: False
openstack_logging_debug: False
- name: Validate variables are absent from globals.yml
assert:
that: item not in globals_yml
msg: >
Unexpected variable "{{ item }}" found in globals.yml, value
"{{ globals_yml.get(item) }}".
with_items: "{{ unexpected_variables }}"
vars:
# NOTE: Can't use set_fact for this, as it causes kolla-ansible
# Jinja expressions to be evaluated.
globals_yml: "{{ lookup('file', temp_path ~ '/etc/kolla/globals.yml') | from_yaml }}"
unexpected_variables:
- docker_registry
- docker_registry_username
- docker_registry_password
- neutron_type_drivers
- neutron_tenant_network_types
- enable_glance
- enable_ironic
- enable_ironic_neutron_agent
- enable_influxdb
- enable_mariadb
- enable_neutron
- enable_nova
- enable_prometheus
- grafana_admin_username
- network_interface
- api_interface
- kolla_external_vip_interface
- storage_interface
- cluster_interface
- provision_interface
- ironic_dnsmasq_interface
- dns_interface
- tunnel_interface
- bifrost_network_interface
- neutron_external_interface
- neutron_bridge_name
- ironic_dnsmasq_dhcp_ranges
- name: Check whether inventory files exist
stat:
path: "{{ temp_path ~ '/etc/kolla/inventory/' ~ item }}"
with_items:
- seed
- overcloud
register: inventory_stat
- name: Look for inventory overrides
find:
paths: "{{ temp_path ~ '/etc/kolla/extra-inventories/' }}"
register: kolla_ansible_overcloud_inventory_overrides
- name: Check that no inventory overrides are configured
assert:
that:
- kolla_ansible_overcloud_inventory_overrides.matched == 0
msg: >
Overcloud group vars were found when they should not be set.
- name: Validate passwords.yml contents
assert:
that: item in passwords_yml
msg: >
Expected variable "{{ item }}" not present in passwords.yml.
with_items: "{{ expected_variables }}"
vars:
# NOTE: Can't use set_fact for this, as it causes kolla-ansible
# Jinja expressions to be evaluated.
passwords_yml: "{{ lookup('file', temp_path ~ '/etc/kolla/passwords.yml') | from_yaml }}"
expected_variables:
- database_password
always:
- name: Ensure the temporary directory is removed
file:
path: "{{ temp_path }}"
state: absent
rescue:
- name: Flag that a failure occurred
set_fact:
test_failures: "{{ test_failures | default(0) | int + 1 }}"
vars:
temp_path: "{{ tempfile_result.path }}"