I use 2 tasks to do this:
#1 runs before template:
shell: ls /etc/nginx/sites-enabled/*.conf
register: nginx_existing
then i run my template and register the items nginx_templates
then i run a
file: path="{{item}}" state=absent
with_items: nginx_existing|difference(nginx_templates)
this will remove files that appear in the nginx_existing list that don't
appear in the nginx_templates list
(the code above is not exact, there is some extra referencing to be done
in the vars but you get the idea).
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.