From 05e0c502179cdb68ecb4e4870932edb5c70eef35 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Wed, 20 Jul 2022 20:50:39 +0200 Subject: [PATCH] Debugging;Housekeeping;Push source gitops repository --- .../roles/metacluster/tasks/main.yml | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 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 9693f4c..514fa34 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 @@ -201,17 +201,20 @@ - name: Retrieve existing gitea configuration ansible.builtin.uri: - # url: "{{ item }}" url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/repos/search method: GET register: gitea_existing_config - # loop: - # # - https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs - # - https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/repos/search - # - https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/user/keys + - ansible.builtin.uri: + url: "{{ item }}" + method: GET + register: gitea_existing_config_TST + loop: + # - https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs + - https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/repos/search + - https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/user/keys - debug: - var: gitea_existing_config + var: gitea_existing_config_TST - block: @@ -225,8 +228,6 @@ key: "{{ gitops_sshkey.public_key }}" read_only: false title: GitOps -# Initial testing - ignore_errors: yes - name: Create organization(s) ansible.builtin.uri: @@ -261,19 +262,27 @@ loop: - organization: mc body: - name: ArgoCD.Config - auto_init: true - default_branch: main + name: GitOps.Config + # auto_init: true + # default_branch: main description: GitOps manifests - organization: wl body: - name: Template.ArgoCD.Config - auto_init: true - default_branch: main + name: Template.GitOps.Config + # auto_init: true + # default_branch: main description: GitOps manifests loop_control: label: "{{ item.organization + '/' + item.body.name }}" + - 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 push + chdir: /opt/metacluster/git-repositories/gitops + when: (gitea_existing_config.json is undefined) or (gitea_existing_config.json.data | length == 0) module_defaults: