First steps in Ansible
Install ansible
sudo pacman -S ansible
Create an Inventory; the file where you specify the hosts Ansible will manage
// Host based on IP
192.168.1.20
// Single host with name
[vps]
192.168.1.21
[vps:vars]
ansible_connection=ssh
ansible_port=2222
ansible_user=user
ansible_ssh_private_key_file=/path/to/key
// Web server group example
[web]
// From 192.168.1.21 to 192.168.1.29
192.168.1.3[1:9]
And test the connection to the hosts
ansible all --inventory=/path/to/inventory -m ping
// Debugging
ANSIBLE_DEBUG=1 ansible -vvvvv -i inventory all -m ping
YOU MUST HAVE PYTHON INSTALLED IN THE CLIENT.
Execute a command
ansible example -i inventory -a "free -m"
Execute a playbook
ansible-playbook -i inventory playbook.yml -f 10