Ansible is mainly using ssh to manage nodes, it is an agentless architecture different from chef, puppet.
here is quick howto to get started:
git clone git://github.com/ansible/ansible.git –recursive
$ cd ./ansible
$source ./hacking/env-setup
sudo pip install paramiko PyYAML Jinja2 httplib2 six sshpass
$ echo “127.0.0.1” > ~/ansible_hosts
$ export ANSIBLE_INVENTORY=~/ansible_hosts
simple run:
ansible all -m ping –ask-pass
ansible all -m setup # will print out all the gathering facts
how to run on One single host without defining the inventory file: ( note , after -i )
ansible all -i 192.168.1.x, -a “uname -a” -u root -k
Sample Playbook
mkdir playbooks, put those files there:
hosts
[webservers]
192.168.1.x
ansible.cfg
[defaults]
hostfile = hosts
remote_user = root
private_key_file = /xxx/xxx/.ssh/id_rsa # the key to login to those servers
host_key_checking = False
my.yml :
– name: print out operating system
hosts: all
gather_facts: True
tasks:
– debug: var=ansible_distribution
run the playbook: ansible-playbook my.yml
Ansible Roles: