From 149a765f89dc5914a2bce7da4c674a3a713f9be0 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 18 May 2017 10:13:38 +0100 Subject: [PATCH] Extract neutron-net role into a separate project on galaxy This allows it to be used by other projects. --- .gitignore | 1 + ansible/provision-net.yml | 29 +++++------ ansible/requirements.yml | 1 + ansible/roles/neutron-net/defaults/main.yml | 53 --------------------- ansible/roles/neutron-net/meta/main.yml | 4 -- ansible/roles/neutron-net/tasks/main.yml | 47 ------------------ 6 files changed, 17 insertions(+), 118 deletions(-) delete mode 100644 ansible/roles/neutron-net/defaults/main.yml delete mode 100644 ansible/roles/neutron-net/meta/main.yml delete mode 100644 ansible/roles/neutron-net/tasks/main.yml diff --git a/.gitignore b/.gitignore index bfb90b653..b2cb901c4 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,7 @@ ansible/roles/stackhpc.drac/ ansible/roles/stackhpc.drac-facts/ ansible/roles/stackhpc.os-flavors/ ansible/roles/stackhpc.os-openstackclient/ +ansible/roles/stackhpc.os-networks/ ansible/roles/stackhpc.os-projects/ ansible/roles/stackhpc.os-shade/ ansible/roles/resmo.ntp/ diff --git a/ansible/provision-net.yml b/ansible/provision-net.yml index fe89061b2..1e73b2e35 100644 --- a/ansible/provision-net.yml +++ b/ansible/provision-net.yml @@ -20,18 +20,19 @@ roles: - role: neutron-net - neutron_net_venv: "{{ venv }}" - neutron_net_openstack_auth_type: "{{ openstack_auth_type }}" - neutron_net_openstack_auth: "{{ openstack_auth }}" + os_networks_venv: "{{ venv }}" + os_networks_auth_type: "{{ openstack_auth_type }}" + os_networks_auth: "{{ openstack_auth }}" # Network configuration. - neutron_net_name: "{{ kolla_ironic_provisioning_network }}" - neutron_net_type: "{% if provision_wl_net_name | net_vlan %}vlan{% else %}flat{% endif %}" - neutron_net_physical_network: "physnet1" - neutron_net_segmentation_id: "{{ provision_wl_net_name | net_vlan }}" - neutron_net_shared: True - # Subnet configuration. - neutron_net_subnet_name: "{{ kolla_ironic_provisioning_network }}" - neutron_net_cidr: "{{ provision_wl_net_name | net_cidr }}" - neutron_net_gateway_ip: "{{ provision_wl_net_name | net_gateway }}" - neutron_net_allocation_pool_start: "{{ provision_wl_net_name | net_neutron_allocation_pool_start }}" - neutron_net_allocation_pool_end: "{{ provision_wl_net_name | net_neutron_allocation_pool_end }}" + os_networks: + - name: "{{ kolla_ironic_provisioning_network }}" + provider_network_type: "{% if provision_wl_net_name | net_vlan %}vlan{% else %}flat{% endif %}" + provider_physical_network: "physnet1" + provider_segmentation_id: "{{ provision_wl_net_name | net_vlan }}" + shared: True + subnets: + - name: "{{ kolla_ironic_provisioning_network }}" + cidr: "{{ provision_wl_net_name | net_cidr }}" + gateway_ip: "{{ provision_wl_net_name | net_gateway }}" + allocation_pool_start: "{{ provision_wl_net_name | net_neutron_allocation_pool_start }}" + allocation_pool_end: "{{ provision_wl_net_name | net_neutron_allocation_pool_end }}" diff --git a/ansible/requirements.yml b/ansible/requirements.yml index b274f206d..a05143c35 100644 --- a/ansible/requirements.yml +++ b/ansible/requirements.yml @@ -7,5 +7,6 @@ - src: stackhpc.drac - src: stackhpc.drac-facts - src: stackhpc.os-flavors +- src: stackhpc.os-networks - src: stackhpc.os-projects - src: yatesr.timezone diff --git a/ansible/roles/neutron-net/defaults/main.yml b/ansible/roles/neutron-net/defaults/main.yml deleted file mode 100644 index 319e86e0d..000000000 --- a/ansible/roles/neutron-net/defaults/main.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- -# Path to virtualenv in which to install shade and its dependencies. -neutron_net_venv: - -# Authentication type compatible with the 'os_network' Ansible module's -# auth_type argument. -neutron_net_openstack_auth_type: - -# Authentication parameters compatible with the 'os_network' Ansible module's -# auth argument. -neutron_net_openstack_auth: {} - -# Name of the Neutron network. -neutron_net_name: - -# Provider type of the Neutron network. -neutron_net_type: - -# Prpvider physical network of the Neutron network. -neutron_net_physical_network: - -# Provider segmentation ID of the Neutron network. -neutron_net_segmentation_id: - -# Whether the Neutron network is shared. -neutron_net_shared: - -# Whether the Neutron network is external. -neutron_net_external: - -# Name of the Neutron subnet. -neutron_net_subnet_name: - -# CIDR representation of the Neutron subnet's IP network. -neutron_net_cidr: - -# IP address of the Neutron subnet's gateway. -neutron_net_gateway_ip: - -# Start of the Neutron subnet's IP allocation pool. -neutron_net_allocation_pool_start: - -# End of the Neutron subnet's IP allocation pool. -neutron_net_allocation_pool_end: - -# Name of the Neutron router. -neutron_net_router_name: - -# List of subnets to attach to the router internal interface. -neutron_net_router_interfaces: - -# Unique name or ID of the external gateway network. -neutron_net_router_network: diff --git a/ansible/roles/neutron-net/meta/main.yml b/ansible/roles/neutron-net/meta/main.yml deleted file mode 100644 index d38acc41c..000000000 --- a/ansible/roles/neutron-net/meta/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -dependencies: - - role: stackhpc.os-shade - os_shade_venv: "{{ neutron_net_venv }}" diff --git a/ansible/roles/neutron-net/tasks/main.yml b/ansible/roles/neutron-net/tasks/main.yml deleted file mode 100644 index 79b838849..000000000 --- a/ansible/roles/neutron-net/tasks/main.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -# Note that setting this via a play or task variable seems to not -# evaluate the Jinja variable reference, so we use set_fact. -- name: Update the Ansible python interpreter fact to point to the virtualenv - set_fact: - ansible_python_interpreter: "{{ neutron_net_venv }}/bin/python" - -- name: Ensure network is registered with Neutron - os_network: - auth_type: "{{ neutron_net_openstack_auth_type }}" - auth: "{{ neutron_net_openstack_auth }}" - name: "{{ neutron_net_name }}" - provider_network_type: "{{ neutron_net_type | default(omit) }}" - provider_physical_network: "{{ neutron_net_physical_network | default(omit) }}" - provider_segmentation_id: "{{ neutron_net_segmentation_id | default(omit) }}" - shared: "{{ neutron_net_shared }}" - external: "{{ neutron_net_external }}" - state: present - -- name: Ensure subnet is registered with Neutron - os_subnet: - auth_type: "{{ neutron_net_openstack_auth_type }}" - auth: "{{ neutron_net_openstack_auth }}" - name: "{{ neutron_net_subnet_name }}" - network_name: "{{ neutron_net_name }}" - cidr: "{{ neutron_net_cidr }}" - gateway_ip: "{{ neutron_net_gateway_ip | default(omit) }}" - no_gateway_ip: "{{ not neutron_net_gateway_ip }}" - allocation_pool_start: "{{ neutron_net_allocation_pool_start | default(omit) }}" - allocation_pool_end: "{{ neutron_net_allocation_pool_end | default(omit) }}" - state: present - -- name: Ensure router is registered with Neutron - os_router: - auth_type: "{{ neutron_net_openstack_auth_type }}" - auth: "{{ neutron_net_openstack_auth }}" - name: "{{ neutron_net_router_name }}" - interfaces: "{{ neutron_net_router_interfaces or omit }}" - network: "{{ neutron_net_router_network or omit }}" - state: present - when: "{{ neutron_net_router_name != None }}" - -# This variable is unset before we set it, and it does not appear to be -# possible to unset a variable in Ansible. -- name: Set a fact to reset the Ansible python interpreter - set_fact: - ansible_python_interpreter: /usr/bin/python