Skip to content
ipcalc filter for Ansible to calculate IPv4/IPv6 networks
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
README.md
ipcalc_filter.py
ipcalc_test.py

README.md

IP Calc for Ansible

Build Status

Requirements

You need a recent version of ipcalc. On Debian/Ubuntu you can install it with:

sudo apt-get install python-pip
sudo pip install ipcalc

Installation

Copy the file ipcalc_filter.py to $ansible/filter_plugins/

Usage

Example usage in a jinja2 template:

{% set network = "172.16.0.1/24" | ipcalc %}
{{ network.host_min }}


{{ "192.168.0.1" | ipadd(3) }} == "192.168.0.4"
{{ "fe80::" | ipadd("::3") }} == "fe80::3"
You can’t perform that action at this time.