{ "info": { "author": "Guido G\u00fcnther", "author_email": "agx@sigxcpu.org", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 2" ], "description": "foreman_ansible_inventory\n=========================\n\n[![Build Status](https://travis-ci.org/theforeman/foreman_ansible_inventory.svg?branch=master)](https://travis-ci.org/theforeman/foreman_ansible_inventory)\n\nThis script can be used as an Ansible dynamic inventory[1].\nThe connection parameters are set up via a configuration\nfile *foreman.ini*. *foreman.ini* is found using the following\norder of discovery.\n\n * `/etc/ansible/foreman.ini`\n * Current directory of your inventory script.\n * `FOREMAN_INI_PATH` environment variable.\n\n## Variables and Parameters\n\nThe data returned from Foreman for each host is stored in a foreman\nhash so they're available as *host_vars* along with the parameters\nof the host and it's hostgroups:\n\n \"foo.example.com\": {\n \"foreman\": {\n \"architecture_id\": 1,\n \"architecture_name\": \"x86_64\",\n \"build\": false,\n \"build_status\": 0,\n \"build_status_label\": \"Installed\",\n \"capabilities\": [\n \"build\",\n \"image\"\n ],\n \"compute_profile_id\": 4,\n \"hostgroup_name\": \"webtier/myapp\",\n \"id\": 70,\n \"image_name\": \"debian8.1\",\n ...\n \"uuid\": \"50197c10-5ebb-b5cf-b384-a1e203e19e77\"\n },\n \"foreman_params\": {\n \"testparam1\": \"foobar\",\n \"testparam2\": \"small\",\n ...\n }\n\nand could therefore be used in Ansible like:\n\n - debug: msg=\"From Foreman host {{ foreman['uuid'] }}\"\n\nWhich yields\n\n TASK [test_foreman : debug] ****************************************************\n ok: [foo.example.com] => {\n \"msg\": \"From Foreman host 50190bd1-052a-a34a-3c9c-df37a39550bf\"\n }\n\n## Automatic Ansible groups\n\nThe inventory will provide a set of groups, by default prefixed by\n'foreman_'. If you want to customize this prefix, change the\ngroup_prefix option in /etc/ansible/foreman.ini. The rest of this\nguide will assume the default prefix of 'foreman'\n\nThe hostgroup, location, organization, content view, and lifecycle\nenvironment of each host are created as Ansible groups with a \nforeman_ prefix, all lowercase and problematic parameters \nremoved. So e.g. the foreman hostgroup\n\n myapp / webtier / datacenter1\n\nwould turn into the Ansible group:\n\n foreman_hostgroup_myapp_webtier_datacenter1\n\nFurthermore Ansible groups can be created on the fly using the\n*group_patterns* variable in *foreman.ini* so that you can build up\nhierarchies using parameters on the hostgroup and host variables.\n\nLets assume you have a host that is built using this nested hostgroup:\n\n myapp / webtier / datacenter1\n\nand each of the hostgroups defines a parameters respectively:\n\n myapp: app_param = myapp\n webtier: tier_param = webtier\n datacenter1: dc_param = datacenter1\n\nThe host is also in a subnet called \"mysubnet\" and provisioned via an image\nthen *group_patterns* like:\n\n [ansible]\n group_patterns = [\"{app_param}-{tier_param}-{dc_param}\",\n \"{app_param}-{tier_param}\",\n \"{app_param}\",\n \"{subnet_name}-{provision_method}\"]\n\nwould put the host into the additional Ansible groups:\n\n - myapp-webtier-datacenter1\n - myapp-webtier\n - myapp\n - mysubnet-image\n\nby recursively resolving the hostgroups, getting the parameter keys\nand values and doing a Python *string.format()* like replacement on\nit.\n\n[1]: http://docs.ansible.com/intro_dynamic_inventory.html\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "GPLv3+", "maintainer": "", "maintainer_email": "", "name": "foreman-ansible-inventory", "package_url": "https://pypi.org/project/foreman-ansible-inventory/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/foreman-ansible-inventory/", "project_urls": null, "release_url": "https://pypi.org/project/foreman-ansible-inventory/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "Ansible dynamic inventory that queries the Foreman", "version": "0.0.4" }, "last_serial": 2370745, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "684115832faf799b4d908832108f1031", "sha256": "8a8030334b6c5bbfc74aec4efdcd391ac6688b3d5575a3019088afed69e4999e" }, "downloads": -1, "filename": "foreman_ansible_inventory-0.0.1.tar.gz", "has_sig": false, "md5_digest": "684115832faf799b4d908832108f1031", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5261, "upload_time": "2016-02-14T17:03:16", "url": "https://files.pythonhosted.org/packages/03/7a/9e5f5866423d8989dd3fa13181051826effe8853e19d02bb7614702233b9/foreman_ansible_inventory-0.0.1.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "0ca17e02e297f1d144d548922b61e00b", "sha256": "fb2b02620dccffba59e14c3dbda0dff9f2eb9b82ad313d98cbd829940e6a26f9" }, "downloads": -1, "filename": "foreman_ansible_inventory-0.0.3.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "0ca17e02e297f1d144d548922b61e00b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4185, "upload_time": "2016-03-23T18:55:54", "url": "https://files.pythonhosted.org/packages/de/b4/8f08e6ebe13881bc5e2fc6aa9721e891a0d9f940fa934412d81a8217b2ea/foreman_ansible_inventory-0.0.3.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "b56679eb95f2156d2dbf251d7dcf829b", "sha256": "7cdd6c77212ac35c7c1b1d06462aff7c17e36f9e7f06ad157f9582d844280d69" }, "downloads": -1, "filename": "foreman_ansible_inventory-0.0.3.tar.gz", "has_sig": false, "md5_digest": "b56679eb95f2156d2dbf251d7dcf829b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17418, "upload_time": "2016-03-23T18:56:43", "url": "https://files.pythonhosted.org/packages/6f/27/6027b14c0ca30ecfd165d297853c8e20de81e27dedfd221b6f48c1e26dbd/foreman_ansible_inventory-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "36ddfb50fc7426f97a760c91cfb21338", "sha256": "bd4ac3fc1c859571df1b2ead6292258de80f6c0de9520d20f2f687e53f3a4b1d" }, "downloads": -1, "filename": "foreman_ansible_inventory-0.0.4-py2-none-any.whl", "has_sig": false, "md5_digest": "36ddfb50fc7426f97a760c91cfb21338", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6367, "upload_time": "2016-09-29T10:21:03", "url": "https://files.pythonhosted.org/packages/5a/f8/60946e2d187f779e4d7d63fdd762cb8c1a8334c0978011223159a278e36b/foreman_ansible_inventory-0.0.4-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "06c29a41f165e8488978ecf46188f07a", "sha256": "6ba4658ed1ad5561f12139ec3f7b4c9784cdf6e5e392a0120e4e434ac60a28cb" }, "downloads": -1, "filename": "foreman_ansible_inventory-0.0.4.tar.gz", "has_sig": false, "md5_digest": "06c29a41f165e8488978ecf46188f07a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19469, "upload_time": "2016-09-29T10:21:06", "url": "https://files.pythonhosted.org/packages/ca/d3/4d885e19cfc4f0d607129d2b0ef171b9a02f7cc3a645055acc588a230433/foreman_ansible_inventory-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "36ddfb50fc7426f97a760c91cfb21338", "sha256": "bd4ac3fc1c859571df1b2ead6292258de80f6c0de9520d20f2f687e53f3a4b1d" }, "downloads": -1, "filename": "foreman_ansible_inventory-0.0.4-py2-none-any.whl", "has_sig": false, "md5_digest": "36ddfb50fc7426f97a760c91cfb21338", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6367, "upload_time": "2016-09-29T10:21:03", "url": "https://files.pythonhosted.org/packages/5a/f8/60946e2d187f779e4d7d63fdd762cb8c1a8334c0978011223159a278e36b/foreman_ansible_inventory-0.0.4-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "06c29a41f165e8488978ecf46188f07a", "sha256": "6ba4658ed1ad5561f12139ec3f7b4c9784cdf6e5e392a0120e4e434ac60a28cb" }, "downloads": -1, "filename": "foreman_ansible_inventory-0.0.4.tar.gz", "has_sig": false, "md5_digest": "06c29a41f165e8488978ecf46188f07a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19469, "upload_time": "2016-09-29T10:21:06", "url": "https://files.pythonhosted.org/packages/ca/d3/4d885e19cfc4f0d607129d2b0ef171b9a02f7cc3a645055acc588a230433/foreman_ansible_inventory-0.0.4.tar.gz" } ] }