Po utworzeniu klastra Kubernetes w samouczku Wspaniałe rzeczy z kontenerami: klaster Kubenetes i pamięć masowa NFS chciałbym teraz mieć możliwość adresowania tych komputerów za pomocą Ansible.
W tym celu potrzebny jest nowy klucz:
$ ssh-keygen -b 4096
$ sudo apt-get install -y ansible
[raspi-kube.clust]
ip-server-1:ssh-port ansible_ssh_user=username
ip-server-2:ssh-port ansible_ssh_user=username
ip-server-3:ssh-port ansible_ssh_user=username
Teraz można sprawdzić konfigurację w następujący sposób:
$ ansible all -m ping --ssh-common-args='-o StrictHostKeyChecking=no'
Teraz można wykonywać playbooki lub polecenia, np. restartować wszystkie serwery:
$ ansible raspi -m shell -a 'sudo /sbin/reboot'