|
|
@@ -52,12 +52,26 @@ output "ip" { |
|
|
|
resource "local_file" "write_address" { |
|
|
|
|
|
|
|
content = <<-EOT |
|
|
|
[all] |
|
|
|
%{ for idx, s in libvirt_domain.domains.*.network_interface.0 ~} |
|
|
|
${s.hostname} ansible_host=${s.addresses.0} index=${idx} |
|
|
|
# two first domain is controller domain |
|
|
|
[controller] |
|
|
|
%{ for idx, s in slice(libvirt_domain.domains, 0, 2) ~} |
|
|
|
%{ if length(s.network_interface.0.addresses) > 0 ~} |
|
|
|
${s.network_interface.0.hostname} ansible_host=${s.network_interface.0.addresses.0} index=${idx} |
|
|
|
%{ endif ~} |
|
|
|
%{ endfor ~} |
|
|
|
# next domain is worker domain |
|
|
|
[worker] |
|
|
|
%{ for idx, s in slice(libvirt_domain.domains, 2, length(libvirt_domain.domains)) ~} |
|
|
|
%{ if length(s.network_interface.0.addresses) > 0 ~} |
|
|
|
${s.network_interface.0.hostname} ansible_host=${s.network_interface.0.addresses.0} index=${idx} |
|
|
|
%{ endif ~} |
|
|
|
%{ endfor ~} |
|
|
|
|
|
|
|
[all:children] |
|
|
|
controller |
|
|
|
worker |
|
|
|
[all:vars] |
|
|
|
ansible_ssh_common_args='-o StrictHostKeyChecking=no' |
|
|
|
ansible_ssh_extra_args='-o StrictHostKeyChecking=no' |
|
|
|
EOT |
|
|
|
|
|
|
|
filename = "../applications/stack_address.toml" |
|
|
|