Code Monkey home page Code Monkey logo

itop-utilities's Introduction

itop-utilities

Utilities scripts for itop, an open source cmdb.

Empowers CMDB by connectincg to other system like Ansible.

Script FromITOPtoAnsible.sh

This script pulls info from an ITOP cmdb to generate a JSON hosts list to be used as a Dynamic Inventory Source for ansible commands. This is very useful to perform operations on groups of hosts, according to your physical, logical or network infrastructure, or according your services, as it is defined on your cmdb.

For example, you can send commands to all machines of a given rack, or those plugged to a specific network device, or those having related open tickets. You have to define a set of hosts by using an OQL select statement.

Installation

As a prerequisite, you need an iTop instance, and an Ansible instance too, in the same or in different servers. Just copy the script to your ansible machine, in /etc/ansible, and made it executable.

 cd /etc/ansible
 wget --no-check-certificate https://github.com/jaimevalero78/itop-utilities/raw/master/FromITOPtoAnsible.sh  
 chmod +x /etc/ansible/FromITOPtoAnsible.sh

Also, you have to change the credentials for the itop instance in the script. The parameters you should change are:

# Parameters: Change this according to your itop credentials 

MY_USER=replace_for_your_itop_user
MY_PASS=replace_for_your_itop_password
ITOP_SERVER=replace_for_your_itop_server
INSTALLATION_DIRECTORY=itop-itsm
HTTPS=Y

Script parameters

Passed as enviroment variable

  • OQL = Sentence in OQL
  • FIELD = (optional) name of the field to be used as hostname

Script usage example

Perform a ping against all HP Server against the itop demo instance. http://goo.gl/FrOQdQ

cd /etc/ansible

export OQL="SELECT Server WHERE brand_name = 'HP'"
 
ansible all -i FromITOPtoAnsible.sh -m shell -m "ping" 

# The above command would try to access each of the server list : { "hosts" : [ "Server1" , "Server3" , "Server4" , "SRV1" , "SRV1" , "Web" ] }
# and try to login against it. 
# It will fail, of course. You have to configure the script to query your own itop and ansible instances!

itop-utilities's People

Contributors

jaimevalero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

itop-utilities's Issues

Generate hostgroup_vars

New feature : Maybe a good feature to have in the FromMysqltoAnsible.sh script, would be to generate in the json "group vars", according to the other columns of the SELECT.

This would make the script a bit less faster, but it could be useful for using the script whith playbooks.

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.