地方エンジニアの学習日記

興味ある技術の雑なメモだったりを書いてくブログ。たまに日記とガジェット紹介。

The ipaddr filter requires python-netaddr be installed on the ansible controller

ipaddrフィルターを使おうとしたらタイトルのエラーが出力された。

github.com

python-netaddrパッケージをインストールする必要があるとのこと。

Name        : python-netaddr
Arch        : noarch
Version     : 0.7.5
Release     : 9.el7
Size        : 983 k
Repo        : base/7/x86_64
Summary     : A pure Python network address representation and manipulation library
URL         : http://github.com/drkjam/netaddr
License     : BSD
Description : A pure Python network address representation and manipulation library.
            :
            : netaddr provides a Pythonic way of working with :-
            :
            : - IPv4 and IPv6 addresses and subnets
            : - MAC addresses, OUI and IAB identifiers, IEEE EUI-64 identifiers
            : - arbitrary (non-aligned) IP address ranges and IP address sets
            : - various non-CIDR IP range formats such as nmap and glob-style formats
            :
            : Included are routines for :-
            :
            : - generating, sorting and summarizing IP addresses and networks
            : - performing easy conversions between address notations and formats
            : - detecting, parsing and formatting network address representations
            : - performing set-based operations on groups of IP addresses and subnets
            : - working with arbitrary IP address ranges and formats
            : - accessing OUI and IAB organisational information published by IEEE
            : - accessing IP address and block information published by IANA
            :
            : For details on the latest updates and changes, see :-
            :
            :     http://github.com/drkjam/netaddr/blob/rel-0.7.x/CHANGELOG
            :
            : API documentation for the latest release is available here :-
            :
            :     http://packages.python.org/netaddr/

yumなりaptなりapkなりで追加すれば問題なく動くことを確認できた。

{{ '192.0.2.1/24' | ipaddr('address') }}