Let's say I manage file myfile.conf
with Ansible, e.g.:
- template:
src: "myfile.conf.j2"
dest: "/etc/myfile.conf"
I can then see the diff in a dry-run, like this:
$ ansible-playbook --check --diff myplaybook.yaml
Cool. But it seems to only display the diff when the file exists on the remote host. If the file is absent, I don't see the output other than task OK.
How do I tell Ansible to show the diff if the file is absent currently?
Perhaps similar to how Git would show a diff in a commit of a newly created file in style like with /dev/null
as base in the diff:
--- /dev/null
+++ b/myfile.conf.j2