Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Filter in YAML] - no filter named 'regex_escape' #13759

Closed
Oliboy50 opened this issue Jan 7, 2016 · 1 comment
Closed

[Filter in YAML] - no filter named 'regex_escape' #13759

Oliboy50 opened this issue Jan 7, 2016 · 1 comment
Labels
docs This issue/PR relates to or includes documentation.
Milestone

Comments

@Oliboy50
Copy link

Oliboy50 commented Jan 7, 2016

- name: Add ip/hostname couples to /etc/hosts file
  lineinfile:
    state: present
    dest: /etc/hosts
    regexp: "^(?:[0-9]{1,3}{{ '.' | regex_escape() }}){3}[0-9]{1,3} {{ item.hostname | regex_escape() }}$"
    line: "{{ item.ip }} {{ item.hostname }}"
TASK: [etc-hosts | Add ip/hostname couples to /etc/hosts file] **************** 
fatal: [web] => Failed to template ^(?:[0-9]{1,3}{{ '.' | regex_escape }}){3}[0-9]{1,3} {{ item.hostname | regex_escape }}$: template error while templating string: no filter named 'regex_escape'

Ansible version: 1.9.4

This filter was found in http://docs.ansible.com/ansible/playbooks_filters.html

EDIT:
After deeper researches, I realize that I get this error for every filters, not only regex_escape.

My question might be "how to use filter in YAML tasks?"...

@bcoca
Copy link
Member

bcoca commented Jan 7, 2016

a) they are jinja2 filters
b) you seem to be using them correctly
c) regex_escape was added in 2.0, the note right above it kind of implies it but we should clarify it in the docs.

@bcoca bcoca added this to the v2 milestone Jan 7, 2016
bcoca added a commit that referenced this issue Jan 7, 2016
@bcoca bcoca closed this as completed in 41a417b Jan 7, 2016
@ansibot ansibot added docs This issue/PR relates to or includes documentation. and removed docs_report labels Mar 1, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
docs This issue/PR relates to or includes documentation.
Projects
None yet
Development

No branches or pull requests

3 participants