Skip to content

Commit b6b99e3

Browse files
author
Patrick Dreker
committed
Ensure the systemd file is created under the
correct name When installing mongodb-org packages on Debian/Ubuntu the daemon name is set to "mongod" but the .service file is unconditionally installed as "mongodb.service". This PR ensures, that the systemd file (and the accompanying symlink) are installed as "mongodb_dameon_name.service". Otherwise installation fails with fatal: [tmongo-02]: FAILED! => {"changed": false, "msg": "Could not find the requested service mongod: host"} for every host, as the handler tries to restart mongod, but systemd only sees mongodb
1 parent eb1c8e6 commit b6b99e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tasks/install.debian.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@
5959
state: present
6060

6161
- name: Add systemd configuration if present
62-
copy: src=mongodb.service dest=/lib/systemd/system/mongodb.service owner=root group=root mode=0644
62+
copy: src=mongodb.service dest=/lib/systemd/system/{{mongodb_daemon_name}}.service owner=root group=root mode=0644
6363
when: ansible_service_mgr == "systemd"
6464
notify:
6565
- reload systemd
6666

6767
- name: Add symlink for systemd
68-
file: src=/lib/systemd/system/mongodb.service dest=/etc/systemd/system/multi-user.target.wants/mongodb.service state=link
68+
file: src=/lib/systemd/system/{{mongodb_daemon_name}}.service dest=/etc/systemd/system/multi-user.target.wants/{{mongodb_daemon_name}}.service state=link
6969
when: ansible_service_mgr == "systemd"
7070
notify:
7171
- reload systemd

0 commit comments

Comments
 (0)