On 29.01.2015 10:47, Tomas Mozes wrote: > Have your IPs listed in hosts-production. > > For each site create a file, like: > > site_A.yml > - hosts: site_A > roles: > - ... > > site_B.yml > - hosts: site_B > roles: > - ... > > Then create site.yml where you include site_A.yml and site_B.yml. > Mostly, you will not only use roles inclusion, but have something > special done on the server, so either you create a role corresponding to > this file (like role site_A, site_B) where you name the tasks or you put > it directly in the site_A.yml, site_B.yml file. This is the stuff unique > to the server, like creating a specific user, specific directory, with > specific files... > > Then if you want to reconfigure all, just > ansible-playbook -i hosts-production site.yml > > Only site_A: > ansible-playbook -i hosts-production site_A.yml > > Only configure postfix on site_B: > ansible-playbook -i hosts-production site_B.yml --tags postfix -v > > Read: > http://docs.ansible.com/playbooks_roles.html > http://docs.ansible.com/playbooks_best_practices.html >
Thanks, Tomas ... yes .... and no ... ;-) I wonder if I could also: cp defaults/main.yml to group_vars/site_[AB].yml ... adjust the configs to the sites and then use something like: # playbook 1 - hosts: site_A roles: - dhcpd # playbook 2 - hosts: site_B roles: - dhcpd .... would the group_vars override the vars defined in defaults/main.yml ? I *think* so ... I will try that ... Stefan