blob: aae6b5caff63b46e2fa98afcc86eb3d1282dc913 [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-bot31015ab2024-06-19 00:54:33 +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 Naserb7b97d62022-03-12 16:30:00 -050029- name: Deploy Helm chart
guilhermesteinmuller6f6bf702023-01-24 19:00:19 +000030 run_once: true
31 kubernetes.core.helm:
Mohammed Naser2145fc32023-01-29 23:23:03 +000032 name: "{{ neutron_helm_release_name }}"
33 chart_ref: "{{ neutron_helm_chart_ref }}"
34 release_namespace: "{{ neutron_helm_release_namespace }}"
guilhermesteinmuller6f6bf702023-01-24 19:00:19 +000035 create_namespace: true
36 kubeconfig: /etc/kubernetes/admin.conf
Mohammed Naser2145fc32023-01-29 23:23:03 +000037 values: "{{ _neutron_helm_values | combine(neutron_helm_values, recursive=True) }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050038
39- name: Create Ingress
40 ansible.builtin.include_role:
41 name: openstack_helm_ingress
42 vars:
43 openstack_helm_ingress_endpoint: network
44 openstack_helm_ingress_service_name: neutron-server
45 openstack_helm_ingress_service_port: 9696
Mohammed Naser2145fc32023-01-29 23:23:03 +000046 openstack_helm_ingress_annotations: "{{ neutron_ingress_annotations }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050047
Mohammed Naserb7b97d62022-03-12 16:30:00 -050048- name: Create networks
Mohammed Naser2145fc32023-01-29 23:23:03 +000049 when: neutron_networks | length > 0
Mohammed Naserc8e1a452022-08-11 16:16:13 -040050 block:
51 - name: Wait until network service ready
52 kubernetes.core.k8s_info:
53 api_version: apps/v1
54 kind: Deployment
55 name: neutron-server
56 namespace: openstack
57 wait_sleep: 10
58 wait_timeout: 600
59 wait: true
60 wait_condition:
61 type: Available
62 status: true
Mohammed Naserb7b97d62022-03-12 16:30:00 -050063
Mohammed Naserc8e1a452022-08-11 16:16:13 -040064 - name: Create networks
65 openstack.cloud.network:
66 cloud: atmosphere
67 # Network settings
68 name: "{{ item.name }}"
69 external: "{{ item.external | default(omit) }}"
70 shared: "{{ item.shared | default(omit) }}"
71 mtu_size: "{{ item.mtu_size | default(omit) }}"
72 port_security_enabled: "{{ item.port_security_enabled | default(omit) }}"
73 provider_network_type: "{{ item.provider_network_type | default(omit) }}"
74 provider_physical_network: "{{ item.provider_physical_network | default(omit) }}"
75 provider_segmentation_id: "{{ item.provider_segmentation_id | default(omit) }}"
Mohammed Naser2145fc32023-01-29 23:23:03 +000076 loop: "{{ neutron_networks }}"
Mohammed Naser52c3a702023-02-02 02:03:34 +000077 # NOTE(mnaser): This often fails since the SSL certificates are not
78 # ready yet. We need to wait for them to be ready.
79 retries: 60
80 delay: 5
81 register: _result
82 until: _result is not failed
Mohammed Naserc8e1a452022-08-11 16:16:13 -040083
84 - name: Create subnets
85 openstack.cloud.subnet:
86 cloud: atmosphere
87 # Subnet settings
88 network_name: "{{ item.0.name }}"
89 name: "{{ item.1.name }}"
90 ip_version: "{{ item.1.ip_version | default(omit) }}"
91 cidr: "{{ item.1.cidr | default(omit) }}"
92 gateway_ip: "{{ item.1.gateway_ip | default(omit) }}"
93 no_gateway_ip: "{{ item.1.no_gateway_ip | default(omit) }}"
94 allocation_pool_start: "{{ item.1.allocation_pool_start | default(omit) }}"
95 allocation_pool_end: "{{ item.1.allocation_pool_end | default(omit) }}"
96 dns_nameservers: "{{ item.1.dns_nameservers | default(omit) }}"
97 enable_dhcp: "{{ item.1.enable_dhcp | default(omit) }}"
98 host_routes: "{{ item.1.host_routes | default(omit) }}"
99 ipv6_address_mode: "{{ item.1.ipv6_address_mode | default(omit) }}"
100 ipv6_ra_mode: "{{ item.1.ipv6_ra_mode | default(omit) }}"
101 with_subelements:
Mohammed Naser2145fc32023-01-29 23:23:03 +0000102 - "{{ neutron_networks }}"
Mohammed Naserc8e1a452022-08-11 16:16:13 -0400103 - subnets
Mohammed Naser52c3a702023-02-02 02:03:34 +0000104 # NOTE(mnaser): This often fails since the SSL certificates are not
105 # ready yet. We need to wait for them to be ready.
106 retries: 60
107 delay: 5
108 register: _result
109 until: _result is not failed