Hi
I’m looking to deploy a number of configuration files using the template module. The files are structured in a directory hierarchy that needs to be maintained. So for this purpose I want to use the with_filetree lookup as mentioned on
https://docs.ansible.com/ansible/latest/plugins/lookup/filetree.html.
This is (at least) a two step process whereby the directory structure is created first, and the actual templates are done next.
The example also lists a third task that recreates symlinks if one needs that.
While this probably works fine, I do see an issue when a template is deployed first and then removed from the local directory later.
Redeployment would not remove this ‘orphan’ file from the target directory which will cause issues with my application.
So I think a final ‘cleanup’ step would be needed that deletes any files on the target that aren’t in the local directory.
Before I do any wheel reinvention - does someone already have such a task at hand?
Thx
Dick