Guest User

Untitled

a guest
Dec 26th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. import yaml
  2.  
  3. def inventory():
  4.  
  5. ip_list = {}
  6. ip_list['10.25.152.200'] = None
  7. ip_list['10.25.152.201'] = None
  8.  
  9. inventory = dict(all = dict (
  10. children = dict(
  11. qa = dict(
  12. hosts = ip_list,
  13. vars = dict(
  14. ansible_ssh_user = 'foo',
  15. ansible_ssh_pass = 'bar'
  16. )
  17. )
  18. )
  19. )
  20. )
  21.  
  22. return inventory
  23.  
  24. def main():
  25. with open('/tmp/inventory.yml', 'w') as outfile:
  26. yaml.dump(inventory(), outfile, default_flow_style=False)
  27.  
  28. if __name__ == "__main__":
  29. main()
Add Comment
Please, Sign In to add comment