- name: Disable swap. shell: > dphys-swapfile swapoff && dphys-swapfile uninstall && update-rc.d -f dphys-swapfile remove systemctl disable dphys-swapfile # when: # - ansible_swaptotal_mb > 0 - name: copy dphys-swapfile become: true copy: src: resources/{{ item }} dest: /etc owner: root group: root mode: '0744' with_items: - dphys-swapfile