After rebuilding lab environments for what feels like the 100th time now, I decided to just write a playbook to just do this for me.
The playbook can be found here and you might want to work off this example inventory.
The playbook will create a new cluster and add nodes to an existing cluster.
It tested against Ubuntu 20.04lts
with this version of ansible:
$ ansible --version
ansible [core 2.11.1]
config file = None
configured module search path = ['/Users/redacted/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/redacted/Library/Python/3.8/lib/python/site-packages/ansible
ansible collection location = /Users/redacted/.ansible/collections:/usr/share/ansible/collections
executable location = /Users/redacted/Library/Python/3.8/bin/ansible
python version = 3.8.2 (default, Apr 8 2021, 23:19:18) [Clang 12.0.5 (clang-1205.0.22.9)]
jinja version = 3.0.1
libyaml = True
Creating New Clusters
Populate your inventory.yaml
with information on all the servers that need to be in the cluster and run the playbook:
$ ansible-playbook -i inventory.yaml k8s-multi-master-setup.yaml
Adding Nodes to Clusters
Add the new node information to inventory.yaml
and run the playbook.
$ ansible-playbook -i inventory.yaml k8s-multi-master-setup.yaml