Debugging;Housekeeping;Push source gitops repository
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2022-07-20 20:50:39 +02:00
parent 261e91ee2e
commit 05e0c50217

View File

@ -201,17 +201,20 @@
- name: Retrieve existing gitea configuration - name: Retrieve existing gitea configuration
ansible.builtin.uri: ansible.builtin.uri:
# url: "{{ item }}"
url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/repos/search url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/repos/search
method: GET method: GET
register: gitea_existing_config 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: - debug:
var: gitea_existing_config var: gitea_existing_config_TST
- block: - block:
@ -225,8 +228,6 @@
key: "{{ gitops_sshkey.public_key }}" key: "{{ gitops_sshkey.public_key }}"
read_only: false read_only: false
title: GitOps title: GitOps
# Initial testing
ignore_errors: yes
- name: Create organization(s) - name: Create organization(s)
ansible.builtin.uri: ansible.builtin.uri:
@ -261,19 +262,27 @@
loop: loop:
- organization: mc - organization: mc
body: body:
name: ArgoCD.Config name: GitOps.Config
auto_init: true # auto_init: true
default_branch: main # default_branch: main
description: GitOps manifests description: GitOps manifests
- organization: wl - organization: wl
body: body:
name: Template.ArgoCD.Config name: Template.GitOps.Config
auto_init: true # auto_init: true
default_branch: main # default_branch: main
description: GitOps manifests description: GitOps manifests
loop_control: loop_control:
label: "{{ item.organization + '/' + item.body.name }}" 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) when: (gitea_existing_config.json is undefined) or (gitea_existing_config.json.data | length == 0)
module_defaults: module_defaults: