openstack-ansible-os_trove/tasks/trove_service_network.yml
Kyle L. Henderson 9d8a9347c4 Implement trove networking
To operate properly the trove guest agent needs access to
rabbitmq and also the neutron network for trove to use must
be created and defined in the trove.conf file.

This changeset adds documentation, tasks and
configuration defaults to setup the networking for
trove.

Change-Id: Idcf87c2eef0af475c02412f03433d22d7b08643f
2017-04-14 14:46:26 -05:00

78 lines
2.8 KiB
YAML

---
# Copyright 2016,2017 IBM Corp.
#
# 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.
- block:
- name: Get admin tenant id
keystone:
command: get_tenant
tenant_name: admin
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
- name: Store admin tenant id
set_fact:
keystone_admin_tenant_id: "{{ keystone_facts.id }}"
- name: Create trove service network
os_network:
cloud: default
validate_certs: "{{ trove_service_net_validate_certs }}"
state: present
name: "{{ trove_service_net_name }}"
provider_physical_network: "{{ trove_service_net_phys_net }}"
provider_network_type: "{{ trove_service_net_type }}"
project: "{{ keystone_admin_tenant_id }}"
wait: yes
register: trove_network
run_once: true
- name: Create trove service subnet
os_subnet:
cloud: default
validate_certs: "{{ trove_service_net_validate_certs }}"
state: present
network_name: "{{ trove_service_net_name }}"
name: "{{ trove_service_subnet_name }}"
allocation_pool_start: "{{ trove_service_net_allocation_pool_start | default(omit) }}"
allocation_pool_end: "{{ trove_service_net_allocation_pool_end | default(omit) }}"
cidr: "{{ trove_service_net_subnet_cidr }}"
enable_dhcp: "{{ trove_service_net_dhcp }}"
project: "{{ keystone_admin_tenant_id }}"
wait: yes
register: subnet_create
run_once: true
# Block end
when: trove_service_net_setup
# At this point we need to get the neutron network for trove to use. In our role testing
# environment this won't succeed. So we'll bypass it when in developer mode otherwise,
# this task will fail if trove_service_net_setup is false or else if the
# network isn't pre-created by the user.
- name: Get trove service net id
os_networks_facts:
cloud: default
validate_certs: "{{ trove_service_net_validate_certs }}"
wait: yes
name: "{{ trove_service_net_name }}"
run_once: true
when: not trove_developer_mode | bool
- name: Save trove service net id
set_fact:
trove_service_net_id: "{% if openstack_networks is defined %}{{ openstack_networks[0].id }}{% else %}UNKNOWN{% endif %}"
run_once: true