diff --git a/roles/swap/defaults/main.yaml b/roles/swap/defaults/main.yaml new file mode 100644 index 0000000..f7108b6 --- /dev/null +++ b/roles/swap/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +swap_enabled: true +swap_file_path: /swapfile diff --git a/roles/swap/tasks/main.yaml b/roles/swap/tasks/main.yaml new file mode 100644 index 0000000..2173b98 --- /dev/null +++ b/roles/swap/tasks/main.yaml @@ -0,0 +1,15 @@ +--- +- name: manage swap + command: swapoff -a + when: not swap_enabled + +- name: manage swapfile + file: + path: "{{ swap_file_path }}" + state: absent + +- name: manage fstab + lineinfile: + path: /etc/fstab + regexp: swap + state: absent