kayobe/ansible/roles/kolla-ansible/tests/test-extras.yml

332 lines
14 KiB
YAML

---
- 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
static: False
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: "master"
kolla_ansible_venv: "{{ temp_path }}/venv"
kolla_ansible_vault_password: "fake-password"
kolla_config_path: "{{ temp_path }}/etc/kolla"
kolla_node_custom_config_path: "{{ temp_path }}/etc/kolla/config"
kolla_ansible_passwords_path: "{{ temp_path }}/passwords.yml"
# Config.
kolla_base_distro: "fake-distro"
kolla_install_type: "fake-install-type"
kolla_docker_namespace: "fake-namespace"
kolla_docker_registry: "fake-registry"
kolla_docker_registry_username: "fake-username"
kolla_docker_registry_password: "fake-password"
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_network_interface: "eth0"
kolla_external_vip_interface: "eth1"
kolla_api_interface: "eth2"
kolla_storage_interface: "eth3"
kolla_cluster_interface: "eth4"
kolla_dns_interface: "eth5"
kolla_neutron_external_interfaces:
- "eth6"
- "eth7"
kolla_neutron_bridge_names:
- "br0"
- "br1"
kolla_bifrost_network_interface: "eth8"
kolla_provision_interface: "eth9"
kolla_inspector_dnsmasq_interface: "eth10"
kolla_neutron_ml2_type_drivers:
- "fake-ml2-type-1"
- "fake-ml2-type-2"
kolla_neutron_ml2_tenant_network_types:
- "fake-ml2-tenant-type-1"
- "fake-ml2-tenant-type-2"
kolla_enable_tls_external: False
kolla_external_fqdn_cert: "fake-cert"
kolla_openstack_logging_debug: True
grafana_local_admin_user_name: "grafana-admin"
# Enable everything.
kolla_enable_aodh: True
kolla_enable_barbican: True
kolla_enable_ceilometer: True
kolla_enable_central_logging: True
kolla_enable_ceph: True
kolla_enable_ceph_rgw: True
kolla_enable_cinder: True
kolla_enable_cinder_backend_hnas_iscsi: True
kolla_enable_cinder_backend_hnas_nfs: True
kolla_enable_cinder_backend_iscsi: True
kolla_enable_cinder_backend_lvm: True
kolla_enable_cinder_backend_nfs: True
kolla_enable_cloudkitty: True
kolla_enable_congress: True
kolla_enable_designate: True
kolla_enable_elasticsearch: True
kolla_enable_etcd: True
kolla_enable_freezer: True
kolla_enable_gnocchi: True
kolla_enable_grafana: True
kolla_enable_haproxy: True
kolla_enable_heat: True
kolla_enable_horizon: True
kolla_enable_influxdb: True
kolla_enable_ironic: True
kolla_enable_kafka: True
kolla_enable_karbor: True
kolla_enable_kibana: True
kolla_enable_kuryr: True
kolla_enable_magnum: True
kolla_enable_manila: True
kolla_enable_manila_backend_generic: True
kolla_enable_manila_backend_hnas: True
kolla_enable_mariadb: True
kolla_enable_mistral: True
kolla_enable_monasca: True
kolla_enable_mongodb: True
kolla_enable_murano: True
kolla_enable_multipathd: True
kolla_enable_neutron_agent_ha: True
kolla_enable_neutron_bgp_dragent: True
kolla_enable_neutron_dvr: True
kolla_enable_neutron_fwaas: True
kolla_enable_neutron_lbaas: True
kolla_enable_neutron_provider_networks: True
kolla_enable_neutron_qos: True
kolla_enable_neutron_vpnaas: True
kolla_enable_nova_serialconsole_proxy: True
kolla_enable_octavia: True
kolla_enable_osprofiler: True
kolla_enable_panko: True
kolla_enable_rally: True
kolla_enable_searchlight: True
kolla_enable_sahara: True
kolla_enable_senlin: True
kolla_enable_skydive: True
kolla_enable_solum: True
kolla_enable_swift: True
kolla_enable_tacker: True
kolla_enable_telegraf: True
kolla_enable_tempest: True
kolla_enable_trove: True
kolla_enable_watcher: True
kolla_enable_zookeeper: True
kolla_enable_zun: True
kolla_extra_globals:
extra-global-1: "extra-val-1"
extra-global-2: "extra-val-2"
kolla_ansible_custom_passwords:
custom-password-1: "custom-password-1"
custom-password-2: "custom-password-2"
kolla_nova_compute_ironic_host: "controller1"
- name: Verify kolla-ansible installation
command: "{{ temp_path }}/venv/bin/kolla-ansible -h"
changed_when: False
- name: Verify ansible installation
command: "{{ temp_path }}/venv/bin/ansible -h"
changed_when: False
- name: Validate variables are absent from globals.yml
debug:
var: globals_yml
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 }}"
- 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_install_type: "fake-install-type"
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"
docker_registry: "fake-registry"
docker_registry_username: "fake-username"
docker_registry_password: "fake-password"
network_interface: "eth0"
kolla_external_vip_interface: "eth1"
storage_interface: "eth3"
cluster_interface: "eth4"
dns_interface: "eth5"
neutron_external_interface: "eth6,eth7"
neutron_bridge_name: "br0,br1"
bifrost_network_interface: "eth8"
ironic_dnsmasq_interface: "eth10"
neutron_plugin_agent: "openvswitch"
kolla_enable_tls_external: False
kolla_external_fqdn_cert: "fake-cert"
openstack_logging_debug: True
grafana_admin_username: "grafana-admin"
# NOTE: The following options are not present in globals.yml.
# It's possible this is related to the use of hostvars and
# include_role, caused by something like
# https://github.com/ansible/ansible/issues/19305.
#enable_aodh: True
#enable_barbican: True
#enable_ceilometer: True
#enable_central_logging: True
#enable_ceph: True
#enable_ceph_rgw: True
#enable_cinder: True
#enable_cinder_backend_iscsi: True
#enable_cinder_backend_hnas_iscsi: True
#enable_cinder_backend_hnas_nfs: True
#enable_cinder_backend_lvm: True
#enable_cinder_backend_nfs: True
#enable_cloudkitty: True
#enable_congress: True
#enable_designate: True
#enable_elasticsearch: True
#enable_etcd: True
#enable_freezer: True
#enable_gnocchi: True
#enable_grafana: True
#enable_haproxy: True
#enable_heat: True
#enable_horizon: True
#enable_influxdb: True
#enable_ironic: True
#enable_kafka: True
#enable_karbor: True
#enable_kibana: True
#enable_kuryr: True
#enable_magnum: True
#enable_manila: True
#enable_manila_backend_generic: True
#enable_manila_backend_hnas: True
#enable_mariadb: True
#enable_mistral: True
#enable_mongodb: True
#enable_murano: True
#enable_multipathd: True
#enable_neutron_agent_ha: True
#enable_neutron_bgp_dragent: True
#enable_neutron_dvr: True
#enable_neutron_fwaas: True
#enable_neutron_lbaas: True
#enable_neutron_provider_networks: True
#enable_neutron_qos: True
#enable_neutron_vpnaas: True
#enable_nova_serialconsole_proxy: True
#enable_octavia: True
#enable_osprofiler: True
#enable_panko: True
#enable_rally: True
#enable_sahara: True
#enable_searchlight: True
#enable_skydive: True
#enable_solum: True
#enable_senlin: True
#enable_swift: True
#enable_tacker: True
#enable_telegraf: True
#enable_tempest: True
#enable_trove: True
#enable_watcher: True
#enable_zookeeper: True
#enable_zun: True
extra-global-1: "extra-val-1"
extra-global-2: "extra-val-2"
- 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:
- enable_glance
- enable_ironic
- enable_neutron
- enable_nova
- name: Create a vault password file
copy:
content: "fake-password"
dest: "{{ temp_path ~ '/vault-pass' }}"
- name: Decrypt passwords.yml
command: ansible-vault decrypt --vault-password-file {{ temp_path ~ '/vault-pass' }} {{ temp_path ~ '/etc/kolla/passwords.yml' }}
changed_when: False
- 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
- custom-password-1
- custom-password-2
- name: Validate passwords.yml custom passwords
assert:
that:
- item.key in passwords_yml
- passwords_yml[item.key] == item.value
msg: >
Expected custom password "{{ item.key }}" not present in passwords.yml.
with_dict: "{{ 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:
custom-password-1: custom-password-1
custom-password-2: custom-password-2
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 }}"