{"id":25376512,"url":"https://github.com/pythoninthegrass/bootstrap_k3s","last_synced_at":"2025-04-09T09:49:05.029Z","repository":{"id":277229910,"uuid":"930165480","full_name":"pythoninthegrass/bootstrap_k3s","owner":"pythoninthegrass","description":"Alternative to k3sup for deploying k3s clusters with Ansible.","archived":false,"fork":false,"pushed_at":"2025-03-03T03:12:10.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T08:34:58.791Z","etag":null,"topics":["ansible","k3s","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pythoninthegrass.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":"2025-02-10T07:23:42.000Z","updated_at":"2025-03-03T03:12:13.000Z","dependencies_parsed_at":"2025-02-12T21:12:55.440Z","dependency_job_id":"0f224ba7-0b9a-4fc5-8503-16bc530d9368","html_url":"https://github.com/pythoninthegrass/bootstrap_k3s","commit_stats":null,"previous_names":["pythoninthegrass/bootstrap_k3s"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythoninthegrass%2Fbootstrap_k3s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythoninthegrass%2Fbootstrap_k3s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythoninthegrass%2Fbootstrap_k3s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythoninthegrass%2Fbootstrap_k3s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pythoninthegrass","download_url":"https://codeload.github.com/pythoninthegrass/bootstrap_k3s/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248017997,"owners_count":21034042,"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","k3s","kubernetes"],"created_at":"2025-02-15T04:28:08.527Z","updated_at":"2025-04-09T09:49:05.021Z","avatar_url":"https://github.com/pythoninthegrass.png","language":"Shell","readme":"# bootstrap_k3s\n\nAlternative to [k3sup](https://github.com/alexellis/k3sup) for deploying k3s clusters with Ansible.\n\n## Minimum requirements\n\n* [Python 3.11+](https://www.python.org/downloads/)\n* [Skate](https://github.com/charmbracelet/skate)\n\n## Recommended requirements\n\n* [Devbox](https://www.jetify.com/docs/devbox/installing_devbox/)\n\n## Setup\n\nCreate a virtual environment and install the requirements:\n\n```bash\npython -m venv .venv\nsource .venv/bin/activate\npython -m pip install -r requirements.txt\nansible-galaxy collection install -r requirements.yml\n```\n\nReplace the ansible inventory file with your own:\n\n```yaml\nk3s_servers:\n  hosts:\n    server-1:\n      ansible_host: 192.168.8.51\n      k3s_type: server\n      k3s_control_node: true\n    server-2:\n      ansible_host: 192.168.8.52\n      k3s_type: server\n    server-3:\n      ansible_host: 192.168.8.53\n      k3s_type: server\n\nvars:\n  ansible_user: ubuntu\n  ansible_port: 22\n```\n\n### Managing sudo passwords with Vault\n\nThe project uses an encrypted `vault.yml` file to manage sudo passwords for each host.\n\n#### Creating the Vault\n\n1. Create a vault password:\n\n```bash\n# Store your vault password in skate\nskate set ansible_vault_password \u003cYOUR_VAULT_PASSWORD\u003e\n```\n\n2. Create and encrypt the vault.yml file:\n\n```bash\n# Create the vault.yml file with your sudo passwords for each host\ncat \u003e vault.yml \u003c\u003c 'EOF'\n---\nvault_passwords:\n  server-1: \"password_for_server1\"\n  server-2: \"password_for_server2\"\n  server-3: \"password_for_server3\"\n  default: \"default_password\"\nEOF\n\n# Encrypt the file using the password stored in skate\nansible-vault encrypt vault.yml --vault-password-file \u003c(skate get ansible_vault_password)\n```\n\n#### Using the Vault\n\nYou can use the vault in two ways:\n\n1. Set environment variable to avoid specifying the vault password file on every command:\n\n```bash\n# Set the ANSIBLE_VAULT_PASSWORD_FILE environment variable\nexport ANSIBLE_VAULT_PASSWORD_FILE=$(skate get ansible_vault_password)\n\n# Now you can run ansible commands without specifying the vault-password-file flag\nansible-playbook -i inventory.yml main.yml\n\n# For a specific host\nansible-playbook -i inventory.yml main.yml --limit server-1\n```\n\n2. Explicitly specify the vault password file with each command:\n\n```bash\n# Run playbooks using the vault password from skate\nansible-playbook -i inventory.yml main.yml --vault-password-file \u003c(skate list ansible_vault_password -v)\n```\n\n#### Editing the Vault\n\nTo edit the encrypted vault file:\n\n```bash\n# If you've set the environment variable:\nansible-vault edit vault.yml\n\n# Or explicitly specify the vault password:\nansible-vault edit vault.yml --vault-password-file \u003c(skate list ansible_vault_password -v)\n```\n\n## Usage\n\n### Install k3s and deploy a cluster\n\n```bash\n# If environment variable is set:\nansible-playbook -i inventory.yml main.yml\n\n# Or with explicit vault password file:\nansible-playbook -i inventory.yml main.yml --vault-password-file \u003c(skate list ansible_vault_password -v)\n\n# Run against a specific host\nansible-playbook -i inventory.yml main.yml --limit server-1\n```\n\n### Uninstall k3s\n\n```bash\nansible-playbook -i inventory.yml uninstall.yml\n```\n\n## TODO\n\n* Debug `ansible-navigator` ssh connection on macos\n* Move more vars to `group_vars`\n* Add task runners\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythoninthegrass%2Fbootstrap_k3s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpythoninthegrass%2Fbootstrap_k3s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythoninthegrass%2Fbootstrap_k3s/lists"}