From d6c885240a12cf8612b9641e65cebff7c5057de4 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sun, 10 Jul 2022 09:54:41 +0200 Subject: [PATCH] Remove debugging;Revert default quotes;Test dynamic helm chart values --- .../roles/metacluster/tasks/main.yml | 90 +++++++++---------- .../roles/metacluster/tasks/components.yml | 5 +- ansible/vars/metacluster.yml | 14 ++- 3 files changed, 59 insertions(+), 50 deletions(-) diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml index e1288e3..44155c4 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml @@ -63,15 +63,15 @@ create_namespace: yes wait: yes kubeconfig: "{{ kubeconfig.path }}" - values: - defaultSettings: - defaultDataPath: /mnt/blockstorage - defaultReplicaCount: 1 - ingress: - enabled: true - host: storage.{{ vapp['metacluster.fqdn'] }} - persistence: - defaultClassReplicaCount: 1 + values: "{{ components.longhorn.chart_values }}" + # defaultSettings: + # defaultDataPath: /mnt/blockstorage + # defaultReplicaCount: 1 + # ingress: + # enabled: true + # host: storage.{{ vapp['metacluster.fqdn'] }} + # persistence: + # defaultClassReplicaCount: 1 - name: Install harbor chart kubernetes.core.helm: @@ -81,15 +81,15 @@ create_namespace: yes wait: yes kubeconfig: "{{ kubeconfig.path }}" - values: - expose: - ingress: - hosts: - core: registry.{{ vapp['metacluster.fqdn'] }} - externalURL: https://registry.{{ vapp['metacluster.fqdn'] }} - harborAdminPassword: "{{ vapp['guestinfo.rootpw'] }}" - notary: - enabled: false + values: "{{ components.harbor.chart_values }}" + # expose: + # ingress: + # hosts: + # core: registry.{{ vapp['metacluster.fqdn'] }} + # externalURL: https://registry.{{ vapp['metacluster.fqdn'] }} + # harborAdminPassword: "{{ vapp['guestinfo.rootpw'] }}" + # notary: + # enabled: false - name: Push images to registry ansible.builtin.shell: @@ -126,41 +126,41 @@ create_namespace: yes wait: yes kubeconfig: "{{ kubeconfig.path }}" - values: - gitea: - admin: - username: administrator - password: "{{ vapp['guestinfo.rootpw'] }}" - email: admin@{{ vapp['metacluster.fqdn'] }} - image: - pullPolicy: IfNotPresent - ingress: - enabled: true - hosts: - - host: git.{{ vapp['metacluster.fqdn'] }} - paths: - - path: / - pathType: Prefix + values: "{{ components.gitea.chart_values }}" + # gitea: + # admin: + # username: administrator + # password: "{{ vapp['guestinfo.rootpw'] }}" + # email: admin@{{ vapp['metacluster.fqdn'] }} + # image: + # pullPolicy: IfNotPresent + # ingress: + # enabled: true + # hosts: + # - host: git.{{ vapp['metacluster.fqdn'] }} + # paths: + # - path: / + # pathType: Prefix - name: Install argo-cd chart kubernetes.core.helm: name: argo-cd - chart_ref: /opt/metacluster/helm-charts/argo-cd + chart_ref: /opt/metacluster/helm-charts/argocd release_namespace: argo-cd create_namespace: yes wait: yes kubeconfig: "{{ kubeconfig.path }}" - values: - server: - extraArgs: - - --insecure - ingress: - enabled: true - hosts: - - gitops.{{ vapp['metacluster.fqdn'] }} - configs: - secret: - argocdServerAdminPassword: "{{ vapp['guestinfo.rootpw'] | password_hash('bcrypt') }}" + values: "{{ components.argocd.chart_values }}" + # server: + # extraArgs: + # - --insecure + # ingress: + # enabled: true + # hosts: + # - gitops.{{ vapp['metacluster.fqdn'] }} + # configs: + # secret: + # argocdServerAdminPassword: "{{ vapp['guestinfo.rootpw'] | password_hash('bcrypt') }}" - name: Cleanup tempfile ansible.builtin.file: diff --git a/ansible/roles/metacluster/tasks/components.yml b/ansible/roles/metacluster/tasks/components.yml index b59f10d..43f2191 100644 --- a/ansible/roles/metacluster/tasks/components.yml +++ b/ansible/roles/metacluster/tasks/components.yml @@ -31,13 +31,10 @@ loop_control: label: "{{ item.key }}" - - ansible.builtin.debug: - msg: "{{ chart_values | to_nice_yaml(default_style='\"', indent=2, width=4096) }}" - - name: Write dict to vars_file ansible.builtin.blockinfile: path: /opt/firstboot/ansible/vars/metacluster.yml - block: "{{ { 'components': chart_values } | to_nice_yaml(default_style='\"', indent=2, width=4096) }}" + block: "{{ { 'components': chart_values } | to_nice_yaml(indent=2, width=4096) }}" - name: Parse helm charts for container images ansible.builtin.shell: diff --git a/ansible/vars/metacluster.yml b/ansible/vars/metacluster.yml index 43eefac..c168ca0 100644 --- a/ansible/vars/metacluster.yml +++ b/ansible/vars/metacluster.yml @@ -66,11 +66,23 @@ components: - path: / pathType: Prefix - argo-cd: + argocd: helm: version: 4.9.7 # (= ArgoCD v2.4.2) chart: argo/argo-cd parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | awk '!/ /' + chart_values: + server: + extraArgs: + - --insecure + ingress: + enabled: true + hosts: + - gitops.[% vapp['metacluster.fqdn'] %] + configs: + secret: + argocdServerAdminPassword: "[% vapp['guestinfo.rootpw'] | password_hash('bcrypt') %]" + dependencies: