blob: 08d822c44a58b4d9eedab55020b61ee6a549adef [file] [log] [blame]
Mohammed Naserb7b97d62022-03-12 16:30:00 -05001# Copyright (c) 2022 VEXXHOST, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
vexxhost-bot18e53302024-06-19 00:37:30 +020015- name: Set external_dns_driver
16 ansible.builtin.set_fact:
17 _neutron_external_dns_driver: "designate"
18 when: neutron_designate_integration_enabled | bool
19
Mohammed Naser54ee9922023-07-22 18:40:25 +000020- name: Generate Helm values
21 ansible.builtin.set_fact:
22 _neutron_helm_values: "{{ __neutron_helm_values }}"
23
Mohammed Naser1d75a922023-07-23 19:24:49 +000024- name: Append Helm values
25 when: atmosphere_network_backend == 'ovn'
26 ansible.builtin.set_fact:
27 _neutron_helm_values: "{{ _neutron_helm_values | combine(__neutron_ovn_helm_values, recursive=True) }}"
Mohammed Naser54ee9922023-07-22 18:40:25 +000028
Mohammed Naser1c8e53f2024-07-03 13:04:36 -040029- name: Append Helm values (neutron_policy_server)
30 when: neutron_policy_server_integration_enabled | bool
31 ansible.builtin.set_fact:
32 _neutron_helm_values: "{{ _neutron_helm_values | combine(__neutron_policy_server_helm_values, recursive=True) }}"
33
Mohammed Naserb7b97d62022-03-12 16:30:00 -050034- name: Deploy Helm chart
guilhermesteinmuller6f6bf702023-01-24 19:00:19 +000035 run_once: true
36 kubernetes.core.helm:
Mohammed Naser2145fc32023-01-29 23:23:03 +000037 name: "{{ neutron_helm_release_name }}"
38 chart_ref: "{{ neutron_helm_chart_ref }}"
39 release_namespace: "{{ neutron_helm_release_namespace }}"
guilhermesteinmuller6f6bf702023-01-24 19:00:19 +000040 create_namespace: true
41 kubeconfig: /etc/kubernetes/admin.conf
Mohammed Naser2145fc32023-01-29 23:23:03 +000042 values: "{{ _neutron_helm_values | combine(neutron_helm_values, recursive=True) }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050043
44- name: Create Ingress
45 ansible.builtin.include_role:
46 name: openstack_helm_ingress
47 vars:
48 openstack_helm_ingress_endpoint: network
49 openstack_helm_ingress_service_name: neutron-server
50 openstack_helm_ingress_service_port: 9696
Mohammed Naser2145fc32023-01-29 23:23:03 +000051 openstack_helm_ingress_annotations: "{{ neutron_ingress_annotations }}"
Mohammed Naser58052682025-02-05 14:03:20 -050052 openstack_helm_ingress_class_name: "{{ neutron_ingress_class_name }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050053
Mohammed Naserb7b97d62022-03-12 16:30:00 -050054- name: Create networks
Mohammed Naser2145fc32023-01-29 23:23:03 +000055 when: neutron_networks | length > 0
Mohammed Naserc8e1a452022-08-11 16:16:13 -040056 block:
57 - name: Wait until network service ready
58 kubernetes.core.k8s_info:
59 api_version: apps/v1
60 kind: Deployment
61 name: neutron-server
62 namespace: openstack
63 wait_sleep: 10
64 wait_timeout: 600
65 wait: true
66 wait_condition:
67 type: Available
68 status: true
Mohammed Naserb7b97d62022-03-12 16:30:00 -050069
Mohammed Naserc8e1a452022-08-11 16:16:13 -040070 - name: Create networks
71 openstack.cloud.network:
72 cloud: atmosphere
73 # Network settings
74 name: "{{ item.name }}"
75 external: "{{ item.external | default(omit) }}"
76 shared: "{{ item.shared | default(omit) }}"
77 mtu_size: "{{ item.mtu_size | default(omit) }}"
78 port_security_enabled: "{{ item.port_security_enabled | default(omit) }}"
79 provider_network_type: "{{ item.provider_network_type | default(omit) }}"
80 provider_physical_network: "{{ item.provider_physical_network | default(omit) }}"
81 provider_segmentation_id: "{{ item.provider_segmentation_id | default(omit) }}"
Mohammed Naser2145fc32023-01-29 23:23:03 +000082 loop: "{{ neutron_networks }}"
Mohammed Naser52c3a702023-02-02 02:03:34 +000083 # NOTE(mnaser): This often fails since the SSL certificates are not
84 # ready yet. We need to wait for them to be ready.
85 retries: 60
86 delay: 5
87 register: _result
88 until: _result is not failed
Mohammed Naserc8e1a452022-08-11 16:16:13 -040089
90 - name: Create subnets
Mohammed Naser6c022e32025-02-05 13:20:09 -050091 vexxhost.atmosphere.subnet:
Mohammed Naserc8e1a452022-08-11 16:16:13 -040092 cloud: atmosphere
93 # Subnet settings
94 network_name: "{{ item.0.name }}"
95 name: "{{ item.1.name }}"
96 ip_version: "{{ item.1.ip_version | default(omit) }}"
97 cidr: "{{ item.1.cidr | default(omit) }}"
98 gateway_ip: "{{ item.1.gateway_ip | default(omit) }}"
99 no_gateway_ip: "{{ item.1.no_gateway_ip | default(omit) }}"
100 allocation_pool_start: "{{ item.1.allocation_pool_start | default(omit) }}"
101 allocation_pool_end: "{{ item.1.allocation_pool_end | default(omit) }}"
102 dns_nameservers: "{{ item.1.dns_nameservers | default(omit) }}"
103 enable_dhcp: "{{ item.1.enable_dhcp | default(omit) }}"
104 host_routes: "{{ item.1.host_routes | default(omit) }}"
105 ipv6_address_mode: "{{ item.1.ipv6_address_mode | default(omit) }}"
106 ipv6_ra_mode: "{{ item.1.ipv6_ra_mode | default(omit) }}"
107 with_subelements:
Mohammed Naser2145fc32023-01-29 23:23:03 +0000108 - "{{ neutron_networks }}"
Mohammed Naserc8e1a452022-08-11 16:16:13 -0400109 - subnets
Mohammed Naser52c3a702023-02-02 02:03:34 +0000110 # NOTE(mnaser): This often fails since the SSL certificates are not
111 # ready yet. We need to wait for them to be ready.
112 retries: 60
113 delay: 5
114 register: _result
115 until: _result is not failed