blob: a6e3155989f9e1dd63869fa64ba65757f0ef61c6 [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
Mohammed Naser179bf0d2023-02-17 23:03:23 +000015# NOTE(mnaser): Open vSwitch will refuse to start if `DefaultLimitMEMLOCK` is
16# not set to `infinity` in `/etc/systemd/system.conf`, so we run
17# this task to ensure that it is set.
Oleksandr Kozachenkoe5588952023-03-01 10:20:35 +010018- name: Verify that LimitMEMLOCK is configured for containerd
Mohammed Naser179bf0d2023-02-17 23:03:23 +000019 block:
Oleksandr Kozachenkoe5588952023-03-01 10:20:35 +010020 - name: Get the current status of all systemd values for containerd
Mohammed Naser179bf0d2023-02-17 23:03:23 +000021 changed_when: false
Oleksandr Kozachenkoe5588952023-03-01 10:20:35 +010022 ansible.builtin.command: systemctl show containerd --property DefaultLimitMEMLOCK # noqa: command-instead-of-module
Mohammed Naser179bf0d2023-02-17 23:03:23 +000023 register: _openvswitch_memlock_value
24
Oleksandr Kozachenkoe5588952023-03-01 10:20:35 +010025 - name: Assert that LimitMEMLOCK is set to infinity
Mohammed Naser179bf0d2023-02-17 23:03:23 +000026 ansible.builtin.assert:
27 that:
Oleksandr Kozachenkoe5588952023-03-01 10:20:35 +010028 - "'LimitMEMLOCK=infinity' in _openvswitch_memlock_value.stdout"
Mohammed Naser179bf0d2023-02-17 23:03:23 +000029
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000030- name: Uninstall the legacy HelmRelease
31 run_once: true
Mohammed Naser1cec1072023-02-25 04:43:38 +000032 delegate_to: "{{ groups['controllers'][0] }}"
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000033 block:
34 - name: Suspend the existing HelmRelease
35 kubernetes.core.k8s:
36 state: patched
37 api_version: helm.toolkit.fluxcd.io/v2beta1
38 kind: HelmRelease
Mohammed Naser2145fc32023-01-29 23:23:03 +000039 name: "{{ openvswitch_helm_release_name }}"
40 namespace: "{{ openvswitch_helm_release_namespace }}"
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000041 definition:
42 spec:
43 suspend: true
44
45 - name: Remove the existing HelmRelease
46 kubernetes.core.k8s:
47 state: absent
48 api_version: helm.toolkit.fluxcd.io/v2beta1
49 kind: HelmRelease
Mohammed Naser2145fc32023-01-29 23:23:03 +000050 name: "{{ openvswitch_helm_release_name }}"
51 namespace: "{{ openvswitch_helm_release_namespace }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050052
53- name: Deploy Helm chart
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000054 run_once: true
Mohammed Naser1cec1072023-02-25 04:43:38 +000055 delegate_to: "{{ groups['controllers'][0] }}"
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000056 kubernetes.core.helm:
Mohammed Naser2145fc32023-01-29 23:23:03 +000057 name: "{{ openvswitch_helm_release_name }}"
58 chart_ref: "{{ openvswitch_helm_chart_ref }}"
59 release_namespace: "{{ openvswitch_helm_release_namespace }}"
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000060 create_namespace: true
61 kubeconfig: /etc/kubernetes/admin.conf
Mohammed Naser2145fc32023-01-29 23:23:03 +000062 values: "{{ _openvswitch_helm_values | combine(openvswitch_helm_values, recursive=True) }}"