Ansible basic config
Ansible can be used quickly, for example to send command to all nodes in a cluster.
Install ansible
bash
sudo apt update
sudo apt install ansible -y
Create Ansible hosts
bash
sudo mkdir -p /etc/ansible
sudo chmod 755 /etc/ansible
sudo vim /etc/ansible/hosts
ini
[master]
cb-master1 ansible_connection=local
[workers]
cb-node-1 ansible_connection=ssh
cb-node-2 ansible_connection=ssh
[cube:children]
master
workers
Test Ansible
bash
ansible cube -m ping
Generate SSH Keys to manage Compute Blade Clusters with SSH/Ansible
bash
cd
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub root@cb-node-1
ssh-copy-id -i ~/.ssh/id_rsa.pub root@cb-node-2
ssh-copy-id -i ~/.ssh/id_rsa.pub root@cb-master1
send reboot command to all workers nodes
bash
ansible workers -b -m shell -a "init 6"