OpenSibleOpenSible Stack Hub
← All blueprints

Argo CD via Helm

OSS

Install Argo CD on any cluster using the official argo-helm chart.

by opensible· ⬇ 0 installs· Kubernetes· v1.0.0· template k8s-manifests

Use in the OpenSible console

Open Infrastructure → Stack Hub Blueprints, switch the source to Cloud hub, then pick Argo CD via Helm and press Use.

Requirements

  • helm >=3.12
  • ansible >=2.14

Default variables

defaults.json
{
  "action": "helm",
  "helm_wait": true,
  "namespace": "argocd",
  "helm_chart": "argo/argo-cd",
  "kubeconfig": "",
  "helm_values": "global:\n  domain: argocd.example.com\nserver:\n  service:\n    type: ClusterIP\n  ingress:\n    enabled: false\nconfigs:\n  params:\n    server.insecure: \"true\"\ndex:\n  enabled: false\nnotifications:\n  enabled: false\n",
  "helm_release": "argocd",
  "helm_version": "",
  "helm_repo_url": "https://argoproj.github.io/argo-helm",
  "helm_repo_name": "argo",
  "create_namespace": true
}

vars.example.yml

vars.example.yml
---
# Helm release
release: argocd
namespace: argocd
create_namespace: true

# Chart source
chart: argo/argo-cd
repo_name: argo
repo_url: https://argoproj.github.io/argo-helm
chart_version: ""          # empty = latest stable

# Cluster access on the Ansible target host
kubeconfig: /etc/rancher/k3s/k3s.yaml   # or /root/.kube/config for kubeadm
kube_context: ""

# Wait for all Argo CD components to become Ready
wait: true

# Inline values.yaml — override server.ingress, sso, HA, etc.
values: |
  global:
    domain: argocd.example.com
  server:
    service:
      type: ClusterIP
    ingress:
      enabled: false
  configs:
    params:
      server.insecure: "true"
  dex:
    enabled: false
  notifications:
    enabled: false

Playbook (playbook.yml)

playbook.yml
---
# Rendered from template: Argo CD via Helm
- name: Install Argo CD via Helm
  hosts: all
  become: true
  gather_facts: false
  vars:
    release: "{{ release | default('argocd') }}"
    namespace: "{{ namespace | default('argocd') }}"
    chart: "{{ chart | default('argo/argo-cd') }}"
    repo_name: "{{ repo_name | default('argo') }}"
    repo_url: "{{ repo_url | default('https://argoproj.github.io/argo-helm') }}"
    chart_version: "{{ chart_version | default('') }}"
    kubeconfig: "{{ kubeconfig | default('/etc/rancher/k3s/k3s.yaml') }}"
    kube_context: "{{ kube_context | default('') }}"
    create_namespace: "{{ create_namespace | default(true) }}"
    wait_for_ready: "{{ wait | default(true) }}"
    values_content: "{{ values | default('') }}"
  tasks:
    - name: Ensure helm is present
      ansible.builtin.command: helm version --short
      register: helm_check
      changed_when: false
      failed_when: helm_check.rc != 0

    - name: Add Argo Helm repo
      ansible.builtin.command: "helm repo add {{ repo_name }} {{ repo_url }}"
      environment:
        KUBECONFIG: "{{ kubeconfig }}"
      register: repo_add
      changed_when: "'has been added' in repo_add.stdout"
      failed_when: repo_add.rc != 0 and 'already exists' not in repo_add.stderr

    - name: Refresh Helm repos
      ansible.builtin.command: helm repo update
      environment:
        KUBECONFIG: "{{ kubeconfig }}"
      changed_when: false

    - name: Write inline values.yaml (if provided)
      ansible.builtin.copy:
        dest: "/tmp/opensible-{{ release }}-values.yaml"
        mode: "0600"
        content: "{{ values_content }}"
      when: values_content | length > 0

    - name: helm upgrade --install {{ release }}
      ansible.builtin.shell: |
        set -e
        VALS=""
        if [ -s "/tmp/opensible-{{ release }}-values.yaml" ]; then
          VALS="-f /tmp/opensible-{{ release }}-values.yaml"
        fi
        VER=""
        if [ -n "{{ chart_version }}" ]; then
          VER="--version {{ chart_version }}"
        fi
        CTX=""
        if [ -n "{{ kube_context }}" ]; then
          CTX="--kube-context {{ kube_context }}"
        fi
        CN=""
        if [ "{{ create_namespace | bool }}" = "True" ]; then
          CN="--create-namespace"
        fi
        WAIT=""
        if [ "{{ wait_for_ready | bool }}" = "True" ]; then
          WAIT="--wait --timeout 15m"
        fi
        helm upgrade --install {{ release }} {{ chart }} \
          -n {{ namespace }} $CN $VER $VALS $WAIT $CTX
      environment:
        KUBECONFIG: "{{ kubeconfig }}"
      args:
        executable: /bin/bash

    - name: Show Argo CD pods
      ansible.builtin.command: "kubectl -n {{ namespace }} get pods"
      environment:
        KUBECONFIG: "{{ kubeconfig }}"
      register: argocd_pods
      changed_when: false

    - name: Print pod status
      ansible.builtin.debug:
        var: argocd_pods.stdout_lines

    - name: Retrieve Argo CD initial admin password
      ansible.builtin.shell: |
        set -o pipefail
        kubectl -n {{ namespace }} get secret argocd-initial-admin-secret \
          -o jsonpath='{.data.password}' | base64 -d
        echo
      environment:
        KUBECONFIG: "{{ kubeconfig }}"
      register: argocd_admin_pass
      changed_when: false
      failed_when: false

    - name: Print admin login details
      ansible.builtin.debug:
        msg:
          - "Argo CD UI: kubectl -n {{ namespace }} port-forward svc/{{ release }}-argocd-server 8080:443  ->  https://localhost:8080"
          - "Username: admin"
          - "Password: {{ argocd_admin_pass.stdout | default('<not found — see argocd-initial-admin-secret in namespace ' ~ namespace) }}"
      when: argocd_admin_pass is defined

Versions (1)

  • v1.0.0playbook.yml