who to group hosts by fqdn or ip?

100 views
Skip to first unread message

Camp Nou

unread,
Apr 22, 2014, 11:06:55 PM4/22/14
to ansible...@googlegroups.com

It seems group_by doesn't support filters?

'''
- hosts: all
  tasks:
    - name: group hosts by inventory hostname
      group_by: key="{{ inventory_hostname | regex_replace('.+\\.(prod|test|dev)\\.example\\.org', '\\1') }}"
'''
The task doesn't work.
It will generate a group with the name "{{ inventory_hostname-|-regex_replace('.+\\.(prod|test|dev)\\.example\\.org', '\\1') }}"

Michael DeHaan

unread,
Apr 23, 2014, 8:09:46 AM4/23/14
to ansible...@googlegroups.com
Sounds like the filter failed to parse your regex, or there was no regex_replace filter in that version of Ansible.

I agree this should produce an exception in these cases.

What version of Ansible are you on?





--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7c78880d-d860-49f2-9e2a-f05a6ac4ba64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nathan Robertson

unread,
Jul 23, 2014, 1:23:13 PM7/23/14
to ansible...@googlegroups.com
Michael,  

I am getting a similar issue on 1.4.3

I think the issue is that this version of Ansible does not support this filter.  What version was this filter implemented?  

Michael DeHaan

unread,
Jul 23, 2014, 6:11:23 PM7/23/14
to ansible...@googlegroups.com
"I am getting a similar issue on 1.4.3"

Very ancient at this point.

Please upgrade to 1.6.8 (latest) first before asking a question, can't spend time on the project list on older releases - sorry.




Reply all
Reply to author
Forward
0 new messages