Interact with argocd API
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2022-07-14 11:04:35 +02:00
parent 39cc83ac57
commit 81847d3b93
2 changed files with 43 additions and 13 deletions

View File

@ -155,14 +155,14 @@
force_basic_auth: yes
body:
name: token_init_{{ lookup('password', '/dev/null length=5 chars=ascii_letters,digits') }}
register: api_token
register: gitea_api_token
- name: Create organization(s)
ansible.builtin.uri:
url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs
method: POST
headers:
Authorization: token {{ api_token.json.sha1 }}
Authorization: token {{ gitea_api_token.json.sha1 }}
body: "{{ item }}"
loop:
- full_name: Meta-cluster
@ -185,7 +185,7 @@
url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs/{{ item.organization }}/repos
method: POST
headers:
Authorization: token {{ api_token.json.sha1 }}
Authorization: token {{ gitea_api_token.json.sha1 }}
body: "{{ item.body }}"
loop:
- organization: mc
@ -209,15 +209,45 @@
status_code: [200, 201]
body_format: json
- name: Install argo-cd chart
kubernetes.core.helm:
name: argo-cd
chart_ref: /opt/metacluster/helm-charts/argo-cd
release_namespace: argo-cd
create_namespace: yes
wait: yes
kubeconfig: "{{ kubeconfig.path }}"
values: "{{ components.argocd.chart_values }}"
- block:
- name: Install argo-cd chart
kubernetes.core.helm:
name: argo-cd
chart_ref: /opt/metacluster/helm-charts/argo-cd
release_namespace: argo-cd
create_namespace: yes
wait: yes
kubeconfig: "{{ kubeconfig.path }}"
values: "{{ components.argocd.chart_values }}"
- name: Ensure argo-cd API availability
ansible.utils.cli_parse:
command: curl -k https://gitops.{{ vapp['metacluster.fqdn'] }}/api/version
parser:
name: ansible.utils.json
set_fact: api_readycheck
ignore_errors:
until: api_readycheck.Version is defined
retries: 3
delay: 30
- name: Generate argo-cd API token
ansible.builtin.uri:
url: https://gitops.{{ vapp['metacluster.fqdn'] }}/api/v1/account/admin/token
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
module_defaults:
ansible.builtin.uri:
validate_certs: no
status_code: [200, 201]
body_format: json
- name: Cleanup tempfile
ansible.builtin.file:

View File

@ -6,7 +6,7 @@ platform:
packaged_components:
- name: traefik
namespace: kube-system
config: |4
config: |2
ports:
ssh:
port: 8022