Files
Max Gautier 88b827e58d argocd: simplify manifests apply
ArgoCD upstream manifests do not include namespace for the objects, so
there is no need to override it, and simply using kubectl flags allow to
set it.

Use the upstream file directly , considerably simplifying the argocd
install.

ansible-lint: the refactor apparently newly exposes the password hash
filter to ansible and this needs passlib, so add it to the pre-commit
dependencies.
2026-09-25 19:45:58 +02:00

30 lines
1015 B
YAML

---
- name: Kubernetes Apps | Install ArgoCD
vars:
ns_object:
apiVersion: v1
kind: Namespace
metadata:
name: "{{ argocd_namespace }}"
labels:
app: argocd
command:
cmd: >
{{ kubectl }} apply -n {{ argocd_namespace }}
--server-side=true --force-conflicts --field-manager=kubespray
-f - -f {{ downloads.argocd_install.dest }}
stdin: "{{ ns_object | to_json }}"
# https://github.com/argoproj/argo-cd/blob/master/docs/faq.md#i-forgot-the-admin-password-how-do-i-reset-it
- name: Kubernetes Apps | Set ArgoCD custom admin password
vars:
password_patch:
stringData:
'admin.password': "{{ argocd_admin_password | password_hash('bcrypt') }}"
'admin.passwordMtime': "{{ now(utc=true, fmt='%Y-%m-%dT%H:%M:%SZ') }}"
command:
cmd: "{{ kubectl }} -n {{ argocd_namespace }} patch secret argocd-secret --patch-file=/dev/stdin"
stdin: "{{ password_patch | to_json }}"
when:
- argocd_admin_password is defined