Git Product home page Git Product logo

apollo-inventory's Introduction

Apollo Inventory

wercker status MIT license

This is WIP. Currently only Digitalocean is supported.

This is a Ansible Dynamic Inventory for Apollo allowing pluggable clouds and system providers.

It use Terraform as a default provider for generating the inventory by parsing a given Terraform state file.

It allows to create new providers by implementing inventoryProvider interface:

type inventoryProvider interface {
    list() map[string]interface{}
	host(string) map[string]string
}

Usage

apollo-inventory --pretty --path=/path_to/terraform.tfstate

The default value for --path can be set as an environment variable via:

export TF_VAR_state_path=/path_to/terraform.tfstate

For Digital ocean you will see something like:

{
  "_meta": {
    "hostvars": {
      "apollo-mesos-master-0": {
        "ansible_ssh_host": "46.101.4.15",
        "ansible_ssh_user": "root",
        "id": "5506398",
        "image": "11919335",
        "ipv4_address": "46.101.4.15",
        "ipv4_address_private": "10.131.166.113",
        "locked": "false",
        "name": "apollo-mesos-master-0",
        "private_networking": "true",
        "region": "lon1",
        "size": "512mb",
        "ssh_keys.#": "1",
        "ssh_keys.0": "821202",
        "status": "active"
      },
      "apollo-mesos-master-1": {
        "ansible_ssh_host": "46.101.3.149",
        "ansible_ssh_user": "root",
        "id": "5506399",
        "image": "11919335",
        "ipv4_address": "46.101.3.149",
        "ipv4_address_private": "10.131.163.45",
        "locked": "false",
        "name": "apollo-mesos-master-1",
        "private_networking": "true",
        "region": "lon1",
        "size": "512mb",
        "ssh_keys.#": "1",
        "ssh_keys.0": "821202",
        "status": "active"
      },
      "apollo-mesos-master-2": {
        "ansible_ssh_host": "46.101.3.229",
        "ansible_ssh_user": "root",
        "id": "5506400",
        "image": "11919335",
        "ipv4_address": "46.101.3.229",
        "ipv4_address_private": "10.131.163.57",
        "locked": "false",
        "name": "apollo-mesos-master-2",
        "private_networking": "true",
        "region": "lon1",
        "size": "512mb",
        "ssh_keys.#": "1",
        "ssh_keys.0": "821202",
        "status": "active"
      },
      "apollo-mesos-slave-0": {
        "ansible_ssh_host": "46.101.4.14",
        "ansible_ssh_user": "root",
        "id": "5506409",
        "image": "11919335",
        "ipv4_address": "46.101.4.14",
        "ipv4_address_private": "10.131.166.115",
        "locked": "false",
        "name": "apollo-mesos-slave-0",
        "private_networking": "true",
        "region": "lon1",
        "size": "512mb",
        "ssh_keys.#": "1",
        "ssh_keys.0": "821202",
        "status": "active"
      }
    }
  },
  "name=apollo-mesos-master-0": {
    "hosts": [
      "apollo-mesos-master-0"
    ]
  },
  "name=apollo-mesos-master-1": {
    "hosts": [
      "apollo-mesos-master-1"
    ]
  },
  "name=apollo-mesos-master-2": {
    "hosts": [
      "apollo-mesos-master-2"
    ]
  },
  "name=apollo-mesos-slave-0": {
    "hosts": [
      "apollo-mesos-slave-0"
    ]
  },
  "region=lon1": {
    "hosts": [
      "apollo-mesos-master-0",
      "apollo-mesos-master-1",
      "apollo-mesos-master-2",
      "apollo-mesos-slave-0"
    ]
  },
  "role=mesos-master": {
    "hosts": [
      "apollo-mesos-master-0",
      "apollo-mesos-master-1",
      "apollo-mesos-master-2"
    ]
  },
  "role=mesos-slave": {
    "hosts": [
      "apollo-mesos-slave-0"
    ]
  },
  "size=512mb": {
    "hosts": [
      "apollo-mesos-master-0",
      "apollo-mesos-master-1",
      "apollo-mesos-master-2",
      "apollo-mesos-slave-0"
    ]
  },
  "type=digitalocean_droplet": {
    "hosts": [
      "apollo-mesos-master-0",
      "apollo-mesos-master-1",
      "apollo-mesos-master-2",
      "apollo-mesos-slave-0"
    ]
  }
apollo-inventory --host=hostname --pretty --path=/path_to/terraform.tfstate

For Digitalocean you will see somehting like:

{
  "id": "5506398",
  "image": "11919335",
  "ipv4_address": "46.101.4.15",
  "ipv4_address_private": "10.131.166.113",
  "locked": "false",
  "name": "apollo-mesos-master-0",
  "private_networking": "true",
  "region": "lon1",
  "size": "512mb",
  "ssh_keys.#": "1",
  "ssh_keys.0": "821202",
  "status": "active"
}

apollo-inventory's People

Contributors

enxebre avatar

Watchers

 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.