{"id":21009929,"url":"https://github.com/39school/ansible_project_homelab_v2","last_synced_at":"2025-05-15T02:33:43.984Z","repository":{"id":107715982,"uuid":"590479521","full_name":"x86-39/ansible_project_homelab_v2","owner":"x86-39","description":"Ansible project to deploy Libvirt, Wireguard, K3S, ArgoCD and SOPS for ArgoCD","archived":false,"fork":false,"pushed_at":"2023-03-21T19:57:51.000Z","size":20,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-08T10:54:50.026Z","etag":null,"topics":["ansible","ansible-project","argocd","argocd-ksops","k3s","sops","wireguard"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/x86-39.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-18T14:11:32.000Z","updated_at":"2024-09-25T17:53:24.000Z","dependencies_parsed_at":"2023-06-08T20:15:33.262Z","dependency_job_id":null,"html_url":"https://github.com/x86-39/ansible_project_homelab_v2","commit_stats":null,"previous_names":["diademiemi/ansible_project_homelab_v2","x86-39/ansible_project_homelab_v2"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x86-39%2Fansible_project_homelab_v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x86-39%2Fansible_project_homelab_v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x86-39%2Fansible_project_homelab_v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x86-39%2Fansible_project_homelab_v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/x86-39","download_url":"https://codeload.github.com/x86-39/ansible_project_homelab_v2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225324151,"owners_count":17456483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-project","argocd","argocd-ksops","k3s","sops","wireguard"],"created_at":"2024-11-19T09:18:33.502Z","updated_at":"2025-05-15T02:33:38.495Z","avatar_url":"https://github.com/x86-39.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ansible project for my homelab setup.\n\nThis repository is part of my homelab_v2 setup, please check the following repository for more information: https://github.com/diademiemi/homelab_v2  \n\nThis project deploys Libvirt on the dedicated machines and installs K3S on the virtual machines.  \n\nIt includes tasks to deploy ArgoCD and configure it with KSOPS to use age secret encryption. The playbook `playbooks/04-patch-argocd-ksops.yml` automates the procedure to patch ArgoCD to use KSOPS for secret decryption.  \n\n## [Project Structure](#project-structure)\n\nFile/Directory | Purpose\n--- | ---\n`inventory/` | Ansible inventories\n`inventory/main/hosts.yml` | Ansible inventory file for my hosts\n`playbooks/` | Ansible playbooks\n`roles/` | Ansible roles\n`ansible.cfg` | Ansible configuration file\n`Vagrantfile` | Vagrant virtual machines setup file\n\n### [Ansible](#ansible)\nFirst, you should install the roles required for the playbooks.  \n\n```bash\nansible-galaxy install -r roles/requirements.yml\n```\n\nWe are assuming the Vagrant inventory is used. Please replace the `inventory/vagrant`  with the inventory you are using.  \n\nInstall libvirt on the dedicated machines with:  \n```bash\nansible-playbook -i inventory/vagrant playbooks/01-libvirt.yml\n```\n\nContinue to the Terraform project to provision the virtual machines: https://github.com/diademiemi/terraform_homelab_v2  \n\nOnce the virtual machines are provisioned, you can continue with the Ansible project.\n\nPrepare the virtual machines with:  \n```bash\nansible-playbook -i inventory/vagrant playbooks/02-prepare.yml\n```\nPlease set up ZFS volumes now if the hosts use ZFS.  \n\nInstall K3S on the virtual machines with:  \n```bash\nansible-playbook -i inventory/vagrant playbooks/03-k3s-cluster.yml\n```\nThis playbook adds a cron to uncordon nodes. I have a Home Assistant automation to safely drain and shutdown the local node to save power when it is not in use.  \n\nInstall ArgoCD on the K3S clusters with:  \n```bash\nansible-playbook -i inventory/vagrant playbooks/04-deploy-argocd.yml\n```\n\n\n#### [ArgoCD Web UI](#argocd-web-ui)\nOn your local machine, you should retrieve the Kubeconfig for the cluster.  \n\nReplace `local_vm` with the hostname of a k3s server.  \n\n```bash\nscp local_vm:.kube/config kubeconfig.yaml\n```\nThis will save the kubeconfig to `./kubeconfig.yaml`.\n\nYou can access the ArgoCD web UI by retrieving the password with:  \n```bash\nexport KUBECONFIG=${PWD}/kubeconfig.yaml\nkubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath=\"{.data.password}\" | base64 -d; echo\n```\nYou can port-forward the ArgoCD web UI with:\n```bash\nexport KUBECONFIG=${PWD}/kubeconfig.yaml\nkubectl port-forward svc/argocd-server -n argocd 8080:443\n```\nThe ArgoCD web UI is now available at [https://localhost:8080](https://localhost:8080). Accept the self-signed certificate and log in with \"admin\" as username and the password retrieved above.  \n\n#### [ArgoCD KSOPS](#argocd-ksops)\nBefore adding the project to ArgoCD, you need to enable KSOPS. Secrets are encrypted in the repository and you need to provide the private key to decrypt them.  \n\nTo do this, you need to install KSOPS into ArgoCD, this project contains a playbook to do this.  \n`ansible-playbook -i inventory/vagrant playbooks/enable-ksops.yml`   \n\nThis will prompt for the private age key to decrypt the KSOPS secret. Use the private key of the age keypair you used to encrypt the secrets.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F39school%2Fansible_project_homelab_v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F39school%2Fansible_project_homelab_v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F39school%2Fansible_project_homelab_v2/lists"}