1
0
Fork 0

use local_file for ansible inventory

This commit is contained in:
Von Random 2025-02-16 22:13:44 +02:00
parent 1920af5bc4
commit 75aeaf38a9
5 changed files with 24 additions and 30 deletions

10
terraform/ansible.tf Normal file
View file

@ -0,0 +1,10 @@
resource "local_file" "ansible_inventory" {
file_permission = "0644"
filename = "${path.module}/../ansible/inventory.ini"
content = <<EOT
[all]
%{for host in yandex_compute_instance.vm~}
${trimspace("${host.name} ansible_host=${host.network_interface.0.nat_ip_address}")}
%{endfor~}
EOT
}