This turned out to be a Proxmox issue, not an Ansible one.
Proxmox LXC configuration files accept both <key>: <value
and = . However, it automatically converts the latter into the former. This is why
lineinfile` was not working.
I am still slightly unsure as to why blockinfile
was producing marker lines at the top of the file and placing the block at the bottom, but lineinfile
is working as expected using the <key>: <value>
format.