From a4e243e882f28c7574f083c1581d93cc098f8cb4 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Mon, 23 Jan 2023 14:56:19 +0100 Subject: [PATCH] Increase volumes;Move template --- .../bootstrap/roles/metacluster/tasks/main.yml | 2 +- .../{bootstrap => common}/templates/registries.j2 | 0 .../upgrade/roles/metacluster/tasks/main.yml | 2 +- .../upgrade/roles/metacluster/tasks/storage.yml | 13 +++++++++++++ 4 files changed, 15 insertions(+), 2 deletions(-) rename ansible/roles/firstboot/files/ansible_payload/{bootstrap => common}/templates/registries.j2 (100%) create mode 100644 ansible/roles/firstboot/files/ansible_payload/upgrade/roles/metacluster/tasks/storage.yml diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/main.yml index 1fb25a3..b08f420 100644 --- a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/main.yml @@ -2,8 +2,8 @@ - import_tasks: k3s.yml - import_tasks: assets.yml - import_tasks: kube-vip.yml -- import_tasks: ingress.yml - import_tasks: storage.yml +- import_tasks: ingress.yml - import_tasks: certauthority.yml - import_tasks: registry.yml - import_tasks: git.yml diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/templates/registries.j2 b/ansible/roles/firstboot/files/ansible_payload/common/templates/registries.j2 similarity index 100% rename from ansible/roles/firstboot/files/ansible_payload/bootstrap/templates/registries.j2 rename to ansible/roles/firstboot/files/ansible_payload/common/templates/registries.j2 diff --git a/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/metacluster/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/metacluster/tasks/main.yml index 91401f0..8f73c80 100644 --- a/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/metacluster/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/metacluster/tasks/main.yml @@ -3,7 +3,7 @@ - import_tasks: k3s.yml - import_tasks: assets.yml # - import_tasks: ingress.yml -# - import_tasks: storage.yml +- import_tasks: storage.yml # - import_tasks: certauthority.yml # - import_tasks: git.yml # - import_tasks: gitops.yml diff --git a/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/metacluster/tasks/storage.yml b/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/metacluster/tasks/storage.yml new file mode 100644 index 0000000..d97d34c --- /dev/null +++ b/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/metacluster/tasks/storage.yml @@ -0,0 +1,13 @@ +- name: Increase replicas for each volume + kubernetes.core.k8s: + api_version: longhorn.io/v1beta2 + kind: volume + name: "{{ item.metadata.name }}" + namespace: longhorn-system + state: patched + definition: | + spec: + numberOfReplicas: {{ lookup('kubernetes.core.k8s', kind='node') | length | int }} + loop: "{{ lookup('kubernetes.core.k8s', api_version='longhorn.io/v1beta2', kind='volume', namespace='longhorn-system') }}" + loop_control: + label: "{{ item.metadata.name }}"