--- - name: Enable container features replace: path: /boot/cmdline.txt regexp: '^([\w](?!.*\b{{ item }}\b).*)$' replace: '\1 {{ item }}' with_items: - "cgroup_enable=cpuset" - "cgroup_memory=1" - "cgroup_enable=memory" - "wapaccount=1" register: cmdline - name: Set Swappoff in conf file lineinfile: path: /etc/dphys-swapfile line: CONF_SWAPSIZE=0 state: present insertafter: EOF register: swap - name: Unconditionally reboot the machine with all defaults reboot: when: cmdline.changed or swap.changed