Fix issue with genconfig and octavia_auto_configure

Makes sure the facts required to generate octavia.conf are available
when using genconfig.

This change also ensures that the necessary tasks run when using Ansible
check mode.

Closes-Bug: #1987299
Change-Id: Ib8fbee2d3abdcfd2eae0f9b3e9b69eeb0e3086e0
This commit is contained in:
Will Szumski 2022-08-22 14:59:02 +01:00 committed by Michal Arbet
parent 10ca82c243
commit 2bf4d4db4e
5 changed files with 20 additions and 3 deletions

View File

@ -1,4 +1,7 @@
---
- include_tasks: get_resources_info.yml
when: octavia_auto_configure | bool
- name: Ensuring config directories exist
file:
path: "{{ node_config_directory }}/{{ item.key }}"

View File

@ -11,6 +11,7 @@
region_name: "{{ openstack_region_name }}"
name: "{{ octavia_amp_flavor.name }}"
run_once: True
check_mode: false
delegate_to: "{{ groups['octavia-api'][0] }}"
register: flavor_results
@ -27,6 +28,7 @@
name: "{{ octavia_service_auth_project }}"
run_once: True
delegate_to: "{{ groups['octavia-api'][0] }}"
check_mode: false
register: project_info
# NOTE(wuchunyang): ansible doesn't have a module to query security groups
@ -48,6 +50,7 @@
label: "{{ item.name }}"
run_once: True
delegate_to: "{{ groups['octavia-api'][0] }}"
check_mode: false
register: sec_grp_info
- name: Get loadbalancer management network
@ -64,6 +67,7 @@
register: network_results
run_once: True
delegate_to: "{{ groups['octavia-api'][0] }}"
check_mode: false
- name: Set octavia resources facts
set_fact:

View File

@ -1,7 +1,4 @@
---
- include_tasks: get_resources_info.yml
when: octavia_auto_configure | bool
- import_tasks: config.yml
- import_tasks: check-containers.yml

View File

@ -123,6 +123,10 @@ resources:
The configuration for these resources may be customised before deployment.
Note that for this to work access to the Nova and Neutron APIs is required.
This is true also for the ``kolla-ansible genconfig`` command and when using
Ansible check mode.
Customize Amphora flavor
~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -0,0 +1,9 @@
---
fixes:
- |
Fix issue with octavia config generation when using
``octavia_auto_configure`` and the ``genconfig`` command.
Note that access to the OpenStack API is necessary for Octavia auto
configuration to work, even when generating config.
See `LP#1987299 <https://bugs.launchpad.net/kolla-ansible/+bug/1987299>`__
for more details.