Giter Club home page Giter Club logo

ansible_phpipam's Introduction

ansible_phpipam

An inventory script I developed for querying a PHpipam DB and providing Ansible ready JSON output

Using this script has a couple requirements:

  1. Ansible Automation Platform controller, Tower or AWX

  2. Creating a Custom credential type that includes the following Env Injectors:

    env:

IPAM_DBHOST: '{{ host }}'

IPAM_DBPASS: '{{ password }}'

IPAM_DBUSER: '{{ username }}'

  1. You create a Project, then an Inventory with a source from Project
  2. On the PhpIpam side: I am using custom fields in lieu of tags to filter IPAddresses that I want to manage. So there are custom_fields on IPAddresses and Subnets, so I can filter based on both. Your situation might differ, adjust the query accordingly.
  3. Make sure the .py is executable

For testing this outside of AAP, it's as easy and running the script. However inside of AAP there are some hurdles, since AAP utilizes containers at Job runtime you must do a few things. Mount the container or Execution Environment you intend to use in the AAP Inventory Source, start a bash session within it, manually set the ENV variables then run it.

Provided you see JSON output, then it should work fine within AAP.

In my situation I encountered a month's worth of problems that ultimately were resolved by changing the credential used, then switching back to the original. Even RH support had no clue why.

Something to note: The job can run inside AAP and if say there's an issue communicating with the DB, or the credentials supplied are incorrect or for whatever reason it cannot connect to teh database.. AAP's error (ansible-inventory actually) will give no indication that there's an issue like that. My RH guy submitted an RFE to get the error handling tweaked for this but for now it'll only return that it expected data on line 1, column 1 and got nothing.

ansible_phpipam's People

Contributors

bicarbonate avatar cidrbl0ck avatar

Watchers

 avatar

Forkers

cidrbl0ck

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.