- name: Disable swap. become: true shell: > /usr/sbin/dphys-swapfile swapoff && /usr/sbin/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