Giter Site home page Giter Site logo

ping_addr's Introduction

Description

A dynamic inventory plugin for Ansible which pings a given cidr network and adds hosts if there is a response to the ping.

The name comes from addr being part of the nix command ipaddr but also a misspelling of 'ip adder' since this shit adds ips as hosts. Very Clever.

Usage

Loading the module

It's just a normal inventory plugin. It needs to be copied to the correct place: <your_ansible_install_location>/lib/python2.7/site-packages/ansible/plugins/inventory

Alternatively modify your plugin path variable ($ANSIBLE_INVENTORY_PLUGINS) to have it pulled from a custom location.

Whitelisting

Be default only the host_list, script, auto, yaml, ini, and toml inventory plugins are allowed. To whitelist this plugin, simply add 'ping_addr' in the ansible.cfg here:


[inventory]
enable_plugins = host_list, script, auto, yaml, ini, toml

Generating the inventory

Only a single option is required to generate the inventory, and that's the network in CIDR notation.

Create a file named ping_addr.yml and add the following contents:


plugin: ping_addr
network: 10.1.1.0/28

To see the hosts that would be generated from the inventory plugin, run:


ansible-inventory -i ping_addr.yml --list

Or to see the group tree that would be generated from the inventory plugin (this doesn't do groupings right now), run:


ansible-inventory -i ping_addr.yml --graph

TODO

  • Probably need to add some grouping capability and variables sets.
  • Also need to tweak the ping settings to have a shorter timeout when a host does not respond.
  • Need to package it up so that it can be added to an instance easier

ping_addr's People

Contributors

matthew-hickok avatar

Watchers

James Cloos avatar  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.