File tree Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ [Unit]
2
+ Description =An object/document-oriented database
3
+ Documentation =man:mongod(1)
4
+
5
+ [Service]
6
+ User =mongodb
7
+ ExecStart =/usr/bin/mongod --config /etc/mongodb.conf
8
+
9
+ [Install]
10
+ WantedBy =multi-user.target
Original file line number Diff line number Diff line change 8
8
9
9
- name : mongodb-mms-automation-agent restart
10
10
service : name=mongodb-mms-automation-agent state=restarted
11
+
12
+ - name : reload systemd
13
+ shell : systemctl daemon-reload
Original file line number Diff line number Diff line change 13
13
template : src=logrotate.conf.j2 dest=/etc/logrotate.d/mongodb.conf
14
14
when : mongodb_logrotate
15
15
16
+ # - name: reload systemd
17
+ # shell: systemctl daemon-reload
18
+ # when: systemd.stat.exists == true
19
+ # changed_when: false
20
+
16
21
- name : ensure mongodb started and enabled
17
22
service : name={{ mongodb_daemon_name }} state=started enabled=yes
18
23
24
+ - name : wait MongoDB port is listening
25
+ wait_for : host="{{ mongodb_conf_bind_ip }}"port="{{ mongodb_conf_port }}" delay=5 state=started
26
+ when : systemd.stat.exists == true
27
+
19
28
- include : auth_initialization.yml
20
29
when : mongodb_conf_auth
21
30
Original file line number Diff line number Diff line change 2
2
3
3
- include_vars : " {{ansible_distribution}}.yml"
4
4
5
+ - name : Check if systemd is present
6
+ stat : path=/lib/systemd/system/
7
+ register : systemd
8
+
9
+ - name : Add systemd configuration if present
10
+ copy : src=mongodb.service dest=/lib/systemd/system/mongodb.service owner=root group=root mode=0640
11
+ when : systemd.stat.exists == true
12
+
13
+ - name : Add symlink for systemd
14
+ file : src=/lib/systemd/system/mongodb.service dest=/etc/systemd/system/multi-user.target.wants/mongodb.service state=link
15
+ when : systemd.stat.exists == true
16
+ notify : reload systemd
17
+
18
+ - meta : flush_handlers
19
+ when : systemd.stat.exists == true
20
+
5
21
- name : Add APT key
6
22
apt_key : url=http://docs.mongodb.org/10gen-gpg-key.asc id=7F0CEB10
7
23
when : ' "mongodb-org" in mongodb_package'
12
28
13
29
- name : Install MongoDB package
14
30
apt : pkg={{mongodb_package}} state=present
31
+ notify : reload systemd
32
+
33
+ - meta : flush_handlers
15
34
16
35
- name : Install additional packages
17
36
apt : pkg={{item}}
You can’t perform that action at this time.
0 commit comments