Install and Manage Argo CD with Ansible
Categories:
4 minute read , 7 minute provision
Projects:
c2platform/ansible
,
c2platform.core
,
c2platform.mw
This guide illustrates the installation of Argo CD within the C2 Platform development environment using C2 Platform’s Ansible collections. This automated process uses Vagrant , the Vagrant Ansible provisioner and, of course, Ansible.
Here’s an overview of the process orchestrated by Vagrant using Ansible as a provisioner:
- Kubernetes Cluster Setup: Ansible configures a Kubernetes instance
with the C2’s MicroK8s Ansible role
c2platform.mw.microk8s
. - Kubernetes Configuration: Ansible further configures the Kubernetes
cluster using the C2’s Kubernetes role
c2platform.mw.kubernetes
. - Argo CD Installation: Argo CD is installed using the same Kubernetes role.
- Argo Rollout Installation and Demo App Deployment: Argo Rollouts and the demo application are deployed using the same Kubernetes role.
After completing these steps, you can access the Argo CD UI at:
https://argocd.c2platform.org
Prerequisites
Ensure the C2 Platform’s development environment is set up and the reverse and
forward proxy c2d-rproxy1
is running.
c2
unset PLAY # ensure all plays run
vagrant up c2d-rproxy1
For more information, refer to Setup a Development Environment on Ubuntu 22 .
Setup
Run the following command to create a Kubernetes instance and deploy Argo CD. The entire process takes about 7 minutes.
vagrant up c2d-argocd
The console output should be similar to
provision.log
.
Login using Argo CD CLI
SSH into the Vagrant
LXD
container c2d-argocd
using the command:
vagrant ssh c2d-argocd
Inside c2d-argocd
, the KUBECONFIG
1 environment variable is already
configured, allowing the Argo CD CLI and Kubernetes tools like kubectl
to
connect to the cluster.
Log in to Argo CD with these commands:
export ARGOCD_ADMIN_INITIAL_PW="$(argocd admin initial-password -n argocd | head -1)"
argocd login argocd.c2platform.org --username admin --password $ARGOCD_ADMIN_INITIAL_PW
Show Command Output
root@c2d-argocd:~# argocd login argocd.c2platform.org --username admin --password $ARGOCD_ADMIN_INITIAL_PW
'admin:login' logged in successfully
Context 'argocd.c2platform.org' updated
root@c2d-argocd:~#
Update admin password
For convenience, update to a simpler password, such as supersecret
, ensuring it meets password requirements. Run the command:
argocd account update-password --account admin --current-password $ARGOCD_ADMIN_INITIAL_PW --new-password supersecret
Login to Argo CD UI
Launch Firefox using the configured Firefox profile (see
Configure a FireFox Profile
).
Navigate to
https://argocd.c2platform.org
,
login as admin
with the password supersecret
. You should see the following:

Vagrant snapshot
After setup, create a snapshot (v0
) for future reference:
vagrant snapshot save c2d-argocd v0
To restore, use:
vagrant snapshot restore c2d-argocd v0
Run vagrant --help
for more information on Vagrant CLI commands.
Review
To gain an understanding of how this results was reached, let’s review the
Ansible inventory project
c2platform/ansible
,
To gain this understanding we have to look at the Ansible play that is involved,
which is plays/mw/mk8s.yml
and the Ansible configuration, which is stored in
the group_vars/argocd
folder.
Ansible Play
The Ansible play that is involved with the gsd-argocd
node is
plays/mw/mk8s.yml
. There we can establish that three Ansible roles are involved:
To gain a better understanding of
Group Vars | Ansible Variable | Purpose |
---|---|---|
group_vars/argocd/tools.yml | linux_resources | Make Kubernetes CLI tools fzf , kubectx , kubens , kube-ps1 , kube-prompt available. |
group_vars/argocd/argocd.yml | kubernetes_resources | Create namespace argocd , TLS secrets, deploy Argo CD, patch argocd-server with LoadBalancerIP . |
group_vars/argocd/argocd_cli.yml | kubernetes_linux_resources | Download and install Argo CD CLI and configure kubectl autocompletion |
Installation
Argo Rollouts installation involves two steps
- Controller Installation: Create namespace
argo-rollouts
and then applyinstall.yaml
. See group_vars/argocd/argo_rollouts.yml . - Argo Rollouts Kubectl Plugin: Optional Download an installation of including optional bash completion.
Then a Argo Rollouts demo is installed, which consist of creating a Rollout
and a Service
resource.
Group Vars | Ansible Variable | Purpose |
---|---|---|
group_vars/argocd/argo_rollouts.yml | kubernetes_linux_resources | Download and install Argo Rollouts Kubectl plugin and configure autocompletion for kubectl-argo-rollouts |
Next Steps
With Argo CD installed, proceed to deploy the guestbook demo application, that will help you get a better understanding on how Argo CD works.
Additional Information
- Argo CD - Declarative GitOps CD for Kubernetes
- Argo Rollouts - Kubernetes Progressive Delivery Controller
- Annotated Ingress resource - cert-manager Documentation
- Welcome - Ingress-Nginx Controller
The file
/etc/profile.d/mk8s.sh
contains a line withKUBECONFIG
as shown below, giving access to the Kubernetes cluster insidec2d-argocd
:↩︎export KUBECONFIG=/var/snap/microk8s/current/credentials/client.config
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.