Interact with argocd API
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
39cc83ac57
commit
81847d3b93
@ -155,14 +155,14 @@
|
|||||||
force_basic_auth: yes
|
force_basic_auth: yes
|
||||||
body:
|
body:
|
||||||
name: token_init_{{ lookup('password', '/dev/null length=5 chars=ascii_letters,digits') }}
|
name: token_init_{{ lookup('password', '/dev/null length=5 chars=ascii_letters,digits') }}
|
||||||
register: api_token
|
register: gitea_api_token
|
||||||
|
|
||||||
- name: Create organization(s)
|
- name: Create organization(s)
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs
|
url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs
|
||||||
method: POST
|
method: POST
|
||||||
headers:
|
headers:
|
||||||
Authorization: token {{ api_token.json.sha1 }}
|
Authorization: token {{ gitea_api_token.json.sha1 }}
|
||||||
body: "{{ item }}"
|
body: "{{ item }}"
|
||||||
loop:
|
loop:
|
||||||
- full_name: Meta-cluster
|
- full_name: Meta-cluster
|
||||||
@ -185,7 +185,7 @@
|
|||||||
url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs/{{ item.organization }}/repos
|
url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs/{{ item.organization }}/repos
|
||||||
method: POST
|
method: POST
|
||||||
headers:
|
headers:
|
||||||
Authorization: token {{ api_token.json.sha1 }}
|
Authorization: token {{ gitea_api_token.json.sha1 }}
|
||||||
body: "{{ item.body }}"
|
body: "{{ item.body }}"
|
||||||
loop:
|
loop:
|
||||||
- organization: mc
|
- organization: mc
|
||||||
@ -209,6 +209,8 @@
|
|||||||
status_code: [200, 201]
|
status_code: [200, 201]
|
||||||
body_format: json
|
body_format: json
|
||||||
|
|
||||||
|
- block:
|
||||||
|
|
||||||
- name: Install argo-cd chart
|
- name: Install argo-cd chart
|
||||||
kubernetes.core.helm:
|
kubernetes.core.helm:
|
||||||
name: argo-cd
|
name: argo-cd
|
||||||
@ -219,6 +221,34 @@
|
|||||||
kubeconfig: "{{ kubeconfig.path }}"
|
kubeconfig: "{{ kubeconfig.path }}"
|
||||||
values: "{{ components.argocd.chart_values }}"
|
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
|
- name: Cleanup tempfile
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ kubeconfig.path }}"
|
path: "{{ kubeconfig.path }}"
|
||||||
|
@ -6,7 +6,7 @@ platform:
|
|||||||
packaged_components:
|
packaged_components:
|
||||||
- name: traefik
|
- name: traefik
|
||||||
namespace: kube-system
|
namespace: kube-system
|
||||||
config: |4
|
config: |2
|
||||||
ports:
|
ports:
|
||||||
ssh:
|
ssh:
|
||||||
port: 8022
|
port: 8022
|
||||||
|
Loading…
Reference in New Issue
Block a user