File tree Expand file tree Collapse file tree 8 files changed +36
-28
lines changed
playbooks/roles/terraform Expand file tree Collapse file tree 8 files changed +36
-28
lines changed Original file line number Diff line number Diff line change 77 tags :
88 - bringup
99
10- - name : Retrieve the public_ip_map from terraform
10+ - name : Retrieve the controller_ip_map from terraform
1111 delegate_to : localhost
1212 run_once : true
1313 ansible.builtin.command :
1414 chdir : " {{ topdir_path }}/terraform/{{ kdevops_terraform_provider }}"
15- cmd : " terraform output -json public_ip_map "
15+ cmd : " terraform output -json controller_ip_map "
1616 register : terraform_output
1717 changed_when : false
1818 tags :
1919 - ssh
2020
21- - name : Convert the retrieved public_ip_map into a dictionary
21+ - name : Convert the retrieved controller_ip_map into a dictionary
2222 delegate_to : localhost
2323 run_once : true
2424 ansible.builtin.set_fact :
25- public_ip_map : " {{ terraform_output.stdout | from_json }}"
25+ controller_ip_map : " {{ terraform_output.stdout | from_json }}"
2626 tags :
2727 - ssh
2828
Original file line number Diff line number Diff line change 1- Host {{ inventory_hostname }} {{ public_ip_map [inventory_hostname] }}
2- HostName {{ public_ip_map [inventory_hostname] }}
1+ Host {{ inventory_hostname }} {{ controller_ip_map [inventory_hostname] }}
2+ HostName {{ controller_ip_map [inventory_hostname] }}
33 User {{ kdevops_terraform_ssh_config_user }}
44 Port 22
55 IdentityFile {{ kdevops_terraform_ssh_config_privkey_file }}
Original file line number Diff line number Diff line change @@ -13,5 +13,5 @@ if [[ ${COUNT} -eq 1 ]]; then
1313else
1414 echo " There are ${COUNT} active terraform resources on '$1 '."
1515fi
16- terraform output public_ip_map
16+ terraform output controller_ip_map
1717exit 0
Original file line number Diff line number Diff line change 11# All generic output goes here
22
3- # Each provider's output.tf needs to define a public_ip_map . This
3+ # Each provider's output.tf needs to define a controller_ip_map . This
44# map is used to build the Ansible controller's ssh configuration.
5- # Each map entry contains the node's hostname and public IP address.
6- output "public_ip_map" {
7- description = " The public IP addresses assigned to each instance"
5+ # Each map entry contains the node's hostname and public/private IP
6+ # address.
7+ output "controller_ip_map" {
8+ description = " The IP addresses assigned to each instance"
89 value = zipmap (var. kdevops_nodes [* ], aws_eip. kdevops_eip [* ]. public_ip )
910}
1011
Original file line number Diff line number Diff line change 1- # Each provider's output.tf needs to define a public_ip_map . This
1+ # Each provider's output.tf needs to define a controller_ip_map . This
22# map is used to build the Ansible controller's ssh configuration.
3- # Each map entry contains the node's hostname and public IP address.
4- output "public_ip_map" {
5- description = " The public IP addresses assigned to each instance"
3+ # Each map entry contains the node's hostname and public/private IP
4+ # address.
5+ output "controller_ip_map" {
6+ description = " The IP addresses assigned to each instance"
67 value = zipmap (var. kdevops_nodes [* ], azurerm_public_ip. kdevops_publicip [* ]. ip_address )
78}
Original file line number Diff line number Diff line change 11# All generic output goes here
22
3- # Each provider's output.tf needs to define a public_ip_map . This
3+ # Each provider's output.tf needs to define a controller_ip_map . This
44# map is used to build the Ansible controller's ssh configuration.
5- # Each map entry contains the node's hostname and public IP address.
6- output "public_ip_map" {
7- description = " The public IP addresses assigned to each instance"
5+ # Each map entry contains the node's hostname and public/private IP
6+ # address.
7+ output "controller_ip_map" {
8+ description = " The IP addresses assigned to each instance"
89 value = zipmap (var. kdevops_nodes [* ],
910 google_compute_instance. kdevops_instance [* ]. network_interface [0 ]. access_config [0 ]. nat_ip )
1011}
Original file line number Diff line number Diff line change 11# All generic output goes here
22
3- # Each provider's output.tf needs to define a public_ip_map . This
3+ # Each provider's output.tf needs to define a controller_ip_map . This
44# map is used to build the Ansible controller's ssh configuration.
5- # Each map entry contains the node's hostname and public IP address.
6- output "public_ip_map" {
7- description = " The public IP addresses assigned to each instance"
8- value = zipmap (var. kdevops_nodes [* ], oci_core_instance. kdevops_instance . * . public_ip )
5+ # Each map entry contains the node's hostname and public/private IP
6+ # address.
7+ output "controller_ip_map" {
8+ description = " The IP addresses assigned to each instance"
9+ value = zipmap (var. kdevops_nodes [* ],
10+ var. oci_assign_public_ip ?
11+ oci_core_instance. kdevops_instance . * . public_ip :
12+ oci_core_instance. kdevops_instance . * . private_ip )
913}
Original file line number Diff line number Diff line change @@ -18,10 +18,11 @@ output "kdevops_hosts_and_ipv4" {
1818 value = data. null_data_source . group_hostnames_and_ips . * . outputs
1919}
2020
21- # Each provider's output.tf needs to define a public_ip_map . This
21+ # Each provider's output.tf needs to define a controller_ip_map . This
2222# map is used to build the Ansible controller's ssh configuration.
23- # Each map entry contains the node's hostname and public IP address.
24- output "public_ip_map" {
25- description = " The public IP addresses assigned to each instance"
23+ # Each map entry contains the node's hostname and public/private IP
24+ # address.
25+ output "controller_ip_map" {
26+ description = " The IP addresses assigned to each instance"
2627 value = zipmap (var. kdevops_nodes [* ], openstack_compute_instance_v2. kdevops_instances [* ]. access_ip_v4 )
2728}
You can’t perform that action at this time.
0 commit comments