mirror of
https://github.com/khuedoan/homelab.git
synced 2024-12-22 20:44:33 +07:00
37 lines
1.1 KiB
YAML
37 lines
1.1 KiB
YAML
|
- name: Bootstrapping the cluster
|
||
|
hosts: localhost
|
||
|
tasks:
|
||
|
- name: Create ArgoCD namespace
|
||
|
kubernetes.core.k8s:
|
||
|
api_version: v1
|
||
|
kind: Namespace
|
||
|
name: argocd
|
||
|
state: present
|
||
|
|
||
|
- name: Check if this is the first installation
|
||
|
kubernetes.core.k8s_info:
|
||
|
kind: Pod
|
||
|
label_selectors:
|
||
|
- app.kubernetes.io/instance=gitea
|
||
|
field_selectors:
|
||
|
- status.phase=Running
|
||
|
register: first_install
|
||
|
|
||
|
- name: Render ArgoCD manifests from Helm chart
|
||
|
kubernetes.core.helm_template:
|
||
|
chart_ref: ./argocd
|
||
|
include_crds: true
|
||
|
release_name: argocd
|
||
|
release_namespace: argocd
|
||
|
dependency_update: true
|
||
|
values_files:
|
||
|
- "argocd/{{ (first_install.resources | length == 0) | ternary('values-seed.yaml', 'values.yaml') }}"
|
||
|
register: argocd_manifests
|
||
|
|
||
|
- name: Apply ArgoCD manifests
|
||
|
kubernetes.core.k8s:
|
||
|
resource_definition: "{{ argocd_manifests.stdout }}"
|
||
|
apply: true
|
||
|
server_side_apply:
|
||
|
field_manager: argocd-controller
|