From bf54e16aef51d75751ac2c3c3ea9c62de99237ab Mon Sep 17 00:00:00 2001 From: Johannes Rothe Date: Fri, 15 Sep 2023 22:02:17 +0200 Subject: [PATCH] Remove public IPs after deployment --- ansible/group_vars/all | 12 ++++++++++++ ansible/playbook.yaml | 26 +++++++++++++++----------- 2 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 ansible/group_vars/all diff --git a/ansible/group_vars/all b/ansible/group_vars/all new file mode 100644 index 0000000..d3020bc --- /dev/null +++ b/ansible/group_vars/all @@ -0,0 +1,12 @@ +terraform_vars: + location: "nbg1" + network_zone: "eu-central" + server_count: 3 + subnetwork_ip_range: "10.0.0.0/24" + lb_internal_ip: "10.0.0.100" + lb_external_ip: "167.235.105.161" + lb_service_id: 1399502 + public_ipv4: True + ssh_keys: + - "rothe.pub" + - "alt.pub" diff --git a/ansible/playbook.yaml b/ansible/playbook.yaml index 8dcf8ea..bccc09d 100644 --- a/ansible/playbook.yaml +++ b/ansible/playbook.yaml @@ -8,17 +8,7 @@ project_path: ../terraform/ state: present complex_vars: true - variables: - location: "nbg1" - network_zone: "eu-central" - server_count: 3 - subnetwork_ip_range: "10.0.0.0/24" - lb_internal_ip: "10.0.0.100" - lb_external_ip: "167.235.105.161" - lb_service_id: 1399502 - ssh_keys: - - "rothe.pub" - - "alt.pub" + variables: "{{ terraform_vars }}" register: tf_out - debug: var=tf_out @@ -78,3 +68,17 @@ - php - glusterfs - wordpress + +- name: Remove public IP + hosts: localhost + gather_facts: false + tasks: + - name: Remove public Ip + community.general.terraform: + project_path: ../terraform/ + state: present + complex_vars: true + variables: "{{ terraform_vars | combine({'public_ipv4': False}) }}" + register: tf_out + + - debug: var=tf_out