Add flag 'mongodb_manage_systemd_unit' for disable manage systemd unit

file of MongoDB.
This commit is contained in:
Mikhail Konyakhin 2019-11-25 12:54:21 +03:00
parent 4632f4b909
commit 137e4f1f2a
4 changed files with 18 additions and 8 deletions

View File

@ -43,6 +43,7 @@ mongodb_pymongo_from_pip: true # Install latest PyMongo via PIP or package manag
mongodb_pymongo_pip_version: 3.6.1 # Choose PyMong version to install from pip. If not set use latest
mongodb_user_update_password: "on_create" # MongoDB user password update default policy
mongodb_manage_service: true
mongodb_manage_systemd_unit: true
# Disable transparent hugepages on systemd debian based installations
mongodb_disable_transparent_hugepages: false

View File

@ -15,6 +15,7 @@ mongodb_pymongo_pip_version: 3.7.1
mongodb_user_update_password: "on_create" # MongoDB user password update default policy
mongodb_manage_service: true
mongodb_manage_systemd_unit: true
mongodb_disable_transparent_hugepages: false

View File

@ -3,25 +3,25 @@
- name: reload systemd
systemd:
daemon_reload: yes
when: ansible_service_mgr == "systemd" and mongodb_manage_service
when: ansible_service_mgr == "systemd" and mongodb_manage_service | bool
- name: mongodb reload
service:
name: "{{ mongodb_daemon_name }}"
state: reloaded
when: mongodb_manage_service|bool
when: mongodb_manage_service | bool
- name: mongodb restart
service:
name: "{{ mongodb_daemon_name }}"
state: restarted
when: mongodb_manage_service|bool
when: mongodb_manage_service | bool
- name: mongodb-mms-monitoring-agent restart
service:
name: mongodb-mms-monitoring-agent
state: restarted
when: mongodb_manage_service|bool
when: mongodb_manage_service | bool
- name: restart sysfsutils
service:

View File

@ -59,14 +59,22 @@
state: present
- name: Add systemd configuration if present
copy: src=mongodb.service dest=/lib/systemd/system/{{mongodb_daemon_name}}.service owner=root group=root mode=0644
when: ansible_service_mgr == "systemd"
copy:
src: mongodb.service
dest: "/lib/systemd/system/{{mongodb_daemon_name}}.service"
owner: root
group: root
mode: '0644'
when: ansible_service_mgr == "systemd" and mongodb_manage_systemd_unit | bool
notify:
- reload systemd
- name: Add symlink for systemd
file: src=/lib/systemd/system/{{mongodb_daemon_name}}.service dest=/etc/systemd/system/multi-user.target.wants/{{mongodb_daemon_name}}.service state=link
when: ansible_service_mgr == "systemd"
file:
src: "/lib/systemd/system/{{mongodb_daemon_name}}.service"
dest: "/etc/systemd/system/multi-user.target.wants/{{mongodb_daemon_name}}.service"
state: link
when: ansible_service_mgr == "systemd" and mongodb_manage_systemd_unit | bool
notify:
- reload systemd