An Ansible collection for automating the installation and configuration of Kubernetes and IaC (Infrastructure as Code) tools.
| Role | Description |
|---|---|
setup_shell |
Configure shell completions and PATH (bash, zsh, fish) |
install_kubectl |
Install and configure kubectl |
install_krew |
Install krew (kubectl plugin manager) |
install_krew_plugins |
Install specified krew plugins |
install_helm |
Install Helm package manager |
install_terraform |
Install HashiCorp Terraform |
install_packer |
Install HashiCorp Packer |
install_vagrant |
Install HashiCorp Vagrant |
install_kustomize |
Install Kustomize |
install_pulumi |
Install Pulumi |
- Ansible 2.9+
- Supported OS: Ubuntu 22.04+, Debian 11+, Rocky Linux 9+
- Supported Shells: bash, zsh, fish
ansible-galaxy collection install somaz94.ansible_k8s_iac_toolDefine variables in vars.yml:
home_user: "somaz"
user_shells:
- bash # default
# - zsh # optional: configure .zshrc
# - fish # optional: configure fish config
krew_plugins:
- ctx
- neat
- ns
# See: https://krew.sigs.k8s.io/plugins/| Variable | Description | Default |
|---|---|---|
home_user |
Target user for tooling setup | - |
user_shells |
List of shells to configure (bash, zsh, fish) |
[bash] |
krew_plugins |
List of krew plugins to install | [] |
# site.yml
---
- hosts: localhost
become: true
vars_files:
- vars.yml
collections:
- somaz94.ansible_k8s_iac_tool
roles:
- setup_shell
- install_kubectl
- install_krew
- install_krew_plugins
- install_terraform
- install_packer
- install_vagrant
- install_helm
- install_kustomize
- install_pulumiansible-playbook site.yml# inventory.ini
[servers]
my-server ansible_ssh_user=ubuntu ansible_ssh_private_key_file=~/.ssh/id_rsa# site.yml
---
- hosts: servers
become: true
vars_files:
- vars.yml
collections:
- somaz94.ansible_k8s_iac_tool
roles:
- setup_shell
- install_kubectl
- install_krew
- install_krew_plugins
- install_terraform
- install_packer
- install_vagrant
- install_helm
- install_kustomize
- install_pulumiansible-playbook -i inventory.ini site.ymlAfter the playbook completes, reload the shell configuration:
# bash
source ~/.bashrc
# zsh
source ~/.zshrc
# fish (new session or)
source ~/.config/fish/conf.d/k8s-iac-tools.fish- Python 3.x
- Docker (for Molecule testing)
make venv # Create venv and install dependencies
make test # Full molecule test (default: ubuntu2204)
make test DISTRO=ubuntu2404 # Test with Ubuntu 24.04
make test DISTRO=debian12 # Test with Debian 12
make test DISTRO=rockylinux9 # Test with Rocky Linux 9
make converge # Apply roles only
make verify # Run verification only
make destroy # Destroy test instances
make lint # Run ansible-lint
make build # Build Galaxy collection
make publish GALAXY_API_KEY=xxx # Publish to Ansible Galaxy
make clean # Remove venv and build artifactsThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.