Gentoo Archives: gentoo-user

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

Replies

Subject Author
Re: [gentoo-user] Usign ansible hydra <hydrapolic@×××××.com>