I'm setting an Ansible fact like this:

    set_fact: server_num={{ ansible_hostname[-2:] }}

server_num can take these values:

    '00'
    '01'
    '02'
    '03'
    '04'
    ad infinitum

If I want a conditional that will evaluate to True for all server numbers 
less than a particular server number 'n' I'd like to be able to do this:

    when: server_num < 'n'

However, this throws the error "error while evaluating conditional: 
server_num < 'n'

I could do this but clearly it doesn't scale:

   when: server_num == '00' or server_num == '01' or ... or server_num == 
'n-1'

Is there a more succinct way to do this?  I can't seem to find a Jinja2 
"less than" operator.

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/d48f2de5-5383-4bbb-a837-05a5a3bb1bcf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to