Skip to content

Commit ec291ba

Browse files
authored
Merge pull request #67 from davidcaste/fix-systemd-test
Fix systemd test for Ubuntu Xenial
2 parents d10f291 + d9393b1 commit ec291ba

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tasks/install.deb.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
- include_vars: "{{ansible_distribution}}.yml"
44

55
- name: Check if running on systemd
6-
command: cat /proc/1/cmdline
7-
register: systemd
6+
stat: path=/sbin/init
7+
register: sbin_init
88
changed_when: false
99
always_run: yes # side-effect free, so it can be run in check-mode as well
1010

1111
- name: Add systemd configuration if present
1212
copy: src=mongodb.service dest=/lib/systemd/system/mongodb.service owner=root group=root mode=0640
13-
when: "'systemd' in systemd.stdout"
13+
when: sbin_init.stat.islnk is defined and sbin_init.stat.islnk
1414

1515
- name: Add symlink for systemd
1616
file: src=/lib/systemd/system/mongodb.service dest=/etc/systemd/system/multi-user.target.wants/mongodb.service state=link
17-
when: "'systemd' in systemd.stdout"
17+
when: sbin_init.stat.islnk is defined and sbin_init.stat.islnk
1818
notify: reload systemd
1919

2020
- meta: flush_handlers
21-
when: "'systemd' in systemd.stdout"
21+
when: sbin_init.stat.islnk is defined and sbin_init.stat.islnk
2222

2323
- name: Add APT key
2424
apt_key:
@@ -48,7 +48,7 @@
4848
- name: reload systemd
4949
shell: systemctl daemon-reload
5050
changed_when: false
51-
when: "'systemd' in systemd.stdout"
51+
when: sbin_init.stat.islnk is defined and sbin_init.stat.islnk
5252

5353
- name: Install PyMongo package
5454
apt: pkg=python-pymongo state=latest

0 commit comments

Comments
 (0)