Add MAAS dynamic inventory script#1337
Conversation
Adds a Python script that queries the MAAS REST API to auto-discover deployed machines and map MAAS tags to Ansible groups. Tag a VM with slurm-master in MAAS and it appears in the [slurm-master] group. - scripts/maas_inventory.py: inventory script (Python stdlib only) - config.example/maas-inventory.yml: example configuration - docs/pxe/maas.md: added Dynamic Inventory section Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Douglas Holt <dholt@nvidia.com>
206657e to
a9e4b02
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a Python-based dynamic inventory script for MAAS (Metal as a Service) integration with DeepOps. The script queries the MAAS REST API to auto-discover deployed machines and maps MAAS tags to Ansible groups, eliminating the need to manually edit inventory files when machines are provisioned or reassigned.
Changes:
- New dynamic inventory script with OAuth1 authentication and zero external dependencies
- Comprehensive documentation for MAAS integration including setup, configuration, and usage examples
- Example configuration file following DeepOps conventions
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| scripts/maas_inventory.py | Dynamic inventory script that queries MAAS API and generates Ansible inventory based on machine tags |
| docs/MAAS.md | Documentation for MAAS dynamic inventory including prerequisites, setup instructions, tag-based group assignment, configuration reference, and host variables |
| config.example/maas-inventory.yml | Example configuration file with MAAS API settings, SSH options, and network preferences |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… CodeQL alert - Remove hardcoded StrictHostKeyChecking=no from SSH args (security) - Return empty dict for --host since _meta provides all hostvars (perf) - Remove URL from error message to avoid CodeQL sensitive data alert Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Douglas Holt <dholt@nvidia.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
etcd is a separate group in the static inventory, not a child of kube-master. Users should tag etcd nodes explicitly rather than having all kube-master nodes implicitly join etcd. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Douglas Holt <dholt@nvidia.com>
…C entry - Update pre-requisites from Ubuntu 18.04 to 22.04/24.04 - Note MAAS 2.8 is original version, current is 3.x - Update maas_repo PPA from 2.8 to 3.5 - Add Dynamic Inventory section to table of contents Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Douglas Holt <dholt@nvidia.com>
Summary
scripts/maas_inventory.py) that queries the MAAS REST API to auto-discover deployed machines and map MAAS tags to Ansible groupsslurm-masterin MAAS and it appears in the[slurm-master]group — no manual inventory editing neededconfig.example/maas-inventory.yml, private config inconfig/maas-inventory.yml(gitignored)docs/pxe/maas.mdFeatures
slurm-cluster,k8s-cluster, etc.)Test plan
--listreturns correct JSON inventory from live MAAS serveransible all -m pingsucceeds through dynamic inventoryansible-playbook --check ngc-ready-server.ymlcompletes (63 ok, 0 failed)🤖 Generated with Claude Code