e0a69d0bda
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
78 lines
3.3 KiB
YAML
78 lines
3.3 KiB
YAML
---
|
|
# Copyright 2016, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# We set the python interpreter to the ansible runtime venv if
|
|
# the delegation is to localhost so that we get access to the
|
|
# appropriate python libraries in that venv. If the delegation
|
|
# is to another host, we assume that it is accessible by the
|
|
# system python instead.
|
|
- name: Setup the network
|
|
delegate_to: "{{ octavia_service_setup_host }}"
|
|
vars:
|
|
ansible_python_interpreter: >-
|
|
{{ (octavia_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable']) }}
|
|
block:
|
|
- name: Create mgmt network
|
|
run_once: true
|
|
os_network:
|
|
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 }}"
|
|
state: present
|
|
region_name: "{{ octavia_service_region }}"
|
|
name: "{{ octavia_neutron_management_network_name }}"
|
|
provider_network_type: "{{ octavia_provider_network_type }}"
|
|
provider_physical_network: "{{ octavia_provider_network_name }}"
|
|
provider_segmentation_id: "{{ octavia_provider_segmentation_id | default(omit) }}"
|
|
interface: admin
|
|
verify: "{{ not keystone_service_adminuri_insecure }}"
|
|
register: add_network
|
|
until: add_network is success
|
|
retries: 5
|
|
delay: 10
|
|
when:
|
|
- octavia_service_net_setup | bool
|
|
|
|
- name: Ensure mgmt subnet exists
|
|
run_once: true
|
|
os_subnet:
|
|
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 }}"
|
|
state: present
|
|
region_name: "{{ octavia_service_region }}"
|
|
network_name: "{{ octavia_neutron_management_network_name }}"
|
|
name: "{{ octavia_neutron_management_network_name }}-subnet"
|
|
cidr: "{{ octavia_management_net_subnet_cidr }}"
|
|
enable_dhcp: "{{ octavia_management_net_dhcp }}"
|
|
allocation_pool_start: "{{ octavia_management_net_subnet_allocation_pools.split('-')[0] | default(omit) }}"
|
|
allocation_pool_end: "{{ octavia_management_net_subnet_allocation_pools.split('-')[1] | default(omit) }}"
|
|
interface: admin
|
|
verify: "{{ not keystone_service_adminuri_insecure }}"
|
|
register: add_subnet
|
|
until: add_subnet is success
|
|
retries: 5
|
|
delay: 10
|
|
when:
|
|
- octavia_service_net_setup | bool
|