kayobe/ansible/roles/kolla-ansible/tests/test-defaults.yml
Pierre Riteau f6660bbff8 Remove support for Monasca and its dependencies
This follows removal of support from Kolla Ansible. This also removes
support for configuring Grafana with overcloud post configure.

Change-Id: I8102fafb00db178f1ae6801d37c43a39033cbfe6
2022-12-13 14:32:33 +01:00

179 lines
7.0 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_group_vars_path: "{{ temp_path }}/etc/kayobe/kolla/inventory/group_vars"
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
kolla_user: "kolla"
kolla_group: "kolla"
- 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
- overcloud/group_vars
register: inventory_stat
- name: Validate inventory files
assert:
that:
- item.stat.exists
- item.stat.size > 0
msg: >
Inventory file {{ item.item }} was not found.
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
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 }}"