{ "info": { "author": "Jose Riguera Lopez", "author_email": "jose.riguera@springer.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: System :: Systems Administration" ], "description": "# bosh-ansible-inventory\n\nAnsible 2 dynamic inventory\n\n# Usage\n\nYou can install it by running `setup.py`:\n```\n$ python setup.py install\n```\n\nor using `pip`:\n\n```\n$ pip install bosh_inventory\n```\n\nAlso, you can copy and run it directly by calling the program \n`bosh_inventory.py` instead of `bosh-inventory`.\n\n\nOnce it is installed:\n\n```\n$ bosh-inventory --help\nusage: bosh-inventory [-h] [--list]\n\nProgram to create an ansible inventory from all the deployments, jobs and\ninstances managed by a BOSH Director.\n\noptional arguments:\n -h, --help show this help message and exit\n --list Enable JSON output for dynamic ansible inventory\n\nbosh-inventory reads BOSH_CONFIG environment variable pointing to the configuration\nfile used by Bosh client (defaults to '~/.bosh/config' or '~/.bosh_config') in\norder to get the credentials from it. You can define additional inventory\nparameters via BOSH_ANSIBLE_INVENTORY_PARAMS environment variable, for example:\nBOSH_ANSIBLE_INVENTORY_PARAMS=\"ansible_user=vcap ansible_ssh_pass=blabla\". Be aware\nthat maybe Python2 (required by ansible) is not present in the default location,\nbut you can use this variable to specify \"ansible_python_interpreter=/path/to/python\".\nIf you use Bosh cli v2, you also will need to define the variable\nBOSH_ENVIRONMENT in order to targe the correct director.\n\nThe environment variable BOSH_ANSIBLE_INVENTORY_VARS defines a list of\nentries which can appear as inventory variables for each VM. The list of values\nyou can use is here: https://bosh.io/docs/director-api-v1.html#list-instances-detailed,\nfor example BOSH_ANSIBLE_INVENTORY_VARS=\"state bootstrap\" will add\n\"state=started bootstrap=false\" to each inventory entry.\n\nThe environment variable BOSH_ANSIBLE_INVENTORY_INSTANCES, defines the VM name\nwill have in the inventory. If it 'dns' it will build the inventory entry with\nthe dns names given by Bosh Director (if dns is enabled in Bosh, otherwise it\nwill fallback to autogenerated names and include the ip address for each\ninstance), if 'vm_cid' (default) it will be using the name of the VM as it is\nin the IaaS. You can see all parameters supported in\nhttps://bosh.io/docs/director-api-v1.html#list-instances-detailed.\nTo force always the inclusion of the IP in the inventory, just define the\nvariable BOSH_ANSIBLE_INVENTORY_IP as a positive integer indicating the index \n(starting from 1) of the IP which will be taken (for VMs with multiple IPs),\n0 disabled the feature. The default value for BOSH_ANSIBLE_INVENTORY_IP is 1.\n\nBOSH_ANSIBLE_INVENTORY_CALL defines the way the inventoy is populated. It can\nbe 'instances'(default) or 'vms'. Instances is faster because it does not query\nthe Bosh Agents, so it gets the desired state. 'vms' will query the Bosh Agents\nin order to get the current state, so depending on the situation, it can take a\nlot of time to get the result.\n\nYou can also limit the inventory to one specific deployment by setting the value\nof the environment variable BOSH_ANSIBLE_DEPLOYMENT to the name of it.\n\n0.3.0, 2017 Jose Riguera \n```\n\nTo use it, just point the env variable `BOSH_CONFIG` to your\nbosh configuration. It will read all parameters from there.\n\n\nBy default, it will return an INI format inventory:\n```\n$ export BOSH_CONFIG=~/.bosh_config\n$ bosh-inventory > ansible-inventory\n```\n\nOr using directly with ansible:\n```\n$ export BOSH_CONFIG=~/.bosh_config\n$ export BOSH_ANSIBLE_INVENTORY_PARAMS=\"ansible_user=vcap\"\n$ export BOSH_ANSIBLE_INVENTORY_VARS=\"ansible_user=vcap\"\n$ export BOSH_ANSIBLE_INVENTORY_CALL=\"vms\"\n$ export BOSH_ANSIBLE_INVENTORY_INSTANCES=\"dns\"\n$ export BOSH_ANSIBLE_INVENTORY_IP=\"1\"\n$ ansible \"runner_z*\" -i $(which bosh-inventory) -a \"sudo /sbin/reboot\"\n```\n\nYou can also point to one deployment by using `BOSH_ANSIBLE_DEPLOYMENT`,\nand only those instances will appear:\n```\n$ export BOSH_ANSIBLE_DEPLOYMENT=concourse\n$ bosh-inventory\n[all:children]\nconcourse\n\n[concourse:children]\nweb\nworker\ndb\n\n[web]\nweb-0 ansible_host=10.10.10.64 ansible_user=vcap\n\n[worker]\nworker-0 ansible_host=10.10.10.66 ansible_user=vcap\nworker-1 ansible_host=10.10.10.67 ansible_user=vcap\n\n[db]\ndb-0 ansible_host=10.10.10.65 ansible_user=vcap\n\n```\n\nBe aware that python is not present in the default location, but you can \ndefine it by using `BOSH_ANSIBLE_INVENTORY_PARAMS=\"ansible_python_interpreter=/path/to/python\"`\n\n\n# Example: apply a playbook to all CF runners\n\nFirst of all, make sure your bosh client is targeting the correct Bosh Director!!!!\n\n```\nbosh status\n\nhttps://x.x.x.x:25555\nConfig\n /home/jriguera/.bosh_config\n\nDirector\n Name devBosh2\n URL https://x.x.x.x:25555\n Version 1.3232.6.0 (00000000)\n User admin\n UUID c4f5c583-1bc3-427f-8ded-b3f5e107f970\n CPI vsphere\n dns enabled (domain_name: microbosh)\n compiled_package_cache disabled\n snapshots disabled\n\nDeployment\n not set\n```\n\nType `bosh vms --details` to confirm!\n\n`bosh-inventory` needs some variables to work:\n\n```\n# Point to the bosh config targeting the desired director!\nexport BOSH_CONFIG=~/.bosh_config\n# Define the name of the deployment (to avoid getting other vms)\nexport BOSH_ANSIBLE_DEPLOYMENT=dev\n# Foce the use of IPs (instead of DNS names if bosh has enabled dns)\nexport BOSH_ANSIBLE_INVENTORY_IP=\"1\"\n# Define the ssh user and other ansible parameters\nexport BOSH_ANSIBLE_INVENTORY_PARAMS=\"ansible_user=nsaadmin host_key_checking=false\"\n```\n\nCheck if it is working:\n\n```\nansible runner_z1 -i /usr/local/bin/bosh-inventory -m ping\n```\n\nIf so, just run the playbook.\n\n```\nansible-playbook -i /usr/local/bin/bosh-inventory cf-warden.yml\n```\n\n## Upload to PyPI\n\n1. Create a `.pypirc` configuration file. This file holds your information for authenticating with PyPI.\n\n ```\n [distutils]\n index-servers = pypi\n\n [pypi]\n repository=https://pypi.python.org/pypi\n username=your_username\n password=your_password\n ```\n2. Login and upload it to PyPI\n\n ```\n python setup.py register -r pypi\n python setup.py sdist upload -r pypi\n ```\n\n\n# TODO\n\n* Add support for Bosh director with UAA auth\n\n\n# Author\n\nSpringer Nature Platform Engineering, Jose Riguera Lopez (jose.riguera@springer.com)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/SpringerPE/bosh-ansible-inventory/releases/tag/v0.4.4", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/SpringerPE/bosh-ansible-inventory", "keywords": "bosh ansible inventory", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "bosh-inventory", "package_url": "https://pypi.org/project/bosh-inventory/", "platform": "", "project_url": "https://pypi.org/project/bosh-inventory/", "project_urls": { "Download": "https://github.com/SpringerPE/bosh-ansible-inventory/releases/tag/v0.4.4", "Homepage": "https://github.com/SpringerPE/bosh-ansible-inventory" }, "release_url": "https://pypi.org/project/bosh-inventory/0.4.4/", "requires_dist": [ "requests (>=2.20.0)", "PyYAML (>=3.11)" ], "requires_python": "", "summary": "Ansible dynamic inventory for bosh deployments", "version": "0.4.4", "yanked": false, "yanked_reason": null }, "last_serial": 6012455, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "be8cea0388a37bd924db84ae2494e97f", "sha256": "b97edf66135efe6b2559a020248f244871110fe1071627578721dfc3fead39ae" }, "downloads": -1, "filename": "bosh_inventory-0.1.1.tar.gz", "has_sig": false, "md5_digest": "be8cea0388a37bd924db84ae2494e97f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5950, "upload_time": "2016-06-20T15:23:50", "upload_time_iso_8601": "2016-06-20T15:23:50.234080Z", "url": "https://files.pythonhosted.org/packages/cf/de/4957f18fb13483eeb689bb23aae75c08cb3ebb2d7a76d79bd2a6128971e6/bosh_inventory-0.1.1.tar.gz", "yanked": false, "yanked_reason": null } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "9a654356a2d921d2597bb6a7eb46616a", "sha256": "3686f9f9e0ba02c7b01f949a7bd1f69834ebb674144943ab3a3880bd75ce610d" }, "downloads": -1, "filename": "bosh_inventory-0.2.0.tar.gz", "has_sig": false, "md5_digest": "9a654356a2d921d2597bb6a7eb46616a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6271, "upload_time": "2016-07-12T14:23:32", "upload_time_iso_8601": "2016-07-12T14:23:32.003225Z", "url": "https://files.pythonhosted.org/packages/64/a6/04a1153348d605b6c186c65771db40e65fcc4781da2df19d5228b3269237/bosh_inventory-0.2.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "5aa2431313fb2bcf4a5412700a45d158", "sha256": "bdc5fc2e6c5856b37f7cac65d2d7bf35be359c63e61cf01adc4c2f8ecfffab03" }, "downloads": -1, "filename": "bosh_inventory-0.2.1.tar.gz", "has_sig": false, "md5_digest": "5aa2431313fb2bcf4a5412700a45d158", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6429, "upload_time": "2016-07-12T15:46:03", "upload_time_iso_8601": "2016-07-12T15:46:03.727497Z", "url": "https://files.pythonhosted.org/packages/6e/9d/a0a18673437d722fdee204b7bee2fe8dcf0a1339e98f6e2bea3569fe6f38/bosh_inventory-0.2.1.tar.gz", "yanked": false, "yanked_reason": null } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "47b49ed29b0799ed7a82590f1cbcd166", "sha256": "35a155ab1eac23738ec592e23cf0ec1f71618bdece5e30d07c2d7d5904b5f9bd" }, "downloads": -1, "filename": "bosh_inventory-0.2.2.tar.gz", "has_sig": false, "md5_digest": "47b49ed29b0799ed7a82590f1cbcd166", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7879, "upload_time": "2016-12-02T11:05:01", "upload_time_iso_8601": "2016-12-02T11:05:01.706985Z", "url": "https://files.pythonhosted.org/packages/ab/06/2d4ae6c22e318bf0520f92ba8e25b8a293513043014c4e6849a0df9f2864/bosh_inventory-0.2.2.tar.gz", "yanked": false, "yanked_reason": null } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "0e6280881aee45dedd09421246a67582", "sha256": "63cddc041214e344e12cdce38be8b7027f64a37fc212944055a3d404653532c8" }, "downloads": -1, "filename": "bosh_inventory-0.3.0.tar.gz", "has_sig": false, "md5_digest": "0e6280881aee45dedd09421246a67582", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9206, "upload_time": "2017-10-20T13:08:46", "upload_time_iso_8601": "2017-10-20T13:08:46.142195Z", "url": "https://files.pythonhosted.org/packages/69/e3/483602c69983ad1a39e12072b2591c80a5bd7ceff5744debdae3aa0b4459/bosh_inventory-0.3.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "3169038125dad905634809444691ccfa", "sha256": "f912dabd78d86cd315106a2c96ac4c985a11374f087b70777e684b5b0c897a91" }, "downloads": -1, "filename": "bosh_inventory-0.3.1.tar.gz", "has_sig": false, "md5_digest": "3169038125dad905634809444691ccfa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9453, "upload_time": "2017-10-24T13:51:30", "upload_time_iso_8601": "2017-10-24T13:51:30.177733Z", "url": "https://files.pythonhosted.org/packages/1d/57/ca0c943a80e1115760e8876ff8a09767b7d93440f64ef3dc743469b226ec/bosh_inventory-0.3.1.tar.gz", "yanked": false, "yanked_reason": null } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "b3804bd1e1e6914edcc8f30eb1d07b5c", "sha256": "e8868097d164d1fe58582e19ac09e3e4d70824903998b939e1ea1d14fa1f629b" }, "downloads": -1, "filename": "bosh_inventory-0.4.0.tar.gz", "has_sig": false, "md5_digest": "b3804bd1e1e6914edcc8f30eb1d07b5c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10419, "upload_time": "2017-10-25T12:31:14", "upload_time_iso_8601": "2017-10-25T12:31:14.468326Z", "url": "https://files.pythonhosted.org/packages/f9/27/7bd4b2481acb1edd11de6a9a4a20bbfcdd5ec9453d68ec155d2f950c40b5/bosh_inventory-0.4.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "c77244584612a34ea9d9ab5a559ac758", "sha256": "1ab8b3e04a14e29826f58f0bd8f8517509e84fd1c650abdca77ad34d3c0fc7bc" }, "downloads": -1, "filename": "bosh_inventory-0.4.1.tar.gz", "has_sig": false, "md5_digest": "c77244584612a34ea9d9ab5a559ac758", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10714, "upload_time": "2018-11-06T12:27:28", "upload_time_iso_8601": "2018-11-06T12:27:28.121454Z", "url": "https://files.pythonhosted.org/packages/87/c4/ebb37876d41754ad1cd983c1b1b4acfbe6f43342a3f0f0dde2f722470045/bosh_inventory-0.4.1.tar.gz", "yanked": false, "yanked_reason": null } ], "0.4.3": [ { "comment_text": "", "digests": { "md5": "779466aeadb38cd7d7f95dce72113507", "sha256": "2a3460a3d576cc500fdff56d997fa17f177ef511903522c8acae13ab8f9f48de" }, "downloads": -1, "filename": "bosh_inventory-0.4.3.tar.gz", "has_sig": false, "md5_digest": "779466aeadb38cd7d7f95dce72113507", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10391, "upload_time": "2019-10-22T10:47:37", "upload_time_iso_8601": "2019-10-22T10:47:37.427864Z", "url": "https://files.pythonhosted.org/packages/6f/be/1167f01ee939591a3c6264e5d3ac3e2c95dddb9c52f4519a1334d41f7c26/bosh_inventory-0.4.3.tar.gz", "yanked": false, "yanked_reason": null } ], "0.4.4": [ { "comment_text": "", "digests": { "md5": "50909c3847aa93a4842c15770cb49ba0", "sha256": "63b09ed3193a6d6d89f60c11157d0dbc370376bbdb5ee6dc3f575c44ee232a5d" }, "downloads": -1, "filename": "bosh_inventory-0.4.4-py3-none-any.whl", "has_sig": false, "md5_digest": "50909c3847aa93a4842c15770cb49ba0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9500, "upload_time": "2019-10-22T12:24:10", "upload_time_iso_8601": "2019-10-22T12:24:10.468813Z", "url": "https://files.pythonhosted.org/packages/33/49/37430223ff5fec69b94b2d132c0b7455025f2c1a076c3fbb382f8e1afe1e/bosh_inventory-0.4.4-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "58f03447a7236ada37bae1de41c78fec", "sha256": "90b8d9d765811586ab8ba7f2f0f50c9a3576dff76daf507d1f56eedbbe7161dc" }, "downloads": -1, "filename": "bosh_inventory-0.4.4.tar.gz", "has_sig": false, "md5_digest": "58f03447a7236ada37bae1de41c78fec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10389, "upload_time": "2019-10-22T12:25:01", "upload_time_iso_8601": "2019-10-22T12:25:01.131254Z", "url": "https://files.pythonhosted.org/packages/50/18/b736d21faa2bb92208c2be4f203624c1777d2e4d39b37ee33cd61bb94b4f/bosh_inventory-0.4.4.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "50909c3847aa93a4842c15770cb49ba0", "sha256": "63b09ed3193a6d6d89f60c11157d0dbc370376bbdb5ee6dc3f575c44ee232a5d" }, "downloads": -1, "filename": "bosh_inventory-0.4.4-py3-none-any.whl", "has_sig": false, "md5_digest": "50909c3847aa93a4842c15770cb49ba0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9500, "upload_time": "2019-10-22T12:24:10", "upload_time_iso_8601": "2019-10-22T12:24:10.468813Z", "url": "https://files.pythonhosted.org/packages/33/49/37430223ff5fec69b94b2d132c0b7455025f2c1a076c3fbb382f8e1afe1e/bosh_inventory-0.4.4-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "58f03447a7236ada37bae1de41c78fec", "sha256": "90b8d9d765811586ab8ba7f2f0f50c9a3576dff76daf507d1f56eedbbe7161dc" }, "downloads": -1, "filename": "bosh_inventory-0.4.4.tar.gz", "has_sig": false, "md5_digest": "58f03447a7236ada37bae1de41c78fec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10389, "upload_time": "2019-10-22T12:25:01", "upload_time_iso_8601": "2019-10-22T12:25:01.131254Z", "url": "https://files.pythonhosted.org/packages/50/18/b736d21faa2bb92208c2be4f203624c1777d2e4d39b37ee33cd61bb94b4f/bosh_inventory-0.4.4.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }