Register resources info for octavia upgrading

kolla-ansible upgrade failed when octavia_auto_configure set
to true. because upgrade action don't register the resources
info.
this change adds some tasks to query the resources info
for upgrade action in octavia role.

Change-Id: I4b0ac001b38bee81d983dd68534b9d0e78b4f6d7
This commit is contained in:
wu.chunyang 2020-08-13 14:15:03 +08:00
parent e45cfec339
commit 7f7bb1b448
3 changed files with 71 additions and 1 deletions

View File

@ -0,0 +1,67 @@
---
- name: Get amphora flavor info
become: true
kolla_toolbox:
module_name: os_flavor_info
module_args:
auth: "{{ octavia_user_auth }}"
cacert: "{{ openstack_cacert }}"
endpoint_type: "{{ openstack_interface }}"
region_name: "{{ openstack_region_name }}"
name: "{{ octavia_amp_flavor.name }}"
run_once: True
delegate_to: "{{ groups['octavia-api'][0] }}"
register: flavor_results
- name: Get {{ octavia_service_auth_project }} project id
become: True
kolla_toolbox:
module_name: os_project_info
module_args:
auth: "{{ octavia_user_auth }}"
cacert: "{{ openstack_cacert }}"
endpoint_type: "{{ openstack_interface }}"
region_name: "{{ openstack_region_name }}"
name: "{{ octavia_service_auth_project }}"
run_once: True
delegate_to: "{{ groups['octavia-api'][0] }}"
register: project_info
# NOTE(wuchunyang): ansible doesn't have a module to query security groups
# let's use os_security_group module instead.
- name: Get security groups for octavia
become: true
kolla_toolbox:
module_name: os_security_group
module_args:
auth: "{{ octavia_user_auth }}"
cacert: "{{ openstack_cacert }}"
endpoint_type: "{{ openstack_interface }}"
region_name: "{{ openstack_region_name }}"
state: present
name: "{{ item.name }}"
loop: "{{ octavia_amp_security_groups.values() | list }}"
loop_control:
label: "{{ item.name }}"
run_once: True
delegate_to: "{{ groups['octavia-api'][0] }}"
register: sec_grp_info
- name: Get loadbalancer management network
become: true
kolla_toolbox:
module_name: os_networks_info
module_args:
auth: "{{ octavia_user_auth }}"
cacert: "{{ openstack_cacert }}"
endpoint_type: "{{ openstack_interface }}"
region_name: "{{ openstack_region_name }}"
name: "{{ octavia_amp_network['name'] }}"
register: network_results
run_once: True
delegate_to: "{{ groups['octavia-api'][0] }}"
- name: Set octavia resources facts
set_fact:
network_info: "{{ network_results.openstack_networks.0 }}"
amphora_flavor_info: "{{ flavor_results.openstack_flavors.0 }}"

View File

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

View File

@ -89,7 +89,7 @@ amp_flavor_id = {{ octavia_amp_flavor_id }}
amp_image_owner_id = {{ project_info.openstack_projects.0.id }}
amp_boot_network_list = {{ network_info.id }}
amp_secgroup_list = {{ (sec_grp_info.results | selectattr('secgroup.name', 'equalto', octavia_amp_security_groups['mgmt-sec-grp'].name) | list).0.secgroup.id }}
amp_flavor_id = {{ amphora_flavor_info.flavor.id }}
amp_flavor_id = {{ amphora_flavor_info.id }}
{% endif %}
client_ca = /etc/octavia/certs/client_ca.cert.pem