diff --git a/ansible/roles/firstboot/files/ansible_payload/common/roles/tty/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/common/roles/tty/tasks/main.yml index 81cd533..9bf2ec9 100644 --- a/ansible/roles/firstboot/files/ansible_payload/common/roles/tty/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/common/roles/tty/tasks/main.yml @@ -19,6 +19,25 @@ executable: /opt/firstboot/tty.sh workingdir: /tmp/ metacluster: + components: + - name: ArgoCD + url: https://gitops.${FQDN} + healthcheck: https://gitops.${FQDN} + - name: Gitea + url: https://git.${FQDN} + healthcheck: https://git.${FQDN} + - name: Harbor + url: https://registry.${FQDN} + healthcheck: https://registry.${FQDN} + - name: Longhorn + url: https://storage.${FQDN} + healthcheck: https://storage.${FQDN} + - name: StepCA + url: '' + healthcheck: https://ca.${FQDN}/health + - name: Traefik + url: https://ingress.${FQDN} + healthcheck: https://ingress.${FQDN} fqdn: "{{ vapp['metacluster.fqdn'] }}" vip: "{{ vapp['metacluster.vip'] }}" loop: diff --git a/ansible/roles/firstboot/files/ansible_payload/common/templates/tty.j2 b/ansible/roles/firstboot/files/ansible_payload/common/templates/tty.j2 index d9f1c49..8eb0e83 100644 --- a/ansible/roles/firstboot/files/ansible_payload/common/templates/tty.j2 +++ b/ansible/roles/firstboot/files/ansible_payload/common/templates/tty.j2 @@ -12,11 +12,14 @@ DFLT='\033[0m' # Reset colour LCLR='\033[K' # Clear to end of line PRST='\033[0;0H' # Reset cursor position -# COMPONENTS=('ca' 'ingress' 'storage' 'registry' 'git' 'gitops') -COMPONENTS=('storage' 'registry' 'git' 'gitops') FQDN='{{ _template.metacluster.fqdn }}' IPADDRESS='{{ _template.metacluster.vip }}' +declare -A COMPONENTS +{% for component in _template.metacluster.components %} +COMPONENTS["{{ component.name }}\t({{ component.url }})"]="{{ component.healthcheck }}" +{% endfor %} + I=0 while /bin/true; do @@ -30,13 +33,13 @@ while /bin/true; do echo -e "${PRST}" > /dev/tty1 echo -e "\n\n\t${DFLT}To manage this appliance, please connect to one of the following:${LCLR}\n" > /dev/tty1 - for c in "${COMPONENTS[@]}"; do - STATUS=$(curl -ks "https://${c}.${FQDN}" -o /dev/null -w '%{http_code}') + for c in "${!COMPONENTS[@]}"; do + STATUS=$(curl -kLs "${COMPONENTS[${c}]}" -o /dev/null -w '%{http_code}') if [[ "${STATUS}" -eq "200" ]]; then - echo -e "\t [${BGRN}+${DFLT}] ${BBLU}https://${c}.${FQDN}${DFLT}${LCLR}" > /dev/tty1 + echo -e "\t [${BGRN}+${DFLT}] ${BBLU}${c}${DFLT}${LCLR}" > /dev/tty1 else - echo -e "\t [${BRED}-${DFLT}] ${BBLU}https://${c}.${FQDN}${DFLT}${LCLR}" > /dev/tty1 + echo -e "\t [${BRED}-${DFLT}] ${BBLU}${c}${DFLT}${LCLR}" > /dev/tty1 fi done