--- - name: set swapfile become: true lineinfile: path: /etc/dphys-swapfile state: present regexp: '^CONF_SWAPSIZE' line: 'CONF_SWAPSIZE=1024' owner: root group: root mode: 0600 tags: set_swapfile - name: restart swapfile become: true command: '/etc/init.d/dphys-swapfile restart' tags: set_swapfile