Version: Ansible 1.9.4
I’m going to try and describe this as well as a I can. Please comment and let me know any questions.
I’m trying to design a role that will do the following:
- Get a list of interface IP addresses for each host (minus ‘lo’ and any non-active interfaces)
- Use that IP listing to test each IP against a IP subnet(VLAN)
- I have a quick perl script I had written to test this (rc.0 = on same subnet/VLAN, rc.1 = NOT on the same VLAN/subnet)
- This script also prints to stdout the VLAN/subnet “group name” when there is a match
- I’d then like to take each subnet written to stdout (not the skipped items or anything null, obviously)
- Use that list to somehow set facts that could then be used to put hosts in various host groups based on those subnet names
This sounds simple enough, though I’m not the most advanced Ansible user and certainly not a Python dev. I’ve been trying a bunch of approach, though I appear to be getting farther from a solution lately.
Here is what my vars look like (slightly modified to reveal less):