1
0

roster.py 665 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env python
  2. import json
  3. import sys
  4. inventory = {
  5. "usa": {
  6. "children": [
  7. "southeast",
  8. ]
  9. },
  10. "southeast": {
  11. "children": [
  12. "atlanta",
  13. "raleigh",
  14. ],
  15. "vars": {
  16. "some_server": "foo.southeast.example.com",
  17. "halon_system_timeout": 30,
  18. "self_destruct_countdown": 60,
  19. "escape_pods": 2,
  20. }
  21. },
  22. "raleigh": [
  23. "host2",
  24. "host3",
  25. ],
  26. "atlanta": [
  27. "host1",
  28. "host2",
  29. ],
  30. }
  31. hostvars = {
  32. "host1": {
  33. },
  34. "host2": {
  35. },
  36. "host3": {
  37. }
  38. }
  39. if '--host' in sys.argv:
  40. print(json.dumps(hostvars.get(sys.argv[-1], {})))
  41. if '--list' in sys.argv:
  42. print(json.dumps(inventory))