kayobe/ansible/kolla-openstack.yml
Will Szumski 9a5d572a09 Bump up Ansible supported versions to 8.x/9.x
This change bumps up the maximum supported Ansible version to 9.x
(ansible-core 2.16.x) and minimum to 8.x. This synchronises Kayobe with
Kolla Ansible.

Notable changes
---------------

- Removed use of get_md5 when using stat module, See:
  d955fb1590

- Remove use of include (instead of import_tasks/include_tasks) which
  has now been removed. See:
  8db9bd7574

Change-Id: I2ea9b2ec58913722c4defffbeee88cc420dcbdab
2024-05-27 15:31:46 +00:00

180 lines
7.9 KiB
YAML

---
- name: Check whether Ironic is enabled
hosts: controllers
gather_facts: False
tags:
- config
- config-validation
- kolla-ansible
- kolla-openstack
tasks:
- name: Create controllers group with ironic enabled
group_by:
key: "controllers_with_ironic_enabled_{{ kolla_enable_ironic | bool }}"
changed_when: false
- name: Ensure locally built Ironic Python Agent images are copied
hosts: controllers_with_ironic_enabled_True[0]
gather_facts: False
tags:
- kolla-ansible
- kolla-openstack
vars:
# These are the filenames generated by overcloud-ipa-build.yml.
ipa_image_name: "ipa"
ipa_images:
- "{{ ipa_image_name }}.kernel"
- "{{ ipa_image_name }}.initramfs"
tasks:
- block:
- block:
- name: Check for the presence of locally built Ironic Python Agent (IPA) images
stat:
path: "{{ image_cache_path }}/{{ ipa_image_name }}/{{ item }}"
get_checksum: False
mime: False
with_items: "{{ ipa_images }}"
register: ipa_image_stat
- name: Validate the presence of locally built Ironic Python Agent (IPA) images
fail:
msg: >
Expected locally built Ironic Python Agent (IPA) image
{{ item.item }} was not present in
{{ image_cache_path }}/{{ ipa_image_name }}.
with_items: "{{ ipa_image_stat.results }}"
when: not item.stat.exists
tags:
- config-validation
- name: Check whether the image cache directory exists
local_action:
module: stat
path: "{{ hostvars.localhost.image_cache_path }}"
get_checksum: False
mime: False
register: image_cache_stat
- name: Ensure the image cache directory exists
local_action:
module: file
path: "{{ hostvars.localhost.image_cache_path }}"
state: directory
owner: "{{ lookup('env', 'USER') }}"
group: "{{ lookup('env', 'USER') }}"
become: True
when: >-
not image_cache_stat.stat.exists or
not image_cache_stat.stat.writeable
- name: Ensure Ironic Python Agent images are copied onto the local machine
fetch:
src: "{{ image_cache_path }}/{{ ipa_image_name }}/{{ item.src }}"
dest: "{{ hostvars.localhost.image_cache_path }}/{{ ipa_image_name }}/{{ item.dest }}"
flat: True
with_items:
- src: "{{ ipa_images[0] }}"
dest: "{{ ipa_images_kernel_name }}"
- src: "{{ ipa_images[1] }}"
dest: "{{ ipa_images_ramdisk_name }}"
when:
- kolla_enable_ironic | bool
- ipa_build_images | bool
tags:
- config
- name: Ensure Kolla OpenStack components are configured
hosts: localhost
tags:
- kolla-ansible
- kolla-openstack
vars:
switch_type_to_device_type:
arista: netmiko_arista_eos
dellos9: netmiko_dell_force10
dellos10: netmiko_dell_os10
dell-powerconnect: netmiko_dell_powerconnect
junos: netmiko_juniper
openvswitch: netmiko_ovs_linux
ipa_image_name: "ipa"
pre_tasks:
- block:
- name: Validate switch configuration for Neutron ML2 genericswitch driver
fail:
msg: >
Switch configuration for {{ item }} is invalid. The following
variables must be set for the host: switch_type, ansible_host,
ansible_user, ansible_ssh_pass. Further, switch_type must be one of
{{ switch_type_to_device_type.keys() | join(', ') }}.
with_items: "{{ kolla_neutron_ml2_generic_switch_hosts }}"
when: >
item not in hostvars or
'switch_type' not in hostvars[item] or
hostvars[item].switch_type not in switch_type_to_device_type or
'ansible_host' not in hostvars[item] or
'ansible_user' not in hostvars[item] or
'ansible_ssh_pass' not in hostvars[item]
tags:
- config-validation
- name: Update a fact containing switches for use by Neutron ML2 genericswitch driver
set_fact:
kolla_neutron_ml2_generic_switches: >
{{
kolla_neutron_ml2_generic_switches +
[{
'name': item,
'device_type': switch_type_to_device_type[hostvars[item].switch_type],
'ip': hostvars[item].ansible_host,
'username': hostvars[item].ansible_user,
'password': hostvars[item].ansible_ssh_pass,
'ngs_trunk_ports': (
hostvars[item].switch_interface_config |
switch_interface_config_select_description(kolla_neutron_ml2_generic_switch_trunk_port_hosts) |
switch_interface_config_select_trunk()).keys() | join(',')
} | combine(hostvars[item].kolla_neutron_ml2_generic_switch_extra) ]
}}
with_items: "{{ kolla_neutron_ml2_generic_switch_hosts }}"
- block:
- name: Set facts containing IPA kernel and ramdisk URLs
set_fact:
kolla_inspector_ipa_kernel_upstream_url: "{{ inspector_ipa_kernel_upstream_url }}"
kolla_inspector_ipa_kernel_checksum_url: "{{ inspector_ipa_kernel_checksum_url }}"
kolla_inspector_ipa_kernel_checksum_algorithm: "{{ inspector_ipa_kernel_checksum_algorithm }}"
kolla_inspector_ipa_ramdisk_upstream_url: "{{ inspector_ipa_ramdisk_upstream_url }}"
kolla_inspector_ipa_ramdisk_checksum_url: "{{ inspector_ipa_ramdisk_checksum_url }}"
kolla_inspector_ipa_ramdisk_checksum_algorithm: "{{ inspector_ipa_ramdisk_checksum_algorithm }}"
when: not ipa_build_images | bool
- name: Set facts containing IPA kernel and ramdisk paths
set_fact:
kolla_inspector_ipa_kernel_path: "{{ image_cache_path }}/{{ ipa_image_name }}/{{ ipa_images_kernel_name }}"
kolla_inspector_ipa_ramdisk_path: "{{ image_cache_path }}/{{ ipa_image_name }}/{{ ipa_images_ramdisk_name }}"
when: ipa_build_images | bool
when: kolla_enable_ironic | bool
tags:
- config
roles:
- role: kolla-openstack
# Ironic inspector configuration.
kolla_inspector_processing_hooks: "{{ inspector_processing_hooks }}"
kolla_inspector_add_ports: "{{ inspector_add_ports }}"
kolla_inspector_keep_ports: "{{ inspector_keep_ports }}"
kolla_inspector_enable_discovery: "{{ inspector_enable_discovery }}"
kolla_inspector_discovery_enroll_node_driver: "{{ inspector_discovery_enroll_node_driver }}"
# Ironic inspector swift store configuration. Currently only supports the
# 'fake' inspection store.
kolla_inspector_enable_swift: "{{ inspector_store_enabled }}"
kolla_inspector_swift_auth:
auth_type: none
endpoint_override: "http://{% raw %}{{ api_interface_address }}{% endraw %}:{{ inspector_store_port }}"
kolla_openstack_custom_config_paths_extra_multi_env_static:
- "{{ kayobe_config_path }}"
kolla_openstack_custom_config_paths_extra_multi_env: "{{ kolla_openstack_custom_config_paths_extra_multi_env_static + kayobe_env_search_paths }}"
kolla_openstack_custom_config_paths_extra_legacy:
- "{{ kayobe_env_config_path }}"
kolla_openstack_custom_config_paths_extra: "{{ kolla_openstack_custom_config_paths_extra_multi_env if kolla_openstack_custom_config_environment_merging_enabled | bool else kolla_openstack_custom_config_paths_extra_legacy }}"
kolla_libvirt_tls: "{{ compute_libvirt_enable_tls | bool }}"
kolla_nova_libvirt_certificates_src: "{{ kayobe_env_config_path }}/certificates/libvirt"