Ansible Playbook to deploy Rancher on a Kubernetes cluster.
The playbook installs Helm on the Ansible Master node, appropriate sudo permissions must be available. The Rancher deployment needs certificates, cert-manager is therefor installed on the Kubernetes cluster by the playbook. Necessary kube config is read from the Kubernetes master node.
The Rancher stable
release is installed by default, to install the latest
release, change the default variable in the rancher
role.
Tested with self-hosted k3s cluster on Raspberry Pi's, but should also work with other Kubernetes distributions. The Master node was x86 with Ubuntu.
Minimum Ansible requirements:
ansible-base (2.10.0 or higher)
or
ansible-core (2.11.0 or higher)
The following Ansible Collections are necessary:
- ansible.posix
- community.general
- community.kubernetes
Missing collections can be installed with the provided requirements.yml
file.
ansible-galaxy collection install -r requirements.yml
The following Python packages are necessary:
- openshift
- yaml
Missing collections can be installed with the provided requirements.yml
file.
pip3 install -r requirements.txt
The playbook expects a running Kubernetes cluster, at least the Kubernetes master node must be reachable to get the kube config file, all tasks are then executed on localhost.
Execute the playbook:
ansible-playbook -i hosts main.yml
Created 2021 by Tim Grützmacher