small demo play, the numbers are a bit diff than in substring, but it
works the way you want.
- hosts: localhost
gather_facts: False
vars:
host: prd01denutl01
tasks:
- debug: msg={{ host[0:5] }}
- debug: msg={{ host[5:8] }}
- debug: msg={{ host[8:11] }}
ansible-playbook play.yml
__________________
< PLAY [localhost] >
------------------
________________________________
< TASK: debug msg={{ host0:5] }} >
--------------------------------
ok: [localhost] => {
"msg": "prd01"
}
________________________________
< TASK: debug msg={{ host5:8] }} >
--------------------------------
ok: [localhost] => {
"msg": "den"
}
_________________________________
< TASK: debug msg={{ host8:11] }} >
---------------------------------
ok: [localhost] => {
"msg": "utl"
}
____________
< PLAY RECAP >
------------
localhost : ok=3 changed=0 unreachable=0 failed=0
--
Brian Coca
--
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/CAJ5XC8%3DW_47XeOLGA4t8LgE0riYtqhWrCpbmrPQ1DjErPB5bwQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.