blob: 9b3b1d58309e44f74418d8d50eea359f84828a6d [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.
18- name: Verify that DefaultLimitMEMLOCK is configured
19 block:
20 - name: Get the current status of all systemd values
21 changed_when: false
22 ansible.builtin.command: systemctl show --property DefaultLimitMEMLOCK # noqa: command-instead-of-module
23 register: _openvswitch_memlock_value
24
25 - name: Assert that DefaultLimitMEMLOCK is set to infinity
26 ansible.builtin.assert:
27 that:
28 - "'DefaultLimitMEMLOCK=infinity' in _openvswitch_memlock_value.stdout"
29
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000030- name: Uninstall the legacy HelmRelease
31 run_once: true
32 block:
33 - name: Suspend the existing HelmRelease
34 kubernetes.core.k8s:
35 state: patched
36 api_version: helm.toolkit.fluxcd.io/v2beta1
37 kind: HelmRelease
Mohammed Naser2145fc32023-01-29 23:23:03 +000038 name: "{{ openvswitch_helm_release_name }}"
39 namespace: "{{ openvswitch_helm_release_namespace }}"
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000040 definition:
41 spec:
42 suspend: true
43
44 - name: Remove the existing HelmRelease
45 kubernetes.core.k8s:
46 state: absent
47 api_version: helm.toolkit.fluxcd.io/v2beta1
48 kind: HelmRelease
Mohammed Naser2145fc32023-01-29 23:23:03 +000049 name: "{{ openvswitch_helm_release_name }}"
50 namespace: "{{ openvswitch_helm_release_namespace }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050051
52- name: Deploy Helm chart
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000053 run_once: true
54 kubernetes.core.helm:
Mohammed Naser2145fc32023-01-29 23:23:03 +000055 name: "{{ openvswitch_helm_release_name }}"
56 chart_ref: "{{ openvswitch_helm_chart_ref }}"
57 release_namespace: "{{ openvswitch_helm_release_namespace }}"
guilhermesteinmuller6cfbdff2023-01-24 19:52:34 +000058 create_namespace: true
59 kubeconfig: /etc/kubernetes/admin.conf
Mohammed Naser2145fc32023-01-29 23:23:03 +000060 values: "{{ _openvswitch_helm_values | combine(openvswitch_helm_values, recursive=True) }}"