geerlingguy / ansible-role-swap

Ansible Role - Swap

Home Page:https://galaxy.ansible.com/geerlingguy/swap/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add feature: Disable swap

geerlingguy opened this issue · comments

I was thinking about adding some functionality to disable swap on my Kubernetes role... then realized I have this role, and it would be a perfect little feature addition.

Basically, for Kubernetes (and for other purposes sometimes), it's a good idea to disable swap entirely. Therefore, this role could be set into a mode to just disable swap permanently, using a bool variable like swap_disable.

Hmm, I already have swap_file_state, but I can go further.

Or maybe not. Testing this out with an example from the geerlingguy/ansible-for-devops repo, as well as geerlingguy/raspberry-pi-dramble...

Yeah... so we can disable swap—in this example on Debian 9 in VirtualBox—like so:

swap_file_state: absent
swap_file_path: /dev/mapper/packer--debian--9--amd64--vg-swap_1

Simple!