From 20ce62fb6d4f3b5648b0a8a509ecde303a9a5917 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Tue, 12 Jul 2022 14:20:43 +0200 Subject: [PATCH] Enable offlineMode for gitea;Cleanup comments;Populate /etc/hosts --- .../roles/metacluster/tasks/main.yml | 70 ++++++++----------- ansible/vars/metacluster.yml | 2 + 2 files changed, 32 insertions(+), 40 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 a88be67..3b35de6 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 @@ -55,6 +55,17 @@ chdir: /opt/metacluster/container-images loop: "{{ imagetarballs.files }}" +- name: Create component entries in /etc/hosts + ansible.builtin.lineinfile: + path: /etc/hosts + line: "{{ vapp['guestinfo.ipaddress'] }} {{ item + '.' + vapp['metacluster.fqdn'] }}" + state: present + loop: + - git + - gitops + - registry + - storage + - name: Install longhorn chart kubernetes.core.helm: name: longhorn @@ -64,14 +75,6 @@ wait: yes kubeconfig: "{{ kubeconfig.path }}" 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: @@ -82,14 +85,6 @@ wait: yes kubeconfig: "{{ kubeconfig.path }}" 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: @@ -127,20 +122,25 @@ wait: yes kubeconfig: "{{ kubeconfig.path }}" 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 + +- block: + + - name: Ensure gitea API availability + ansible.utils.cli_parse: + # Available from Gitea 1.17.x + # command: curl -k https://git.{{ vapp['metacluster.fqdn'] }}/api/healtz + command: curl -k https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/version + parser: + name: ansible.utils.json + set_fact: api_readycheck + ignore_errors: + until: api_readycheck.version is defined + retries: 3 + delay: 30 + + - name: Generate gitea API token + ansible.builtin.uri: + url: https://git.{{ vapp['metacluster.fqdn']}} - name: Install argo-cd chart kubernetes.core.helm: @@ -151,16 +151,6 @@ wait: yes kubeconfig: "{{ kubeconfig.path }}" 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/vars/metacluster.yml b/ansible/vars/metacluster.yml index 2532e72..2b13468 100644 --- a/ansible/vars/metacluster.yml +++ b/ansible/vars/metacluster.yml @@ -51,6 +51,8 @@ components: chart: gitea-charts/gitea parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | sed '/:/!s/$/:latest/' chart_values: !unsafe | + config: + offlineMode: true gitea: admin: username: administrator