Naween Ghimire
2015-07-17 11:59:49 UTC
Hi I have a usecase where i have a string "dumb". During the execution of
play i create a new string by using a random filter and this string should
be any of ['duma','dumc','dumd'] but not "dumb". So i tried to use do until
loop as follows:
- hosts: local
connection: local
gather_facts: false
vars:
old_string: 'dumb'
tasks:
- name: Generate random number
set_fact: "new_string=dum{{ ['a','b','c','d'] |random }}"
register: e
until: e != old_string
- name: Fail if old number and new number are same
action: fail
when: new_string == old_string
So as far as i am concerned the check at the until step should avoid
allowing the new_string to be "dumb", but its not doing as expected. Any
suggestions ?
play i create a new string by using a random filter and this string should
be any of ['duma','dumc','dumd'] but not "dumb". So i tried to use do until
loop as follows:
- hosts: local
connection: local
gather_facts: false
vars:
old_string: 'dumb'
tasks:
- name: Generate random number
set_fact: "new_string=dum{{ ['a','b','c','d'] |random }}"
register: e
until: e != old_string
- name: Fail if old number and new number are same
action: fail
when: new_string == old_string
So as far as i am concerned the check at the until step should avoid
allowing the new_string to be "dumb", but its not doing as expected. Any
suggestions ?
--
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/df654928-188a-4cf3-aade-59dce7c887ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/df654928-188a-4cf3-aade-59dce7c887ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.