Hi,

I'm trying to do a conditional register in a playbook:

  tasks:
    - shell: echo /opt/cache/www/
      register: www_data
      when: ansible_hostname | match("^xy-")

    - shell: echo /mnt/code/www/
      register: www_data
      when: ansible_hostname | match("^az-")

    - debug: var=www_data.stdout
      when: www_data.rc is defined and www_data.rc == 0

Only the last register "/mnt/code/www/" is shown by debug, and for the 
other I'm getting failures.
I would like to know what is the proper way to do this.

Thanks,

-- 
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/258d8420-6865-474d-a847-f0da5ae4512d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to