feat: write to ansible hosts
This commit is contained in:
parent
0919a9b40c
commit
ec721711ca
|
@ -0,0 +1,8 @@
|
|||
live:
|
||||
hosts:
|
||||
ubuntu:
|
||||
ansible_host: ${ubuntu_ip}
|
||||
ansible_user: atm
|
||||
debian:
|
||||
ansible_host: ${debian_ip}
|
||||
ansible_user: atm
|
|
@ -145,3 +145,13 @@ output "ubuntu_ip" {
|
|||
output "debian_ip" {
|
||||
value = length(libvirt_domain.domain-debian-ansible-playground.network_interface[0].addresses) > 0 ? libvirt_domain.domain-debian-ansible-playground.network_interface[0].addresses[0] : ""
|
||||
}
|
||||
|
||||
resource "local_file" "hosts_yml" {
|
||||
content = templatefile("./templates/hosts.yml.tpl",
|
||||
{
|
||||
debian_ip = "${length(libvirt_domain.domain-debian-ansible-playground.network_interface[0].addresses) > 0 ? libvirt_domain.domain-debian-ansible-playground.network_interface[0].addresses[0] : ""}"
|
||||
ubuntu_ip = "${length(libvirt_domain.domain-ubuntu.network_interface[0].addresses) > 0 ? libvirt_domain.domain-ubuntu.network_interface[0].addresses[0] : ""}"
|
||||
})
|
||||
|
||||
filename = "./ansible/inventory/hosts.yml"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue