--- - name: Make sure reboot message is shown hosts: server gather_facts: false tasks: - name: Add line lineinfile: path: ~/.profile state: present search_string: "[[ -f /var/run/reboot-required ]] && echo '\\n*** You need to reboot *** \\n'" line: "[[ -f /var/run/reboot-required ]] && echo && echo '*** You need to reboot ***'"