File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 4
4
5
5
- name : Restart mongodb service
6
6
service : name={{ mongodb_daemon_name }} state=restarted
7
+ when : mongodb_manage_service
8
+
9
+ - name : get pid of mongodb for non daemon mode
10
+ shell : " pidof mongod"
11
+ register : pidof_mongod
12
+ when : mongodb_manage_service == false
13
+ ignore_errors : yes
14
+
15
+ - name : start mongodb daemon
16
+ shell : " LC_ALL=C /usr/bin/mongod --config /etc/mongod.conf --fork"
17
+ when : mongodb_manage_service == false and pidof_mongod.rc == 1
7
18
8
19
- name : create administrative user siteUserAdmin
9
20
mongodb_user :
52
63
53
64
- name : Restart mongodb service
54
65
service : name={{ mongodb_daemon_name }} state=restarted
66
+ when : mongodb_manage_service
67
+
68
+ - name : stop mongodb if was not started
69
+ shell : " kill {{ pidof_mongod.stdout }}"
70
+ when : mongodb_manage_service == false and pidof_mongod.rc == 0
You can’t perform that action at this time.
0 commit comments