diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/git.yml b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/git.yml index fb8d031..fd59f48 100644 --- a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/git.yml +++ b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/git.yml @@ -122,8 +122,8 @@ - organization: wl body: name: GitOps.Config - # auto_init: true - # default_branch: main + auto_init: true + default_branch: main description: GitOps manifests loop_control: label: "{{ item.organization ~ '/' ~ item.body.name }}" diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/gitops.yml b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/gitops.yml index 56eca1b..d66e17b 100644 --- a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/gitops.yml +++ b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/gitops.yml @@ -5,6 +5,12 @@ recurse: false register: helm_charts +- name: Pull existing repository + ansible.builtin.git: + repo: https://git.{{ vapp['metacluster.fqdn'] }}/wl/GitOps.Config.git + dest: /opt/workloadcluster/git-repositories/gitops + version: main + - name: Create hard-links to populate new git-repository ansible.builtin.shell: cmd: >- @@ -41,18 +47,32 @@ loop_control: label: "{{ item.key }}" -- name: Initialize/Push git repository - ansible.builtin.shell: - cmd: | - git init - git config --global user.email "administrator@{{ vapp['metacluster.fqdn'] }}" - git config --global user.name "administrator" - git checkout -b main - git add . - git commit -m "Upload charts" - git remote add origin https://git.{{ vapp['metacluster.fqdn'] }}/wl/GitOps.Config.git - git push https://administrator:{{ vapp['metacluster.password'] | urlencode }}@git.{{ vapp['metacluster.fqdn'] }}/wl/GitOps.Config.git --all - chdir: /opt/workloadcluster/git-repositories/gitops +- name: Push git repository + lvrfrc87.git_acp.git_acp: + path: /opt/workloadcluster/git-repositories/gitops + branch: main + comment: "Upload charts" + add: + - . + url: https://administrator:{{ vapp['metacluster.password'] | urlencode }}@git.{{ vapp['metacluster.fqdn'] }}/wl/GitOps.Config.git + environment: + GIT_AUTHOR_NAME: administrator + GIT_AUTHOR_EMAIL: administrator@{{ vapp['metacluster.fqdn'] }} + GIT_COMMITTER_NAME: administrator + GIT_COMMITTER_EMAIL: administrator@{{ vapp['metacluster.fqdn'] }} + +# - name: Initialize/Push git repository +# ansible.builtin.shell: +# cmd: | +# git init +# git config --global user.email "administrator@{{ vapp['metacluster.fqdn'] }}" +# git config --global user.name "administrator" +# git checkout -b main +# git add . +# git commit -m "Upload charts" +# git remote add origin https://git.{{ vapp['metacluster.fqdn'] }}/wl/GitOps.Config.git +# git push https://administrator:{{ vapp['metacluster.password'] | urlencode }}@git.{{ vapp['metacluster.fqdn'] }}/wl/GitOps.Config.git --all +# chdir: /opt/workloadcluster/git-repositories/gitops - name: Retrieve workload-cluster kubeconfig kubernetes.core.k8s_info: