{"id":25649792,"url":"https://github.com/openchami/ansible-smd-inventory","last_synced_at":"2026-06-14T18:34:49.849Z","repository":{"id":243302385,"uuid":"811965754","full_name":"OpenCHAMI/ansible-smd-inventory","owner":"OpenCHAMI","description":"Dynamic inventory plugin for Ansible, which pulls available nodes from SMD","archived":false,"fork":false,"pushed_at":"2024-06-18T20:55:04.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-23T14:37:09.951Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenCHAMI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-07T17:00:00.000Z","updated_at":"2024-06-18T20:55:07.000Z","dependencies_parsed_at":"2025-02-23T14:44:05.815Z","dependency_job_id":null,"html_url":"https://github.com/OpenCHAMI/ansible-smd-inventory","commit_stats":null,"previous_names":["openchami/ansible-smd-inventory"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/OpenCHAMI/ansible-smd-inventory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCHAMI%2Fansible-smd-inventory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCHAMI%2Fansible-smd-inventory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCHAMI%2Fansible-smd-inventory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCHAMI%2Fansible-smd-inventory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenCHAMI","download_url":"https://codeload.github.com/OpenCHAMI/ansible-smd-inventory/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCHAMI%2Fansible-smd-inventory/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34333806,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-23T14:33:54.273Z","updated_at":"2026-06-14T18:34:49.819Z","avatar_url":"https://github.com/OpenCHAMI.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ansible Dynamic Inventory via SMD\n\nThis is an Ansible plugin which implements dynamic inventory, by integrating with [smd](https://github.com/OpenCHAMI/smd) (which maintains its own list of nodes and their states).\nAs a result, the the need to explicitly maintain an Ansible inventory is removed, and smd becomes the relevant source of truth.\n\n\n## Demo\n\nA traditional call to the smd API, via curl:\n```sh\n$ curl -s 'https://localhost:27779/hsm/v2/State/Components?type=Node\u0026role=Compute\u0026state=Ready' | jq\n{\n  \"Components\": [\n    {\n      \"ID\": \"x1000c1s7b8n0\",\n      \"Type\": \"Node\",\n      \"State\": \"Ready\",\n      \"Flag\": \"OK\",\n      \"Enabled\": true,\n      \"Role\": \"Compute\",\n      \"NID\": 9,\n      \"Arch\": \"X86\"\n    },\n    ...\n    {\n      \"ID\": \"x1000c1s7b1n0\",\n      \"Type\": \"Node\",\n      \"State\": \"Ready\",\n      \"Flag\": \"OK\",\n      \"Enabled\": true,\n      \"Role\": \"Compute\",\n      \"NID\": 2,\n      \"Arch\": \"X86\"\n    }\n  ]\n}\n```\n\nExposing smd components as native Ansible inventory, via this plugin:\n```sh\n$ ansible-inventory --graph -i smd_plugin_inventory.yml -v\n...\nUsing inventory plugin 'smd_inventory' to process inventory source '/home/lritzdorf/smd_plugin_inventory.yml'\nParsed smd component filters {'type': 'Node', 'role': 'Compute', 'state': 'Ready'}\nAccess token loaded from $ACCESS_TOKEN\nRetrieving inventory from smd...\nsmd component query returned 8 components\nsmd membership query returned 8 components\nFlattened membership to 0 partitions, 0 groups\nPopulating Ansible inventory...\n@all:\n  |--@ungrouped:\n  |  |--nid009\n  |  |--nid008\n  |  |--nid007\n  |  |--nid006\n  |  |--nid005\n  |  |--nid004\n  |  |--nid003\n  |  |--nid002\n```\n\n\n## Features\n\nDuring inventory creation, additional data from smd is exposed to Ansible for possible use in playbooks and the like.\n\n### Partitions and Groups\n\nComponent partitions and groups from smd are exposed as Ansible host groups.\nAnsible groups corresponding to smd partitions are prefixed with `prt_`, while Ansible groups corresponding to smd groups are prefixed with `grp_`.\n\nThe following inventory was created from an smd instance with partitions `p1` and `p2`, and groups `squares`, `rectangles`, and `circles`:\n```sh\n$ ansible-inventory --graph -i smd_plugin_inventory.yml\n@all:\n  |--@ungrouped:\n  |--@prt_p2:\n  |  |--nid009\n  |  |--nid008\n  |  |--nid007\n  |  |--nid006\n  |--@prt_p1:\n  |  |--nid005\n  |  |--nid004\n  |  |--nid003\n  |  |--nid002\n  |--@grp_squares:\n  |  |--nid007\n  |  |--nid006\n  |--@grp_circles:\n  |  |--nid009\n  |--@grp_rectangles:\n  |  |--nid008\n  |  |--nid007\n  |  |--nid006\n```\n\n### smd Component Data\n\nEach node's smd component, along with its partition/group memberships, is stored under the `smd_component` host variable:\n```sh\n$ ansible-inventory --list -i smd_plugin_inventory.yml\n{\n    \"_meta\": {\n        \"hostvars\": {\n            \"nid002\": {\n                \"smd_component\": {\n                    \"Arch\": \"X86\",\n                    \"Enabled\": true,\n                    \"Flag\": \"OK\",\n                    \"ID\": \"x1000c1s7b1n0\",\n                    \"NID\": 2,\n                    \"Role\": \"Compute\",\n                    \"State\": \"Ready\",\n                    \"Type\": \"Node\",\n                    \"groupLabels\": [],\n                    \"id\": \"x1000c1s7b1n0\",\n                    \"partitionName\": \"p1\"\n                }\n            },\n            \"nid003\": {\n                \"smd_component\": {\n                    \"Arch\": \"X86\",\n                    \"Enabled\": true,\n                    \"Flag\": \"OK\",\n                    \"ID\": \"x1000c1s7b2n0\",\n                    \"NID\": 3,\n                    \"Role\": \"Compute\",\n                    \"State\": \"Ready\",\n                    \"Type\": \"Node\",\n                    \"groupLabels\": [],\n                    \"id\": \"x1000c1s7b2n0\",\n                    \"partitionName\": \"p1\"\n                }\n            },\n            ...\n```\n\n\n## Example Inventory\n\nThe following inventory file was used to create the examples above:\n```yml\n---\nplugin: smd_inventory\nhsm_url: http://localhost:27779\n#filter_by: \"{'type': 'Node', 'role': 'Compute', 'state': 'Ready'}\"\n#access_token_envvar: ACCESS_TOKEN\nnid_length: 3\n```\nCommented lines are default values, and will be auto-populated by Ansible if omitted.\n\n\n## Installation\n\nThis plugin can be installed locally by copying the main Python script (`smd_inventory.py`) into one of the following directories:\n- The system-wide inventory plugin path (found via `ansible-config dump | grep INVENTORY_PLUGIN_PATH`)\n- The relevant user's inventory plugin path (also found via `ansible-config dump | grep INVENTORY_PLUGIN_PATH`; usually inside of `~/.ansible/`)\n- An alternate plugin directory, defined by your Ansible configuration (see the [relevant Ansible docs](https://docs.ansible.com/ansible/latest/dev_guide/developing_locally.html#adding-a-non-module-plugin-locally-outside-of-a-collection) for details)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenchami%2Fansible-smd-inventory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenchami%2Fansible-smd-inventory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenchami%2Fansible-smd-inventory/lists"}