feat: adding service managment
This commit is contained in:
parent
77736ceb7a
commit
985e5297f0
|
@ -15,6 +15,8 @@ mongodb_package: mongodb-org
|
||||||
mongodb_additional_packages:
|
mongodb_additional_packages:
|
||||||
- python-pymongo
|
- python-pymongo
|
||||||
|
|
||||||
|
mongodb_manager_service: true
|
||||||
|
|
||||||
mongodb_user: mongodb
|
mongodb_user: mongodb
|
||||||
mongodb_daemon_name: "{{ 'mongod' if ('mongodb-org' in mongodb_package) else 'mongodb' }}"
|
mongodb_daemon_name: "{{ 'mongod' if ('mongodb-org' in mongodb_package) else 'mongodb' }}"
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ mongodb_package: mongodb-org
|
||||||
mongodb_additional_packages:
|
mongodb_additional_packages:
|
||||||
- python-pymongo
|
- python-pymongo
|
||||||
|
|
||||||
|
mongodb_manager_service: true
|
||||||
|
|
||||||
mongodb_user: mongodb
|
mongodb_user: mongodb
|
||||||
mongodb_daemon_name: "{{ 'mongod' if ('mongodb-org' in mongodb_package) else 'mongodb' }}"
|
mongodb_daemon_name: "{{ 'mongod' if ('mongodb-org' in mongodb_package) else 'mongodb' }}"
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,16 @@
|
||||||
|
|
||||||
- name: mongodb reload
|
- name: mongodb reload
|
||||||
service: name={{ mongodb_daemon_name }} state=reloaded
|
service: name={{ mongodb_daemon_name }} state=reloaded
|
||||||
|
when: mongodb_manager_service
|
||||||
|
|
||||||
- name: mongodb restart
|
- name: mongodb restart
|
||||||
service: name={{ mongodb_daemon_name }} state=restarted
|
service: name={{ mongodb_daemon_name }} state=restarted
|
||||||
|
when: mongodb_manager_service
|
||||||
|
|
||||||
- name: mongodb-mms-automation-agent restart
|
- name: mongodb-mms-automation-agent restart
|
||||||
service: name=mongodb-mms-automation-agent state=restarted
|
service: name=mongodb-mms-automation-agent state=restarted
|
||||||
|
when: mongodb_manager_service
|
||||||
|
|
||||||
- name: reload systemd
|
- name: reload systemd
|
||||||
shell: systemctl daemon-reload
|
shell: systemctl daemon-reload
|
||||||
when: systemd.stat.exists == true
|
when: systemd.stat.exists == true and mongodb_manager_service
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
- name: ensure mongodb started and enabled
|
- name: ensure mongodb started and enabled
|
||||||
service: name={{ mongodb_daemon_name }} state=started enabled=yes
|
service: name={{ mongodb_daemon_name }} state=started enabled=yes
|
||||||
|
when: mongodb_manager_service
|
||||||
|
|
||||||
- name: wait MongoDB port is listening
|
- name: wait MongoDB port is listening
|
||||||
wait_for: host="{{ mongodb_conf_bind_ip }}"port="{{ mongodb_conf_port }}" delay=10 timeout=60 state=started
|
wait_for: host="{{ mongodb_conf_bind_ip }}"port="{{ mongodb_conf_port }}" delay=10 timeout=60 state=started
|
||||||
|
@ -38,4 +39,4 @@
|
||||||
|
|
||||||
- name: mongodb restart
|
- name: mongodb restart
|
||||||
service: name={{ mongodb_daemon_name }} state=restarted
|
service: name={{ mongodb_daemon_name }} state=restarted
|
||||||
when: config_result|changed
|
when: config_result|changed and mongodb_manager_service
|
||||||
|
|
|
@ -17,3 +17,4 @@
|
||||||
|
|
||||||
- name: Ensure that the MMS agent is started
|
- name: Ensure that the MMS agent is started
|
||||||
service: name=mongodb-mms-automation-agent state=started enabled=yes
|
service: name=mongodb-mms-automation-agent state=started enabled=yes
|
||||||
|
when: mongodb_manager_service
|
||||||
|
|
Loading…
Reference in New Issue