Mohammed Naser | b7b97d6 | 2022-03-12 16:30:00 -0500 | [diff] [blame] | 1 | # 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 | |
Oleksandr Kozachenko | 316f6a7 | 2023-03-01 14:14:40 +0100 | [diff] [blame] | 15 | # NOTE(mnaser): Open vSwitch will refuse to start if `LimitMEMLOCK` is |
Mohammed Naser | 179bf0d | 2023-02-17 23:03:23 +0000 | [diff] [blame] | 16 | # not set to `infinity` in `/etc/systemd/system.conf`, so we run |
| 17 | # this task to ensure that it is set. |
Oleksandr Kozachenko | e558895 | 2023-03-01 10:20:35 +0100 | [diff] [blame] | 18 | - name: Verify that LimitMEMLOCK is configured for containerd |
Mohammed Naser | 179bf0d | 2023-02-17 23:03:23 +0000 | [diff] [blame] | 19 | block: |
Oleksandr Kozachenko | e558895 | 2023-03-01 10:20:35 +0100 | [diff] [blame] | 20 | - name: Get the current status of all systemd values for containerd |
Mohammed Naser | 179bf0d | 2023-02-17 23:03:23 +0000 | [diff] [blame] | 21 | changed_when: false |
Oleksandr Kozachenko | 316f6a7 | 2023-03-01 14:14:40 +0100 | [diff] [blame] | 22 | ansible.builtin.command: systemctl show containerd --property LimitMEMLOCK # noqa: command-instead-of-module |
Mohammed Naser | 179bf0d | 2023-02-17 23:03:23 +0000 | [diff] [blame] | 23 | register: _openvswitch_memlock_value |
| 24 | |
Oleksandr Kozachenko | e558895 | 2023-03-01 10:20:35 +0100 | [diff] [blame] | 25 | - name: Assert that LimitMEMLOCK is set to infinity |
Mohammed Naser | 179bf0d | 2023-02-17 23:03:23 +0000 | [diff] [blame] | 26 | ansible.builtin.assert: |
| 27 | that: |
Oleksandr Kozachenko | e558895 | 2023-03-01 10:20:35 +0100 | [diff] [blame] | 28 | - "'LimitMEMLOCK=infinity' in _openvswitch_memlock_value.stdout" |
Mohammed Naser | 179bf0d | 2023-02-17 23:03:23 +0000 | [diff] [blame] | 29 | |
Yaguang Tang | 76e0744 | 2024-08-09 11:28:53 +0800 | [diff] [blame] | 30 | - name: Cache openvswitch image before install or upgrade |
| 31 | block: |
| 32 | - name: Pull openvswitch image |
| 33 | ansible.builtin.command: crictl pull {{ atmosphere_images['openvswitch_vswitchd'] }} |
| 34 | register: pull_result |
| 35 | changed_when: false |
| 36 | |
| 37 | - name: Verify openvswitch image pull |
| 38 | ansible.builtin.assert: |
| 39 | that: |
| 40 | - pull_result.rc == 0 |
| 41 | - "'Image is up to date' in pull_result.stdout or 'Image pulled' in pull_result.stdout" |
| 42 | fail_msg: "Failed to pull openvswitch image" |
| 43 | success_msg: "Successfully pulled openvswitch image" |
| 44 | |
Mohammed Naser | b7b97d6 | 2022-03-12 16:30:00 -0500 | [diff] [blame] | 45 | - name: Deploy Helm chart |
guilhermesteinmuller | 6cfbdff | 2023-01-24 19:52:34 +0000 | [diff] [blame] | 46 | run_once: true |
Mohammed Naser | 1cec107 | 2023-02-25 04:43:38 +0000 | [diff] [blame] | 47 | delegate_to: "{{ groups['controllers'][0] }}" |
guilhermesteinmuller | 6cfbdff | 2023-01-24 19:52:34 +0000 | [diff] [blame] | 48 | kubernetes.core.helm: |
Mohammed Naser | 2145fc3 | 2023-01-29 23:23:03 +0000 | [diff] [blame] | 49 | name: "{{ openvswitch_helm_release_name }}" |
| 50 | chart_ref: "{{ openvswitch_helm_chart_ref }}" |
| 51 | release_namespace: "{{ openvswitch_helm_release_namespace }}" |
guilhermesteinmuller | 6cfbdff | 2023-01-24 19:52:34 +0000 | [diff] [blame] | 52 | create_namespace: true |
Austin Talbot | 78a774a | 2024-09-25 10:15:36 -0600 | [diff] [blame] | 53 | kubeconfig: "{{ openvswitch_helm_kubeconfig }}" |
Mohammed Naser | 2145fc3 | 2023-01-29 23:23:03 +0000 | [diff] [blame] | 54 | values: "{{ _openvswitch_helm_values | combine(openvswitch_helm_values, recursive=True) }}" |