With this playbook:
- name: test playbook
� hosts: 127.0.0.1
� connection: local
� gather_facts: no
� tasks:
��� - debug: msg="{{ 'ansible'|replace('a', 'b') }}"
Output will be:
"bnsible"
But with this:
- name: test playbook
� hosts: 127.0.0.1
� connection: local
� gather_facts: no
� tasks:
��� - debug: msg="{{ 'ansible'|regex_replace('a', 'b') }}"
Output will be:
"{{'ansible'|regex_replace('a', 'b')}}"
Why in the last example expression is not evaluated?
ps
I use Ansible 1.5.4
That's a pretty old version of ansible. I suspect that the
regex_replace filter didn't exist then. You should definitely upgrade
since it works on 1.7.1.
Yep yep.
(You’re also missing some security upgrades, so I would strongly recommend using 1.7.1 even if you don’t need this)
We try to note in the docs every time there’s a feature added in a specific version, but I see we didn’t do that for regex_replace, so I’ll add the note about it.
Thanks very much for the report!
Yes indeed, I forgot to add Ansible PPA. Thanks!