1 |
On 18.01.2015 09:25, Alan McKinnon wrote: |
2 |
|
3 |
> My advice: |
4 |
> |
5 |
> Start with groups. If you find you need to have lots of "when" |
6 |
> clauses to make the plays work across more than one distro, and the |
7 |
> whens follow the same format, then you might want to split them into |
8 |
> groups. Make for example a "gentoo-www" group and a "debian-www" |
9 |
> group, and create a super-group "www" that includes both. |
10 |
> |
11 |
> It's one of those questions you can only really answer once you've |
12 |
> built it for yourself and can see what works better in your |
13 |
> environment |
14 |
|
15 |
Yes, thanks! |
16 |
|
17 |
>> IMO ansible should correctly detect the running PID1 .. and it |
18 |
>> tries to as far as I understand the code of the service-module. |
19 |
>> |
20 |
>> For example I tried to write a task to ensure that ntpd is |
21 |
>> down/disabled and chrony is installed/enabled/started ... no real |
22 |
>> success so far. |
23 |
> |
24 |
> If ansible confuses installed init systems with running init system, |
25 |
> then that will be a bug in ansible and should be reported |
26 |
|
27 |
When I read |
28 |
|
29 |
/usr/lib64/python2.7/site-packages/ansible/modules/core/system/service.py |
30 |
|
31 |
I understand that it should detect the enabled systemd in line 403ff |
32 |
|
33 |
but maybe it detects the wrong tool/binary to start/stop services when |
34 |
both openrc and systemd are installed (442ff) |
35 |
|
36 |
See this: |
37 |
|
38 |
# ansible -i inventories/oops_nodes.yml -l hiro.local -m service -a |
39 |
"name=chronyd state=started" all |
40 |
hiro.local | FAILED >> { |
41 |
"failed": true, |
42 |
"msg": " * WARNING: chronyd is already starting\n" |
43 |
} |
44 |
|
45 |
That is ~ the same msg as in: |
46 |
|
47 |
# /etc/init.d/chronyd start |
48 |
* WARNING: chronyd is already starting |
49 |
|
50 |
(the openrc-script answering) |
51 |
|
52 |
# systemctl status chronyd |
53 |
● chronyd.service - Chrony Network Time Service |
54 |
Loaded: loaded (/usr/lib64/systemd/system/chronyd.service; enabled; |
55 |
vendor preset: enabled) |
56 |
Active: active (running) since Mo 2015-01-19 10:57:39 CET; 9min ago |
57 |
Process: 761 ExecStart=/usr/sbin/chronyd (code=exited, status=0/SUCCESS) |
58 |
Main PID: 764 (chronyd) |
59 |
CGroup: /system.slice/chronyd.service |
60 |
└─764 /usr/sbin/chronyd |
61 |
|
62 |
But for another daemon: |
63 |
|
64 |
# ansible -i inventories/oops_nodes.yml -l hiro.local -m service -a |
65 |
"name=systemd-networkd state=started" all |
66 |
hiro.local | success >> { |
67 |
"changed": false, |
68 |
"name": "systemd-networkd", |
69 |
"state": "started" |
70 |
} |
71 |
|
72 |
|
73 |
I might file the bug at b.g.o. .. going upstream seems a bit early ;-) |
74 |
|
75 |
Stefan |