From 541b964d9380f8e70f004d1dfb33bff8107f2c8b Mon Sep 17 00:00:00 2001 From: Debora Benedetto <debora.benedetto@hpe.com> Date: Wed, 11 May 2022 16:47:02 +0200 Subject: [PATCH] Update config.yaml generation files --- controller/Orchestrator.py | 5 ++- input_file_generated/ir.json | 45 +++---------------- .../nginx_openstack/ansible/config.yaml | 4 +- .../nginx_openstack/terraform/config.yaml | 7 +-- .../nginx_openstack/config.yaml | 2 + .../nginx_openstack/terraform/main.tf | 44 ------------------ 6 files changed, 15 insertions(+), 92 deletions(-) diff --git a/controller/Orchestrator.py b/controller/Orchestrator.py index 5048bfd..8d532b8 100644 --- a/controller/Orchestrator.py +++ b/controller/Orchestrator.py @@ -36,8 +36,8 @@ def choose_plugin(parameters, template_generated_folder): metadata_root_folder["iac"].append("terraform") input_data = step["data"] iac_output_folder = template_generated_folder + "terraform" - plugin_metadata = {"input": ["openstack_username", "openstack_password", "openstack_auth_url"], - "output": [], "engine": "terraform"} + # plugin_metadata = {"input": ["openstack_username", "openstack_password", "openstack_auth_url"], + plugin_metadata = {"input": [], "output": [], "engine": "terraform"} save_file(plugin_metadata, iac_output_folder + "/config.yaml", output_extensions="YAML") TerraformPlugin.create_files(input_data, iac_output_folder) save_file(metadata_root_folder, template_generated_folder + "/config.yaml", output_extensions="YAML") @@ -49,6 +49,7 @@ def save_file(data, file_path, output_extensions="json"): file = open(file_path, "w") if isinstance(data, dict) and output_extensions == "YAML": data = yaml.dump(data) + data = "---\n" + data + "..." if isinstance(data, dict): data = json.dumps(data, indent=2, sort_keys=True) print(data) diff --git a/input_file_generated/ir.json b/input_file_generated/ir.json index bb2e1c4..d6ad467 100644 --- a/input_file_generated/ir.json +++ b/input_file_generated/ir.json @@ -3,46 +3,13 @@ "steps": [ { "data": { - "computingGroup": [ + "credentials": [ { - "cidr": [ - "0.0.0.0/0" - ], - "fromPort": -1, - "kind": "EGRESS", - "name": "out_all", - "protocol": "-1", - "toPort": -1 - }, - { - "cidr": [ - "0.0.0.0/0" - ], - "fromPort": 80, - "kind": "INGRESS", - "name": "http", - "protocol": "tcp", - "toPort": 80 - }, - { - "cidr": [ - "0.0.0.0/0" - ], - "fromPort": 443, - "kind": "INGRESS", - "name": "https", - "protocol": "tcp", - "toPort": 443 - }, - { - "cidr": [ - "0.0.0.0/0" - ], - "fromPort": 22, - "kind": "INGRESS", - "name": "ssh", - "protocol": "tcp", - "toPort": 22 + "algorithm": "RSA", + "bits": 4096, + "keyfile": "/home/user1/.ssh/openstack.key", + "name": "ssh_key", + "user": "ubuntu" } ], "networks": [ diff --git a/output_file_example/nginx_openstack/ansible/config.yaml b/output_file_example/nginx_openstack/ansible/config.yaml index c5ca1ce..f5b9945 100644 --- a/output_file_example/nginx_openstack/ansible/config.yaml +++ b/output_file_example/nginx_openstack/ansible/config.yaml @@ -1,5 +1,5 @@ --- -input: ~ -output: ~ +input: [] +output: [] engine: ansible ... diff --git a/output_file_example/nginx_openstack/terraform/config.yaml b/output_file_example/nginx_openstack/terraform/config.yaml index d0ab1b8..54f446c 100644 --- a/output_file_example/nginx_openstack/terraform/config.yaml +++ b/output_file_example/nginx_openstack/terraform/config.yaml @@ -1,8 +1,5 @@ --- -input: - - openstack_username - - openstack_password - - openstack_auth_url -output: ~ engine: terraform +input: [] +output: [] ... diff --git a/output_files_generated/nginx_openstack/config.yaml b/output_files_generated/nginx_openstack/config.yaml index cb3ec8c..76cd990 100644 --- a/output_files_generated/nginx_openstack/config.yaml +++ b/output_files_generated/nginx_openstack/config.yaml @@ -1,2 +1,4 @@ +--- iac: - terraform +... \ No newline at end of file diff --git a/output_files_generated/nginx_openstack/terraform/main.tf b/output_files_generated/nginx_openstack/terraform/main.tf index 86d3b83..d2458c3 100644 --- a/output_files_generated/nginx_openstack/terraform/main.tf +++ b/output_files_generated/nginx_openstack/terraform/main.tf @@ -98,47 +98,3 @@ resource "openstack_networking_router_interface_v2" "net1_router_interface" { subnet_id = openstack_networking_subnet_v2.net1_subnet.id } -resource "openstack_compute_secgroup_v2" "out_all" { - name = "out_all" - description = "Security group rule for port -1" - rule { - from_port = -1 - to_port = -1 - ip_protocol = "-1" - cidr = "0.0.0.0/0" - } -} - -resource "openstack_compute_secgroup_v2" "http" { - name = "http" - description = "Security group rule for port 80" - rule { - from_port = 80 - to_port = 80 - ip_protocol = "tcp" - cidr = "0.0.0.0/0" - } -} - -resource "openstack_compute_secgroup_v2" "https" { - name = "https" - description = "Security group rule for port 443" - rule { - from_port = 443 - to_port = 443 - ip_protocol = "tcp" - cidr = "0.0.0.0/0" - } -} - -resource "openstack_compute_secgroup_v2" "ssh" { - name = "ssh" - description = "Security group rule for port 22" - rule { - from_port = 22 - to_port = 22 - ip_protocol = "tcp" - cidr = "0.0.0.0/0" - } -} - -- GitLab