roles/vmhost: Enable KSM

This commit adds a systemd unit to enable the Kernel Same-page Merging
daemon on VM hosts. This allows much greater virtual machine density,
especially when many VMs are running the same guest OS.
jenkins-master
Dustin 2019-03-22 09:25:48 -05:00
parent 909c8e7a03
commit 7e585445b9
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,12 @@
# vim: set ft=dosini :
[Unit]
Description=Kernel Same-Page Merging
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c "echo 1 > /sys/kernel/mm/ksm/run"
ExecStop=/bin/sh -c "echo 0 > /sys/kernel/mm/ksm/run"
[Install]
WantedBy=multi-user.target

View File

@ -69,3 +69,18 @@
immediate=yes
state=enabled
notify: save firewalld configuration
- name: ensure systemd ksm unit is installed
copy:
src=ksm.service
dest=/etc/systemd/system/ksm.service
mode=0644
notify: reload systemd
- name: ensure systemd ksm unit starts at boot
service:
name=ksm
enabled=yes
- name: ensure systemd ksm unit is running
service:
name=ksm
state=started