Chinese Yellow Pages | Classifieds | Knowledge | Tax | IME

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:// –recursive
$ cd ./ansible
$source ./hacking/env-setup
sudo pip install paramiko PyYAML Jinja2 httplib2 six sshpass
$ echo “” > ~/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:





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
– debug: var=ansible_distribution

run the playbook: ansible-playbook my.yml


Ansible Roles:

Leave a Reply

Your email address will not be published. Required fields are marked *