You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 line
766B

  1. output "ansible_inventory" {
  2. value = {
  3. all = {
  4. hosts = {
  5. for hostname,host in var.vm_hosts: hostname => {}
  6. }
  7. children = merge(
  8. {
  9. for group in local.vm_groups: group => {
  10. hosts = {
  11. for hostname, host in local.vm_hosts_with_groups:
  12. hostname => {}
  13. if contains(host.groups,group)
  14. }
  15. }
  16. },{
  17. for providername, provider in local.providers: "provider_${providername}" => {
  18. hosts = {
  19. for hostname, host in var.vm_hosts:
  20. hostname => local.providers[host.provider].hostvars[hostname]
  21. if host.provider == providername
  22. }
  23. }
  24. }
  25. )
  26. }
  27. }
  28. }