From c1e27b34bbc6340c0058349f3e8004e3045bdce8 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Tue, 10 May 2022 22:05:59 +0200 Subject: [PATCH] Added ansible play to configure swappiness --- ansible/swappiness.configure.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 ansible/swappiness.configure.yml diff --git a/ansible/swappiness.configure.yml b/ansible/swappiness.configure.yml new file mode 100644 index 0000000..1966b73 --- /dev/null +++ b/ansible/swappiness.configure.yml @@ -0,0 +1,24 @@ +--- + +- name: Configure swappiness + tags: + - config + - configuration + - configure + - swappiness + hosts: all + vars: + swappiness_sysctl_file: "/etc/sysctl.d/{{ swappiness_sysctl_file_priority }}-{{ swappiness_sysctl_file_name }}.conf" + swappiness_sysctl_file_name: swappiness + swappiness_sysctl_file_priority: 99 + swappiness_value: 10 + tasks: + - when: ansible_system == 'Linux' + tags: linux + block: + - name: Configure swappiness + sysctl: + name: vm.swappiness + value: "{{ swappiness_value|string }}" + sysctl_file: "{{ swappiness_sysctl_file }}" + sysctl_set: true