Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipaddr: Update docs #54587

Merged
merged 1 commit into from
Apr 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/docsite/rst/user_guide/playbooks_filters_ipaddr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,34 @@ be automatically converted to a router address (with a ``::1/48`` host address):

.. _6to4: https://en.wikipedia.org/wiki/6to4

Finding IP addresses within a range
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Akasurde marked this conversation as resolved.
Show resolved Hide resolved
To find usable IP addresses within an IP range, try these ``ipaddr`` filters:

To find the next usable IP address in a range, use ``next_usable`` ::

# {{ '192.168.122.1/24' | ipaddr('next_usable') }}
192.168.122.2

To find the last usable IP address from a range, use ``last_usable``::

# {{ '192.168.122.1/24' | ipaddr('last_usable') }}
192.168.122.254

To find the available range of IP addresses from the given network address, use ``range_usable``::

# {{ '192.168.122.1/24' | ipaddr('range_usable') }}
192.168.122.1-192.168.122.254

To find the next nth usable IP address within a range, use ``next_nth_usable``::

# {{ '192.168.122.1/24' | next_nth_usable(2) }}
192.168.122.3

In this example, ``next_nth_usable`` returns the second usable IP address for the given IP range.


IP Math
^^^^^^^

Expand Down