ipaddr filter positive integer as a query seems not to work the same in Ansible 2.8

18 views
Skip to first unread message

Patrick Tuite

unread,
May 27, 2019, 5:49:28 AM5/27/19
to Ansible Project
Hi folks

We have a filter working up till v2.7

"{{ v_overlay_network | ipaddr('net') | ipaddr('191') | ipaddr('address') if v_overlay_network is defined and v_overlay_network | ipaddr else 198.19.0.191 }}"

In this case v_overlay_network is defined (198.19.0.0/16)
Now alway produces False in v2.8

I think I've isolated it to the ipaddr integer host query, where positive integers return nothing, but negative integers work as expected

TASK [DEBUG print positive v_overlay_network msg={{ v_overlay_network | ipaddr('net') | ipaddr('254') }}] *****************************
ok: [localhost] => {
    "msg": ""
}

TASK [DEBUG print negative v_overlay_network msg={{ v_overlay_network | ipaddr('net') | ipaddr('-64') }}] *****************************
ok: [localhost] => {
    "msg": "198.19.255.192/16"
}

Not sure if I missed something in the Porting Guide or if I have hit a bug?

$ python --version
Python 2.7.5

 $ pip show ansible
---
Metadata-Version: 2.1
Name: ansible
Version: 2.8.0
 
 
$ pip show jinja2
---
Metadata-Version: 2.1
Name: Jinja2
Version: 2.10.1

Thanks
Patrick

Patrick Tuite

unread,
May 28, 2019, 2:17:40 AM5/28/19
to Ansible Project
Reply all
Reply to author
Forward
0 new messages