Ensure that the flavor/network facts are available to all targets

Currently the registered result for the flavor creation is
only available on localhost. To ensure that it is available
on all hosts we first create it using the designated service
host, then fetch the details and set a fact for all hosts.

We do the same for the management network fact.

In order to achieve this, shade needs to be present on the
target host, so we add it into the octavia venv. We also make
sure that the octavia service account is used, because that's
where the flavor and network objects were created and only that
account has access to them.

Change-Id: I85b533dbb5fa29382dc615b584b21ff1a5d67a46
This commit is contained in:
Jesse Pretorius 2018-10-17 17:44:13 +01:00
parent d699d4e6f4
commit e0a69d0bda
4 changed files with 57 additions and 32 deletions

View File

@ -165,6 +165,7 @@ octavia_pip_packages:
- python-openstackclient
- python-octaviaclient
- octavia
- shade
- uwsgi
octavia_optional_oslomsg_amqp1_pip_packages:

View File

@ -46,7 +46,3 @@
until: add_flavor is success
retries: 5
delay: 10
- name: Set Octavia Flavor UUID fact 1
set_fact:
octavia_nova_flavor_uuid: "{{ add_flavor.flavor.id }}"

View File

@ -75,23 +75,3 @@
delay: 10
when:
- octavia_service_net_setup | bool
- name: Get neutron network
run_once: true
os_networks_facts:
cloud: default
region_name: "{{ octavia_service_region }}"
name: "{{ octavia_neutron_management_network_name }}"
interface: admin
verify: "{{ not keystone_service_adminuri_insecure }}"
register: get_net_facts
until: get_net_facts is success
retries: 5
delay: 10
- name: Set provisioning UUID fact
set_fact:
octavia_neutron_management_network_uuid: "{{ openstack_networks[0].id }}"
when:
- octavia_neutron_management_network_uuid is not defined
- octavia_neutron_management_network_name is defined

View File

@ -65,6 +65,62 @@
mode: "0640"
with_items: "{{ octavia_user_haproxy_templates }}"
- name: Set octavia_nova_flavor_uuid if it is not already set
when:
- octavia_nova_flavor_uuid is not defined
block:
- name: Get Octavia flavor details
os_flavor_facts:
auth:
auth_url: "{{ keystone_service_adminurl }}"
username: "{{ octavia_service_user_name }}"
password: "{{ octavia_service_password }}"
project_name: "{{ octavia_service_project_name }}"
user_domain_name: "{{ octavia_service_user_domain_id }}"
project_domain_name: "{{ octavia_service_project_domain_id }}"
region_name: "{{ octavia_service_region }}"
name: "{{ octavia_amp_flavor_name }}"
interface: admin
verify: "{{ not keystone_service_adminuri_insecure }}"
register: get_flavor_facts
until: get_flavor_facts is success
retries: 5
vars:
ansible_python_interpreter: "{{ octavia_bin }}/python"
- name: Set Octavia flavor UUID fact
set_fact:
octavia_nova_flavor_uuid: "{{ openstack_flavors[0].id }}"
- name: Set octavia_neutron_management_network_uuid if it is not already set
when:
- octavia_neutron_management_network_uuid is not defined
- octavia_neutron_management_network_name is defined
block:
- name: Get octavia management network details
os_networks_facts:
auth:
auth_url: "{{ keystone_service_adminurl }}"
username: "{{ octavia_service_user_name }}"
password: "{{ octavia_service_password }}"
project_name: "{{ octavia_service_project_name }}"
user_domain_name: "{{ octavia_service_user_domain_id }}"
project_domain_name: "{{ octavia_service_project_domain_id }}"
region_name: "{{ octavia_service_region }}"
name: "{{ octavia_neutron_management_network_name }}"
interface: admin
verify: "{{ not keystone_service_adminuri_insecure }}"
register: get_net_facts
until: get_net_facts is success
retries: 5
delay: 10
vars:
ansible_python_interpreter: "{{ octavia_bin }}/python"
- name: Set Octavia management network UUID fact
set_fact:
octavia_neutron_management_network_uuid: "{{ openstack_networks[0].id }}"
- name: Drop octavia Config(s)
config_template:
src: "{{ item.src }}"
@ -79,13 +135,5 @@
dest: "/etc/octavia/octavia.conf"
config_overrides: "{{ octavia_octavia_conf_overrides }}"
config_type: "ini"
# - src: "api-paste.ini.j2"
# dest: "/etc/octavia/api-paste.ini"
# config_overrides: "{{ octavia_api_paste_ini_overrides }}"
# config_type: "ini"
# - src: "policy.json.j2"
# dest: "/etc/octavia/policy.json"
# config_overrides: "{{ octavia_policy_overrides }}"
# config_type: "json"
notify:
- Restart octavia services