diff --git a/ansible/roles/neutron-net/defaults/main.yml b/ansible/roles/neutron-net/defaults/main.yml index 50e41de2d..319e86e0d 100644 --- a/ansible/roles/neutron-net/defaults/main.yml +++ b/ansible/roles/neutron-net/defaults/main.yml @@ -25,6 +25,9 @@ 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: @@ -39,3 +42,12 @@ 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/tasks/main.yml b/ansible/roles/neutron-net/tasks/main.yml index 3230f436e..79b838849 100644 --- a/ansible/roles/neutron-net/tasks/main.yml +++ b/ansible/roles/neutron-net/tasks/main.yml @@ -14,6 +14,7 @@ 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 @@ -29,6 +30,16 @@ 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