Git Product home page Git Product logo

ansible-tower-dynamic-ucmdb-inventory's Introduction

UCMDB Dynamic Inventory Plugin for Ansible Tower

These scripts are simple examples to get dynamic inventory from Microfocus UCMDB. I developed these scripts for a specific purpose.

These scripts calls tql query named "Redhat_Servers" from ucmdb and returns some unix servers.

execute-tql-query-py2.py

tested on Python 2.7.5

tested on Ansible Tower 3.6.2 and ansible 2.9.1

usage:

python execute-tql-query-py2.py --list
python execute-tql-query-py2.py --list --pretty
python execute-tql-query-py2.py --hostname <hostname>
python execute-tql-query-py2.py --hostname <hostname> --pretty

execute-tql-query-py3.py

Ansible Tower 3.6.2 uses Python 2.7.5

If you'd like to work with different python version you need to do following instructions

Preparing a New Custom Virtualenv

tested on Python 3.6.9

i couldn't test yet on Ansible Tower

usage:

python execute-tql-query-py3.py --list
python execute-tql-query-py3.py --list --pretty
python execute-tql-query-py3.py --hostname <hostname>
python execute-tql-query-py3.py --hostname <hostname> --pretty

Example Output:

{
   "all":{
      "children":[
         "unix"
      ]
   },
   "unix":{
      "hosts":[
         "test5",
         "test1",
         "test2",
         "test4",
         "test3"
      ],
      "children":[

      ]
   },
   "_meta":{
      "hostvars":{
         "test1":{
            "maintenance_interval":"10:00 - 17:00",
            "discovered_os_version":"7.4",
            "maintenance_date":"Cumartesi",
            "os_family":"unix",
            "ip_address":"192.168.1.1",
            "os_vendor":"red_hat_software"
         },
         "test2":{
            "maintenance_interval":"10:00 - 17:00",
            "discovered_os_version":"6.9",
            "maintenance_date":"Cumartesi",
            "os_family":"unix",
            "ip_address":"192.168.1.2",
            "os_vendor":"red_hat_software"
         },
         "test3":{
            "maintenance_interval":"10:00 - 17:00",
            "discovered_os_version":"7.4",
            "maintenance_date":"Cumartesi",
            "os_family":"unix",
            "ip_address":"192.168.1.3",
            "os_vendor":"red_hat_software"
         },
         "test4":{
            "maintenance_interval":"10:00 - 17:00",
            "discovered_os_version":"7.4",
            "maintenance_date":"Cumartesi",
            "os_family":"unix",
            "ip_address":"192.168.1.4",
            "os_vendor":"red_hat_software"
         },
         "test5":{
            "maintenance_interval":"10:00 - 17:00",
            "discovered_os_version":"7.4",
            "maintenance_date":"Cumartesi",
            "os_family":"unix",
            "ip_address":"192.168.1.5",
            "os_vendor":"red_hat_software"
         }
      }
   }
}

ansible-tower-dynamic-ucmdb-inventory's People

Contributors

alcnsahin avatar

Watchers

 avatar  avatar

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.