On 09.01.17 21:26 Lorens Kockum wrote: > My problem is that while this is sometimes a file and sometimes a > link to another file, it is also sometimes a broken symlink > (literally to "None" in my case, how that happens is another > problem), and my play stops short (in check mode!) saying that I > need to specify "force" to create the destination. > > I do not want to create the destination (especially since it's > "None"); if the symlink is broken I would like to replace it with > an empty file (or maybe a template), unless I'm in check mode when > I should simply note that a correction should be made.
Basically I guess you would have to check first, what state you have, e.g. a file, a link or a broken link. I guess using the stat module should do most of this. https://docs.ansible.com/stat_module.html Register the variable of this task and depending on its result start your other tasks. https://docs.ansible.com/playbooks_variables.html I'm in a hurry, so please excuse my brevity. Johannes -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/438fe239-c340-0a8a-f33e-1af46a2a8ef9%40ojkastl.de. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: OpenPGP digital signature
