In Bash I use mktemp together with trap to always remove the temp dir.
When I use the tempfile module, how do I remove the tempfile, in case of an error, which terminates the playbook run?
In Bash I use mktemp together with trap to always remove the temp dir.
When I use the tempfile module, how do I remove the tempfile, in case of an error, which terminates the playbook run?
You could register the output of tempfile in a variable and use the block rescue feature.
Something like:
`
connection: local
tasks:
`