From 180472bf46a58252f8adf754138bae1dbd547983 Mon Sep 17 00:00:00 2001 From: Louis Vallat Date: Wed, 8 Jan 2025 11:30:58 +0100 Subject: [PATCH] feat: added compact memory for virtual machines Signed-off-by: Louis Vallat --- compact_mem.yaml | 5 +++++ roles/compact_mem/tasks/main.yaml | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 compact_mem.yaml create mode 100644 roles/compact_mem/tasks/main.yaml diff --git a/compact_mem.yaml b/compact_mem.yaml new file mode 100644 index 0000000..8a45781 --- /dev/null +++ b/compact_mem.yaml @@ -0,0 +1,5 @@ +--- +- name: "Compact mem on VMs." + hosts: all + roles: + - compact_mem diff --git a/roles/compact_mem/tasks/main.yaml b/roles/compact_mem/tasks/main.yaml new file mode 100644 index 0000000..b163fe9 --- /dev/null +++ b/roles/compact_mem/tasks/main.yaml @@ -0,0 +1,7 @@ +--- +- name: Set cron to compact memory + ansible.builtin.cron: + name: "compact memory every day" + special_time: "daily" + job: "echo 1 > /proc/sys/vm/compact_memory" + when: compact_mem