From 46411b869448f857bf073335f528fb3125110fb0 Mon Sep 17 00:00:00 2001 From: Debora Benedetto <debora.benedetto@hpe.com> Date: Fri, 5 Aug 2022 16:49:06 +0200 Subject: [PATCH] change template vm_name into vm.infrastructural_element_name --- .../nginx_openstack/nginx/config.yaml | 2 +- .../nginx_openstack/nginx/inventory.j2 | 2 +- .../piacere_monitoring/config.yaml | 2 +- .../piacere_monitoring/inventory.j2 | 2 +- .../nginx_openstack/terraform/config.yaml | 2 +- .../nginx_openstack/terraform/main.tf | 16 ++++++++-------- .../nginx_openstack/terraform/output.tf | 2 +- templates/ansible/ubuntu/config.tpl | 2 +- templates/ansible/ubuntu/inventory.tpl | 2 +- templates/terraform/open_stack/config.tpl | 2 +- .../terraform/open_stack/virtual_machine_out.tpl | 2 +- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/output_files_generated/nginx_openstack/nginx/config.yaml b/output_files_generated/nginx_openstack/nginx/config.yaml index 7778c71..dff8ba5 100644 --- a/output_files_generated/nginx_openstack/nginx/config.yaml +++ b/output_files_generated/nginx_openstack/nginx/config.yaml @@ -1,7 +1,7 @@ --- input: - - instance_ip_nginx-host + - instance_ip_vm1 - instance_server_private_key_ssh_key output: [] engine: ansible diff --git a/output_files_generated/nginx_openstack/nginx/inventory.j2 b/output_files_generated/nginx_openstack/nginx/inventory.j2 index b95b2c1..c869825 100644 --- a/output_files_generated/nginx_openstack/nginx/inventory.j2 +++ b/output_files_generated/nginx_openstack/nginx/inventory.j2 @@ -1,7 +1,7 @@ [servers_for_nginx] -{{ instance_ip_nginx-host }} +{{ instance_ip_vm1 }} [servers_for_nginx:vars] ansible_connection=ssh diff --git a/output_files_generated/nginx_openstack/piacere_monitoring/config.yaml b/output_files_generated/nginx_openstack/piacere_monitoring/config.yaml index 7778c71..dff8ba5 100644 --- a/output_files_generated/nginx_openstack/piacere_monitoring/config.yaml +++ b/output_files_generated/nginx_openstack/piacere_monitoring/config.yaml @@ -1,7 +1,7 @@ --- input: - - instance_ip_nginx-host + - instance_ip_vm1 - instance_server_private_key_ssh_key output: [] engine: ansible diff --git a/output_files_generated/nginx_openstack/piacere_monitoring/inventory.j2 b/output_files_generated/nginx_openstack/piacere_monitoring/inventory.j2 index 2eaf266..fda17b3 100644 --- a/output_files_generated/nginx_openstack/piacere_monitoring/inventory.j2 +++ b/output_files_generated/nginx_openstack/piacere_monitoring/inventory.j2 @@ -1,7 +1,7 @@ [servers_for_piacere_monitoring] -{{ instance_ip_nginx-host }} +{{ instance_ip_vm1 }} [servers_for_piacere_monitoring:vars] ansible_connection=ssh diff --git a/output_files_generated/nginx_openstack/terraform/config.yaml b/output_files_generated/nginx_openstack/terraform/config.yaml index 3262fae..21942c2 100644 --- a/output_files_generated/nginx_openstack/terraform/config.yaml +++ b/output_files_generated/nginx_openstack/terraform/config.yaml @@ -11,6 +11,6 @@ output: - instance_server_public_key_ssh_key - instance_server_private_key_ssh_key - - instance_ip_nginx-host + - instance_ip_vm1 ... diff --git a/output_files_generated/nginx_openstack/terraform/main.tf b/output_files_generated/nginx_openstack/terraform/main.tf index 3ceb8fa..30cac93 100644 --- a/output_files_generated/nginx_openstack/terraform/main.tf +++ b/output_files_generated/nginx_openstack/terraform/main.tf @@ -91,14 +91,6 @@ resource "openstack_networking_router_interface_v2" "net1_router_interface" { -# Create ssh keys -resource "openstack_compute_keypair_v2" "ssh_key" { - name = "user1" - # public_key = "user1" -} - - - # CREATING SECURITY_GROUP resource "openstack_compute_secgroup_v2" "icmp" { @@ -146,3 +138,11 @@ resource "openstack_compute_secgroup_v2" "ssh" { } + + +# Create ssh keys +resource "openstack_compute_keypair_v2" "ssh_key" { + name = "user1" + # public_key = "user1" +} + diff --git a/output_files_generated/nginx_openstack/terraform/output.tf b/output_files_generated/nginx_openstack/terraform/output.tf index 6fcb19b..5c4fe27 100644 --- a/output_files_generated/nginx_openstack/terraform/output.tf +++ b/output_files_generated/nginx_openstack/terraform/output.tf @@ -8,7 +8,7 @@ output "instance_server_private_key_ssh_key" { value = openstack_compute_keypair_v2.ssh_key.private_key } -output "instance_ip_nginx-host" { +output "instance_ip_vm1" { value = openstack_compute_floatingip_associate_v2.vm1_floating_ip_association.floating_ip } diff --git a/templates/ansible/ubuntu/config.tpl b/templates/ansible/ubuntu/config.tpl index 015123e..91ddcce 100644 --- a/templates/ansible/ubuntu/config.tpl +++ b/templates/ansible/ubuntu/config.tpl @@ -15,7 +15,7 @@ #} --- input: - - instance_ip_{{ node.vm_name }} + - instance_ip_{{ node.infra_element_name }} - instance_server_private_key_{{ node.credentials }} output: [] engine: ansible diff --git a/templates/ansible/ubuntu/inventory.tpl b/templates/ansible/ubuntu/inventory.tpl index 9f59b2a..2c64481 100644 --- a/templates/ansible/ubuntu/inventory.tpl +++ b/templates/ansible/ubuntu/inventory.tpl @@ -15,7 +15,7 @@ #} [{{ "servers_for_" ~ name }}] -{% raw %}{{ instance_ip_{% endraw %}{{ node.vm_name }} {% raw %}}}{% endraw %} +{% raw %}{{ instance_ip_{% endraw %}{{ node.infra_element_name }} {% raw %}}}{% endraw %} [{{ "servers_for_" ~ name }}:vars] ansible_connection=ssh diff --git a/templates/terraform/open_stack/config.tpl b/templates/terraform/open_stack/config.tpl index a50ebb7..9aa85ac 100644 --- a/templates/terraform/open_stack/config.tpl +++ b/templates/terraform/open_stack/config.tpl @@ -25,6 +25,6 @@ output: {% for vm in vms %} - instance_server_public_key_{{ vm.credentials }} - instance_server_private_key_{{ vm.credentials }} - - instance_ip_{{ vm.vm_name }} + - instance_ip_{{ vm.infra_element_name }} {% endfor %} ... diff --git a/templates/terraform/open_stack/virtual_machine_out.tpl b/templates/terraform/open_stack/virtual_machine_out.tpl index 8f5f19e..3b25ad5 100644 --- a/templates/terraform/open_stack/virtual_machine_out.tpl +++ b/templates/terraform/open_stack/virtual_machine_out.tpl @@ -22,6 +22,6 @@ output "instance_server_private_key_{{ credentials }}" { value = openstack_compute_keypair_v2.{{ credentials }}.private_key } -output "instance_ip_{{ vm_name }}" { +output "instance_ip_{{ infra_element_name }}" { value = openstack_compute_floatingip_associate_v2.{{ infra_element_name ~ "_floating_ip_association" }}.floating_ip } \ No newline at end of file -- GitLab