This is a Ansible Playbook to create a Kubernetes cluster.
In hosts file insert the IPs of master and workers. In the workers:vars set MASTER_IP with the same IP of master.
Example:
[master]
172.17.3.30
[workers]
172.17.3.45
172.17.3.80
[workers:vars]
MASTER_IP=172.17.3.30
MASTER_SECURE_PORT=6443
Execute the command:
$ ansible-playbook -i hosts main.yml
If you're use a key file to connect in the instances use:
$ ansible-playbook -i hosts main.yml --key-file=example-key.pem
You can use the variable ANSIBLE_HOST_KEY_CHECKING=False
to skip the confirmation when first connection with instances.