wierd substitution at regex_replace filter

56 views
Skip to first unread message

Frank Tamás

unread,
Sep 14, 2015, 9:59:37 AM9/14/15
to Ansible Project
Hi,

I need a list with the ip address of play_hosts. This template worked with 1.6.5, but it does not work with 1.9.3. I would appreciate any help, what could be wrong.

---
- hosts: test

  vars:
    galera_cluster_members: "{{ play_hosts|map('regex_replace','(.*)', \"{{ hostvars['\\\\1']['ansible_eth0']['ipv4']['address'] }}\")|list() }}"

  tasks:
    - name: register members
      debug:
        msg: "{{ galera_cluster_members }}"


Ansible: 1.9.3
Jinja: 2.7.2


thanks,
Tamas

J Hawkesworth

unread,
Sep 18, 2015, 3:20:42 AM9/18/15
to Ansible Project
I think list is now a filter so perhaps try without the () on the end of list

Not sure you can have {{ }} inside other {{ }} so maybe needs breaking into two parts, set_fact to get the list of regex replaced play hosts and then looking up the address from hostvars as a second step.

Hope that helps.

Jon
Reply all
Reply to author
Forward
0 new messages