diff --git a/README.md b/README.md index e54527b..3d2c6a9 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/defaults/main.yml b/defaults/main.yml index 37e611f..be3b175 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/handlers/main.yml b/handlers/main.yml index 3339e65..33a38f5 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -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: diff --git a/tasks/install.debian.yml b/tasks/install.debian.yml index e5975e6..714744a 100644 --- a/tasks/install.debian.yml +++ b/tasks/install.debian.yml @@ -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