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_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_user_update_password: "on_create" # MongoDB user password update default policy
mongodb_manage_service: true mongodb_manage_service: true
mongodb_manage_systemd_unit: true
# Disable transparent hugepages on systemd debian based installations # Disable transparent hugepages on systemd debian based installations
mongodb_disable_transparent_hugepages: false 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_user_update_password: "on_create" # MongoDB user password update default policy
mongodb_manage_service: true mongodb_manage_service: true
mongodb_manage_systemd_unit: true
mongodb_disable_transparent_hugepages: false mongodb_disable_transparent_hugepages: false

View File

@ -3,25 +3,25 @@
- name: reload systemd - name: reload systemd
systemd: systemd:
daemon_reload: yes 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 - name: mongodb reload
service: service:
name: "{{ mongodb_daemon_name }}" name: "{{ mongodb_daemon_name }}"
state: reloaded state: reloaded
when: mongodb_manage_service|bool when: mongodb_manage_service | bool
- name: mongodb restart - name: mongodb restart
service: service:
name: "{{ mongodb_daemon_name }}" name: "{{ mongodb_daemon_name }}"
state: restarted state: restarted
when: mongodb_manage_service|bool when: mongodb_manage_service | bool
- name: mongodb-mms-monitoring-agent restart - name: mongodb-mms-monitoring-agent restart
service: service:
name: mongodb-mms-monitoring-agent name: mongodb-mms-monitoring-agent
state: restarted state: restarted
when: mongodb_manage_service|bool when: mongodb_manage_service | bool
- name: restart sysfsutils - name: restart sysfsutils
service: service:

View File

@ -59,14 +59,22 @@
state: present state: present
- name: Add systemd configuration if 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 copy:
when: ansible_service_mgr == "systemd" 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: notify:
- reload systemd - reload systemd
- name: Add symlink for 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 file:
when: ansible_service_mgr == "systemd" 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: notify:
- reload systemd - reload systemd