Fix unit file of disable-transparent-hugepages and fix all time change status.

This commit is contained in:
Mikhail Konyakhin 2019-11-25 13:44:36 +03:00
parent 1c128e7590
commit db328011d5
5 changed files with 21 additions and 15 deletions

View File

@ -5,6 +5,14 @@
daemon_reload: yes
when: ansible_service_mgr == "systemd" and mongodb_manage_service | bool
- name: run disable-transparent-hugepages
systemd:
name: disable-transparent-hugepages
enabled: true
state: started
daemon_reload: yes
when: ansible_service_mgr == "systemd" and mongodb_disable_transparent_hugepages | bool
- name: mongodb reload
service:
name: "{{ mongodb_daemon_name }}"

View File

@ -1,18 +1,13 @@
---
- name: Create disable transparent hugepages systemd service file
copy:
template:
src: "{{ item }}"
dest: /etc/systemd/system/disable-transparent-hugepages.service
owner: root
group: root
mode: 0644
with_first_found:
- "disable-transparent-hugepages.{{ ansible_distribution | lower }}.service"
- "disable-transparent-hugepages.{{ ansible_os_family | lower }}.service"
- "disable-transparent-hugepages.{{ ansible_distribution | lower }}.service.j2"
- "disable-transparent-hugepages.{{ ansible_os_family | lower }}.service.j2"
notify: "run disable-transparent-hugepages"
- name: Enable disable-transparent-hugepages.service
systemd:
name: disable-transparent-hugepages
daemon-reload: true
enabled: true
state: started

View File

@ -1,8 +1,9 @@
# {{ ansible_managed }}
[Unit]
Description="Disable Transparent Hugepage before MongoDB boots"
#WARN: check service name on your system
# If you are using MongoDB Cloud, service name is "mongodb-mms-automation-agent.service"
Before=mongodb.service
Before={{ mongodb_daemon_name }}.service
[Service]
Type=oneshot
@ -13,4 +14,4 @@ ExecStart=-/bin/bash -c 'echo 0 > /sys/kernel/mm/redhat_transparent_hugepage/khu
[Install]
#WARN: check service name on your system
# If you are using MongoDB Cloud, service name is "mongodb-mms-automation-agent.service"
RequiredBy=mongodb.service
RequiredBy={{ mongodb_daemon_name }}.service

View File

@ -1,8 +1,9 @@
# {{ ansible_managed }}
[Unit]
Description="Disable Transparent Hugepage before MongoDB boots"
#WARN: check service name on your system
# If you are using MongoDB Cloud, service name is "mongodb-mms-automation-agent.service"
Before=mongodb.service
Before={{ mongodb_daemon_name }}.service
[Service]
Type=oneshot
@ -13,4 +14,4 @@ ExecStart=-/bin/bash -c 'echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged
[Install]
#WARN: check service name on your system
# If you are using MongoDB Cloud, service name is "mongodb-mms-automation-agent.service"
RequiredBy=mongodb.service
RequiredBy={{ mongodb_daemon_name }}.service

View File

@ -1,8 +1,9 @@
# {{ ansible_managed }}
[Unit]
Description="Disable Transparent Hugepage before MongoDB boots"
#WARN: check service name on your system
# If you are using MongoDB Cloud, service name is "mongodb-mms-automation-agent.service"
Before=mongodb.service
Before={{ mongodb_daemon_name }}.service
[Service]
Type=oneshot
@ -13,4 +14,4 @@ ExecStart=-/bin/bash -c 'echo 0 > /sys/kernel/mm/redhat_transparent_hugepage/khu
[Install]
#WARN: check service name on your system
# If you are using MongoDB Cloud, service name is "mongodb-mms-automation-agent.service"
RequiredBy=mongodb.service
RequiredBy={{ mongodb_daemon_name }}.service