Ansible at its most basic is just this:
ansible-playbook -i site.yml hosts
Which just means “run the site.yml playbook on the hosts file”. And a hosts file is pretty simple. You can see examples here: http://docs.ansible.com/intro_inventory.html
When using Vagrant with Ansible, it automatically creates a hosts file so you never really see that. So back to question #1:
- You can just create a
hostsfile with your production hostname/ip in there.group_vars/allwill apply to all hosts as its name suggests. So you may want to rename that togroup_vars/devand make a newgroup_vars/prodwith your production sites. Then yourhostsfile would look like:
[prod]
prod-server.com
And you would run ansible-playbook -i site.yml hosts as usual. You can always make a new playbook based on site.yml if you want to change what roles are run as well. Little more info here as well: Bedrock Vagrant/Ansible released
- Using this playbook on CentOS would require a lot more changes as it’s all set up to use
aptand Ubuntu ppa’s.