1 |
I haven't migrated to group_vars yet, so try and let us know ;) |
2 |
|
3 |
On Thu, Jan 29, 2015 at 11:14 AM, Stefan G. Weichinger <lists@×××××.at> |
4 |
wrote: |
5 |
|
6 |
> On 29.01.2015 10:47, Tomas Mozes wrote: |
7 |
> |
8 |
> > Have your IPs listed in hosts-production. |
9 |
> > |
10 |
> > For each site create a file, like: |
11 |
> > |
12 |
> > site_A.yml |
13 |
> > - hosts: site_A |
14 |
> > roles: |
15 |
> > - ... |
16 |
> > |
17 |
> > site_B.yml |
18 |
> > - hosts: site_B |
19 |
> > roles: |
20 |
> > - ... |
21 |
> > |
22 |
> > Then create site.yml where you include site_A.yml and site_B.yml. |
23 |
> > Mostly, you will not only use roles inclusion, but have something |
24 |
> > special done on the server, so either you create a role corresponding to |
25 |
> > this file (like role site_A, site_B) where you name the tasks or you put |
26 |
> > it directly in the site_A.yml, site_B.yml file. This is the stuff unique |
27 |
> > to the server, like creating a specific user, specific directory, with |
28 |
> > specific files... |
29 |
> > |
30 |
> > Then if you want to reconfigure all, just |
31 |
> > ansible-playbook -i hosts-production site.yml |
32 |
> > |
33 |
> > Only site_A: |
34 |
> > ansible-playbook -i hosts-production site_A.yml |
35 |
> > |
36 |
> > Only configure postfix on site_B: |
37 |
> > ansible-playbook -i hosts-production site_B.yml --tags postfix -v |
38 |
> > |
39 |
> > Read: |
40 |
> > http://docs.ansible.com/playbooks_roles.html |
41 |
> > http://docs.ansible.com/playbooks_best_practices.html |
42 |
> > |
43 |
> |
44 |
> Thanks, Tomas ... yes .... and no ... ;-) |
45 |
> |
46 |
> I wonder if I could also: |
47 |
> |
48 |
> cp defaults/main.yml to group_vars/site_[AB].yml ... |
49 |
> |
50 |
> adjust the configs to the sites and then use something like: |
51 |
> |
52 |
> # playbook 1 |
53 |
> |
54 |
> - hosts: site_A |
55 |
> roles: |
56 |
> - dhcpd |
57 |
> |
58 |
> # playbook 2 |
59 |
> |
60 |
> - hosts: site_B |
61 |
> roles: |
62 |
> - dhcpd |
63 |
> |
64 |
> .... would the group_vars override the vars defined in defaults/main.yml ? |
65 |
> |
66 |
> I *think* so ... I will try that ... |
67 |
> |
68 |
> Stefan |
69 |
> |
70 |
> |