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 669d040..34aae1b 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 @@ -109,10 +109,16 @@ loop: - organization: mc body: - name: GitOps.Config + name: GitOps.HelmCharts # auto_init: true # default_branch: main - description: GitOps manifests + description: Helm charts + - organization: mc + body: + name: GitOps.ClusterAPI + # auto_init: true + # default_branch: main + description: ClusterAPI manifests - organization: wl body: name: GitOps.Config diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/clusterapi.yml b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/clusterapi.yml index a6bea8f..10429ef 100644 --- a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/clusterapi.yml +++ b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/clusterapi.yml @@ -154,6 +154,19 @@ -f {{ capi_clustermanifest.path }} \ -o /opt/metacluster/cluster-api/new-cluster +- 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 manifests" + git remote add origin https://git.{{ vapp['metacluster.fqdn'] }}/mc/GitOps.ClusterAPI.git + git push https://administrator:{{ vapp['metacluster.password'] | urlencode }}@git.{{ vapp['metacluster.fqdn'] }}/mc/GitOps.ClusterAPI.git --all + chdir: /opt/metacluster/cluster-api/new-cluster + - name: Cleanup tempfile ansible.builtin.file: path: "{{ capi_clustermanifest.path }}" diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/templates/applicationset.j2 b/ansible/roles/firstboot/files/ansible_payload/bootstrap/templates/applicationset.j2 index 63303a8..0f8bf57 100644 --- a/ansible/roles/firstboot/files/ansible_payload/bootstrap/templates/applicationset.j2 +++ b/ansible/roles/firstboot/files/ansible_payload/bootstrap/templates/applicationset.j2 @@ -6,7 +6,7 @@ metadata: spec: generators: - git: - repoURL: ssh://git@gitea-ssh.gitea.svc.cluster.local/mc/GitOps.Config.git + repoURL: https://git.{{ vapp['metacluster.fqdn'] }}/wl/GitOps.Config.git revision: HEAD directories: - path: metacluster-applicationset/* @@ -20,7 +20,7 @@ spec: prune: true selfHeal: true source: - repoURL: ssh://git@gitea-ssh.gitea.svc.cluster.local/mc/GitOps.Config.git + repoURL: https://git.{{ vapp['metacluster.fqdn'] }}/wl/GitOps.Config.git targetRevision: HEAD path: {% raw %}'{{ path }}'{% endraw +%} destination: