Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/znerol/ansible-role-ipaddr-hash
Provides a Jinja2 filter plugin to compute an IP address given a prefix and a seed, e.g., the `inventory_hostname`.
https://github.com/znerol/ansible-role-ipaddr-hash
Last synced: 25 days ago
JSON representation
Provides a Jinja2 filter plugin to compute an IP address given a prefix and a seed, e.g., the `inventory_hostname`.
- Host: GitHub
- URL: https://github.com/znerol/ansible-role-ipaddr-hash
- Owner: znerol
- License: gpl-3.0
- Created: 2020-05-25T12:25:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-15T10:57:19.000Z (over 1 year ago)
- Last Synced: 2024-04-16T00:33:49.362Z (7 months ago)
- Language: Python
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
Ansible Role: ipaddr\_hash
==========================[![Build Status](https://travis-ci.org/znerol/ansible-role-ipaddr-hash.svg?branch=master)](https://travis-ci.org/znerol/ansible-role-ipaddr-hash)
Provides a Jinja2 filter plugin to compute an IP address given a prefix and a
seed, e.g., the `inventory_hostname`.This plugin is useful for people seeking a predictable addressing scheme for
statically assigned IPv6 addresses based on hostnames.The algorithm used to derive an ip is simple:
ip = prefix + (sha256(seed) & hostmask)
Requirements
------------None
Role Variables
--------------None
Dependencies
------------* Python module [netaddr](https://pypi.org/project/netaddr/) on controller.
Example Playbook
----------------Usage of `ipaddr_hash` filter:
- hosts: localhost
tasks:
- import_role:
name: znerol.ipaddr_hash- debug:
msg: "Generated IPv6 address for example.com with prefix '2001:db8::/64' is {{ '2001:db8::/64' | ipaddr_hash('example.com') }}"This should generate the address: `2001:db8::13d2:1255:86ce:1947`.
See [test/test.yml](tests/test.yml) for sample input/output.
License
-------GPLv3