From 78103e121ee5e59083bad03a66a09afe3dc28542 Mon Sep 17 00:00:00 2001 From: mrwho Date: Sun, 19 Jul 2026 16:13:42 +0300 Subject: [PATCH] refactor(uyuni): consolidate helm installation logic into dedicated task file Remove duplicated helm install tasks from main.yml and centralize them in helm.yml, simplifying the role structure and reducing redundancy by consolidating OCI registry and local chart installation paths into a single file. --- roles/uyuni/files/uyuni/server-helm/README.md | 32 ------------- roles/uyuni/tasks/helm.yml | 48 ------------------- roles/uyuni/tasks/main.yml | 33 +------------ 3 files changed, 2 insertions(+), 111 deletions(-) delete mode 100644 roles/uyuni/files/uyuni/server-helm/README.md diff --git a/roles/uyuni/files/uyuni/server-helm/README.md b/roles/uyuni/files/uyuni/server-helm/README.md deleted file mode 100644 index b0f0cc2..0000000 --- a/roles/uyuni/files/uyuni/server-helm/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# Uyuni Helm Chart Configuration - -This directory contains the Uyuni Helm chart and configuration files. - -## Chart Location - -The Uyuni Helm chart is located at: `uyuni/uyuni-server` - -## Custom Values - -You can customize the installation by modifying the values in your Ansible playbook: - -```yaml -uyuni_helm_values: - server: - hostname: uyuni.example.com - resources: - requests: - memory: "4Gi" - cpu: "2" - limits: - memory: "8Gi" - cpu: "4" - database: - type: internal - proxy: - enabled: false -``` - -## Documentation - -For detailed configuration options, see the [Uyuni Helm Chart documentation](https://github.com/uyuni-project/uyuni-helm). diff --git a/roles/uyuni/tasks/helm.yml b/roles/uyuni/tasks/helm.yml index 949bb5a..0ecff2b 100644 --- a/roles/uyuni/tasks/helm.yml +++ b/roles/uyuni/tasks/helm.yml @@ -14,51 +14,3 @@ PATH: "/usr/local/bin:/usr/bin:/bin" register: _helm_install changed_when: "'STATUS: deployed' in _helm_install.stdout or 'has been upgraded' in _helm_install.stdout" - when: uyuni_helm_values is defined - -- name: Helm | Install or upgrade Uyuni from OCI registry (no values) - ansible.builtin.command: > - helm upgrade --install uyuni-server oci://registry.opensuse.org/uyuni/server-helm - --namespace {{ uyuni_namespace }} - --create-namespace - --version {{ uyuni_chart_version }} - --timeout 20m0s - --wait - environment: - KUBECONFIG: "{{ uyuni_kubeconfig }}" - PATH: "/usr/local/bin:/usr/bin:/bin" - register: _helm_install_simple - changed_when: "'STATUS: deployed' in _helm_install_simple.stdout or 'has been upgraded' in _helm_install_simple.stdout" - when: uyuni_helm_values is not defined - -- name: Helm | Install or upgrade Uyuni - ansible.builtin.command: > - helm upgrade --install uyuni-server uyuni/uyuni-server - --namespace {{ uyuni_namespace }} - --create-namespace - --version {{ uyuni_chart_version }} - --set {{ item.key }}={{ item.value }} - --timeout 20m0s - --wait - loop: "{{ uyuni_helm_values | dict2items }}" - environment: - KUBECONFIG: "{{ uyuni_kubeconfig }}" - PATH: "/usr/local/bin:/usr/bin:/bin" - register: _helm_install - changed_when: "'STATUS: deployed' in _helm_install.stdout or 'has been upgraded' in _helm_install.stdout" - when: uyuni_helm_values is defined - -- name: Helm | Install or upgrade Uyuni (no values) - ansible.builtin.command: > - helm upgrade --install uyuni-server uyuni/uyuni-server - --namespace {{ uyuni_namespace }} - --create-namespace - --version {{ uyuni_chart_version }} - --timeout 20m0s - --wait - environment: - KUBECONFIG: "{{ uyuni_kubeconfig }}" - PATH: "/usr/local/bin:/usr/bin:/bin" - register: _helm_install_simple - changed_when: "'STATUS: deployed' in _helm_install_simple.stdout or 'has been upgraded' in _helm_install_simple.stdout" - when: uyuni_helm_values is not defined diff --git a/roles/uyuni/tasks/main.yml b/roles/uyuni/tasks/main.yml index 54c0c04..9ad1477 100644 --- a/roles/uyuni/tasks/main.yml +++ b/roles/uyuni/tasks/main.yml @@ -69,34 +69,5 @@ delay: 10 when: uyuni_create_certificates | bool -- name: Helm | Install or upgrade Uyuni from OCI registry - ansible.builtin.command: > - helm upgrade --install uyuni-server oci://registry.opensuse.org/uyuni/server-helm - --namespace {{ uyuni_namespace }} - --create-namespace - --version {{ uyuni_chart_version }} - --set {{ item.key }}={{ item.value }} - --timeout 20m0s - --wait - loop: "{{ uyuni_helm_values | dict2items }}" - environment: - KUBECONFIG: "{{ uyuni_kubeconfig }}" - PATH: "/usr/local/bin:/usr/bin:/bin" - register: _helm_install - changed_when: "'STATUS: deployed' in _helm_install.stdout or 'has been upgraded' in _helm_install.stdout" - when: uyuni_helm_values is defined - -- name: Helm | Install or upgrade Uyuni from OCI registry (no values) - ansible.builtin.command: > - helm upgrade --install uyuni-server oci://registry.opensuse.org/uyuni/server-helm - --namespace {{ uyuni_namespace }} - --create-namespace - --version {{ uyuni_chart_version }} - --timeout 20m0s - --wait - environment: - KUBECONFIG: "{{ uyuni_kubeconfig }}" - PATH: "/usr/local/bin:/usr/bin:/bin" - register: _helm_install_simple - changed_when: "'STATUS: deployed' in _helm_install_simple.stdout or 'has been upgraded' in _helm_install_simple.stdout" - when: uyuni_helm_values is not defined +- name: Include Helm installation + ansible.builtin.include_tasks: helm.yml