--- - name: Cleanup Comments lineinfile: path: "{{ authorized_keys_file }}" state: absent regexp: '^#.*$' - name: Add Comment blockinfile: path: "{{ authorized_keys_file }}" marker: "" block: | # Modified by Ansible on {{ ansible_date_time.date }} at {{ ansible_date_time.time }}