Vagrant

install virtualbox and vagrant first, then create a working directory

# mkdir /opt/vagrant
# cd /opt/vagrant/

Initialize the environment in the directory, in this case we’ll download a ubuntu precise vm

# vagrant box add precise32 http://files.vagrantup.com/precise32.box
# vagrant box list

Edit Vagrantfile and make sure the vm points to “precise32” instead of “base”:

  config.vm.box = "precise32"

Start the vm

# vagrant init
# vagrant up

Connect to the vm

# vagrant ssh

Additional…
for a centos6.5 you can find a vm here:

# vagrant box add centos65 http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5-i386_chef-provisionerless.box

Ansible

Install it in the master node

# apt-get install ansible

add a section to /etc/ansible/hosts

[slaves]
d510
d610

Ping them (make sure you have ssh keys setup in authorized_keys)

# ansible -m ping -u root all
d510 | success >> {
    "changed": false,
    "ping": "pong"
}

d610 | success >> {
    "changed": false,
    "ping": "pong"
}

A first play file using apt to install some packages in the “slaves”

---
- name : first play
  hosts: slaves
  user: root

  tasks:

#  - name: install gcc
#    apt: pkg=gcc state=present
#  - name: install nginx
#    apt: pkg=nginx state=present

  - name: install findx
    copy: src=/usr/bin/findx dest=/usr/bin/findx owner=root group=root mode=755

  - name: install common packages
    action: apt pkg={{item}} state=installed
    with_items:
      - motion
      - nginx

Running it…

# ansible-playbook play.yml

PLAY [first play] *************************************************************

GATHERING FACTS ***************************************************************
ok: [d510]
ok: [d610]

TASK: [install findx] *********************************************************
ok: [d610]
ok: [d510]

TASK: [install common packages] ***********************************************
ok: [d610] => (item=motion,nginx)
ok: [d510] => (item=motion,nginx)

PLAY RECAP ********************************************************************
d510                       : ok=3    changed=0    unreachable=0    failed=0
d610                       : ok=3    changed=0    unreachable=0    failed=0