From d986d5ab25084f6bc86776b523612b1f951ce5c6 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Tue, 26 Jul 2022 10:08:35 +0200 Subject: [PATCH] Debug existing config map;Fix key;Fix tty mess of typos;Fix git push --- .../roles/metacluster/tasks/main.yml | 8 ++++--- .../ansible_payload/roles/tty/tasks/main.yml | 2 +- .../files/ansible_payload/templates/tty.j2 | 23 ++++++++++--------- 3 files changed, 18 insertions(+), 15 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 f98c3c3..4ec6557 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 @@ -204,6 +204,8 @@ - ansible.builtin.uri: url: "{{ item }}" method: GET + headers: + Authorization: token {{ gitea_api_token.json.sha1 }} register: gitea_existing_config_TST loop: # - https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs @@ -211,7 +213,7 @@ - https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/users/administrator/keys ignore_errors: yes - debug: - var: gitea_existing_config_TST + var: gitea_existing_config_TST.results[].json.data - block: @@ -275,8 +277,8 @@ - name: Rebase/Push source gitops repository ansible.builtin.shell: cmd: | - git remote set-url origin https://git.{{ vapp['metacluster.fqdn']}}/mc/GitOps.Config.git - git config --local --http.sslVerify false + git config --local http.sslVerify false + git remote set-url origin https://administrator:{{ vapp['guestinfo.rootpw'] | urlencode }}@git.{{ vapp['metacluster.fqdn']}}/mc/GitOps.Config.git git push chdir: /opt/metacluster/git-repositories/gitops diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/tty/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/roles/tty/tasks/main.yml index e930528..24a1f4a 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/tty/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/roles/tty/tasks/main.yml @@ -9,7 +9,7 @@ ansible.builtin.template: src: tty.j2 dest: /opt/firstboot/tty.sh - user: root + owner: root group: root mode: 0700 diff --git a/ansible/roles/firstboot/files/ansible_payload/templates/tty.j2 b/ansible/roles/firstboot/files/ansible_payload/templates/tty.j2 index 669e636..f52d38e 100644 --- a/ansible/roles/firstboot/files/ansible_payload/templates/tty.j2 +++ b/ansible/roles/firstboot/files/ansible_payload/templates/tty.j2 @@ -7,33 +7,34 @@ BGRY='\033[1;30m' BBLU='\033[1;34m' BRED='\033[1;91m' BWHI='\033[1;97m' -CBLA='\033[?16;0;30cm' # Hide blinking cursor -DFLT='\033[1;0m' # Reset colour -LCLR='\033[K' # Clear to end of line -PRST='\033[1;92m' # Reset cursor position +CBLA='\033[?16;0;30c' # Hide blinking cursor +DFLT='\033[0m' # Reset colour +LCLR='\033[K' # Clear to end of line +PRST='\033[0;0H' # Reset cursor position COMPONENTS=('ingress' 'storage' 'registry' 'git' 'gitops') FQDN='{{ vapp['metacluster.fqdn'] }}' -IPADDRESS='{{ vapp['guestinfo.ipaddres'] }}' +IPADDRESS='{{ vapp['guestinfo.ipaddress'] }}' +# Waiting to allow boot sequence to finish; crude! +sleep 30 clear > /dev/tty1 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 comp in "${COMPONENTS}"; do - STATUS=$(curl -ks "https://${comp}.${FQDN}" -o /dev/null -w '%{http_code}') + for c in "${COMPONENTS[@]}"; do + STATUS=$(curl -ks "https://${c}.${FQDN}" -o /dev/null -w '%{http_code}') if [[ "${STATUS}" -eq "200" ]]; then - echo -e "\t [${BGRN}+${DFLT}] ${BBLU}https://${comp}.${FQDN}${DFLT}${LCLR}" > /dev/tty1 + echo -e "\t [${BGRN}+${DFLT}] ${BBLU}https://${c}.${FQDN}${DFLT}${LCLR}" > /dev/tty1 else - echo -e "\t [${BRED}-${DFLT}] ${BBLU}https://${comp}.${FQDN}${DFLT}${LCLR}" > /dev/tty1 + echo -e "\t [${BRED}-${DFLT}] ${BBLU}https://${c}.${FQDN}${DFLT}${LCLR}" > /dev/tty1 fi done - echo -e "\n\t${BGRY}Note that your DNS zone ${DFLT}must have ${BGRY} respective records defined, each pointing to:${DFLT}${LCLR}" > /dev/tty1 - echo -e "\t${BGRY} - ${DFLT}${IPADDRESS}${LCLR}" > /dev/tty1 + echo -e "\n\t${BGRY}Note that your DNS zone ${DFLT}must have${BGRY} respective records defined,\n\teach pointing to: ${DFLT}${IPADDRESS}${LCLR}" > /dev/tty1 echo -e "${CBLA}" > /dev/tty1 sleep 1