From 2f976898eb7cb18b7048469957f1c1141b346df7 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Thu, 14 Jul 2022 22:45:35 +0200 Subject: [PATCH] Remove redundant key/value;Add debugging --- .../roles/metacluster/tasks/main.yml | 96 ++++++++++--------- 1 file changed, 51 insertions(+), 45 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 8388d6a..761d86e 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 @@ -164,51 +164,58 @@ method: GET register: gitea_existing_config - - name: Create organization(s) - ansible.builtin.uri: - url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs - method: POST - headers: - Authorization: token {{ gitea_api_token.json.sha1 }} - body: "{{ item }}" - loop: - - full_name: Meta-cluster - description: Meta-cluster configuration items - username: mc - website: https://git.{{ vapp['metacluster.fqdn'] }}/mc - location: '[...]' - visibility: public - - full_name: Workload-cluster - description: Workload-cluster configuration items - username: wl - website: https://git.{{ vapp['metacluster.fqdn'] }}/wl - location: '[...]' - visibility: public - loop_control: - label: "{{ item.full_name }}" + - debug: + var: gitea_existing_config - - name: Create repositories - ansible.builtin.uri: - url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs/{{ item.organization }}/repos - method: POST - headers: - Authorization: token {{ gitea_api_token.json.sha1 }} - body: "{{ item.body }}" - loop: - - organization: mc - body: - name: ArgoCD.Config - auto_init: true - default_branch: main - description: GitOps manifests - - organization: wl - body: - name: Template.ArgoCD.Config - auto_init: true - default_branch: main - description: GitOps manifests - loop_control: - label: "{{ item.organization + '/' + item.body.name }}" + - block: + + - name: Create organization(s) + ansible.builtin.uri: + url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs + method: POST + headers: + Authorization: token {{ gitea_api_token.json.sha1 }} + body: "{{ item }}" + loop: + - full_name: Meta-cluster + description: Meta-cluster configuration items + username: mc + website: https://git.{{ vapp['metacluster.fqdn'] }}/mc + location: '[...]' + visibility: public + - full_name: Workload-cluster + description: Workload-cluster configuration items + username: wl + website: https://git.{{ vapp['metacluster.fqdn'] }}/wl + location: '[...]' + visibility: public + loop_control: + label: "{{ item.full_name }}" + + - name: Create repositories + ansible.builtin.uri: + url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs/{{ item.organization }}/repos + method: POST + headers: + Authorization: token {{ gitea_api_token.json.sha1 }} + body: "{{ item.body }}" + loop: + - organization: mc + body: + name: ArgoCD.Config + auto_init: true + default_branch: main + description: GitOps manifests + - organization: wl + body: + name: Template.ArgoCD.Config + auto_init: true + default_branch: main + description: GitOps manifests + loop_control: + label: "{{ item.organization + '/' + item.body.name }}" + + # when: gitea_existing_config.json.data is undefined module_defaults: ansible.builtin.uri: @@ -245,7 +252,6 @@ method: POST force_basic_auth: yes body: - token: token_init_{{ lookup('password', '/dev/null length=5 chars=ascii_letters,digits') }} username: admin password: "{{ vapp['guestinfo.rootpw'] }}" register: argocd_api_token