So I'm struggling with the following.
I want to check if a certain directory exists (Tomcat instance directory) ,
if so I wan't to stop the playbook since apparently the tomcat instance is
already present.
I thought this should work:
- name: create tomcat instance {{ tomcat_instance_name }} dir
file: path="{{ tomcat_dir }}/instances/{{ tomcat_instance_name }}" state=
directory
register: result
failed_when: result|ok
- name: debug command result
debug: result
I expected that the var 'result' would contain the output like shown
without -v (ok, changed, skipping) or perhaps with -v (changed:false/true
etc etc)
However this is not the case. Debuging said var will give me "Hello
World!". Well Hello to you to, but it's not being very helpful.
*So the main question would be*. How do you guys check if something already
exists and get it to fail/skip if it does.
--
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/643bd776-e36c-485b-93c3-e200acdccfb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.