From 2bf4d4db4e9e67e571e3baa5122d4cf0f3d57244 Mon Sep 17 00:00:00 2001 From: Will Szumski Date: Mon, 22 Aug 2022 14:59:02 +0100 Subject: [PATCH] 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 --- ansible/roles/octavia/tasks/config.yml | 3 +++ ansible/roles/octavia/tasks/get_resources_info.yml | 4 ++++ ansible/roles/octavia/tasks/upgrade.yml | 3 --- doc/source/reference/networking/octavia.rst | 4 ++++ ...a-config-gen-with-autoconfigure-b2886ffc09fedebd.yaml | 9 +++++++++ 5 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/fix-octavia-config-gen-with-autoconfigure-b2886ffc09fedebd.yaml diff --git a/ansible/roles/octavia/tasks/config.yml b/ansible/roles/octavia/tasks/config.yml index ee0b1d9ea9..ae370541f8 100644 --- a/ansible/roles/octavia/tasks/config.yml +++ b/ansible/roles/octavia/tasks/config.yml @@ -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 }}" diff --git a/ansible/roles/octavia/tasks/get_resources_info.yml b/ansible/roles/octavia/tasks/get_resources_info.yml index 83d0911b85..21571d59b8 100644 --- a/ansible/roles/octavia/tasks/get_resources_info.yml +++ b/ansible/roles/octavia/tasks/get_resources_info.yml @@ -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: diff --git a/ansible/roles/octavia/tasks/upgrade.yml b/ansible/roles/octavia/tasks/upgrade.yml index becb086045..6ba9f99799 100644 --- a/ansible/roles/octavia/tasks/upgrade.yml +++ b/ansible/roles/octavia/tasks/upgrade.yml @@ -1,7 +1,4 @@ --- -- include_tasks: get_resources_info.yml - when: octavia_auto_configure | bool - - import_tasks: config.yml - import_tasks: check-containers.yml diff --git a/doc/source/reference/networking/octavia.rst b/doc/source/reference/networking/octavia.rst index 7094598636..735f5a180c 100644 --- a/doc/source/reference/networking/octavia.rst +++ b/doc/source/reference/networking/octavia.rst @@ -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 ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/releasenotes/notes/fix-octavia-config-gen-with-autoconfigure-b2886ffc09fedebd.yaml b/releasenotes/notes/fix-octavia-config-gen-with-autoconfigure-b2886ffc09fedebd.yaml new file mode 100644 index 0000000000..0e4081f131 --- /dev/null +++ b/releasenotes/notes/fix-octavia-config-gen-with-autoconfigure-b2886ffc09fedebd.yaml @@ -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 `__ + for more details.