I have the following directory
named.0.102.10.reverse
named.0.103.10.reverse
named.0.104.10.reverse
named.0.2.10.reverse
named.dreamhosts
That's my code
---
- name: Check if the dns reverse file exist based on the ips
find:
paths: '/tmp/test_dns'
patterns: '^named\.'
use_regex: True
register: find_results
- name: print find_results
debug: var="{{item.path}}"
with_items: '{{find_results.files}}'
I get the following error
FAILED! => {"failed": true, "msg": "template error while templating string: unexpected '/'. String: {{/tmp/test_dns/named.5.104.10.reverse}}"}
It's seems to be a bug but after further research the bug was fixed on my version.
So maybe, i though the problem was between the chair and the keyboard :-) . Any ideas ?
You don't need to use template in the value of the var
parameter. It should contain a variable name:
- name: print find_results
debug: var=item.path
with_items: '{{find_results.files}}'
Writing "{{item.path}}"
you provide the variable value instead of its name and Ansible gets confused.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With