From 9bdc9d9a5a13347f43efd1065ec1665305926d25 Mon Sep 17 00:00:00 2001 From: jmiskani <122885751+jmiskani@users.noreply.github.com> Date: Tue, 19 Nov 2024 18:47:00 +0100 Subject: [PATCH] SFS Turbo apimon (#101) SFS Turbo apimon Apimon playbook for SFS Turbo Reviewed-by: Vladimir Hasko Reviewed-by: jmiskani --- playbooks/scenario46_sfsturbo.yaml | 108 +++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 playbooks/scenario46_sfsturbo.yaml diff --git a/playbooks/scenario46_sfsturbo.yaml b/playbooks/scenario46_sfsturbo.yaml new file mode 100644 index 0000000..8546288 --- /dev/null +++ b/playbooks/scenario46_sfsturbo.yaml @@ -0,0 +1,108 @@ +--- + +# Scenario to test SFS Turbo deployment +# +- name: Scenario 46 - Create expand delete SFS Turbo share + hosts: localhost + collections: + - opentelekomcloud.cloud + vars: + prefix: scenario46- + tasks: + - set_fact: + prefix: "{{ (prefix + ( lookup('env', 'TASK_EXECUTOR_JOB_ID') | default(99999999 | random | to_uuid | hash('md5'), true) ) ) }}" + + - set_fact: + test_share_name: "{{ (prefix + '-test_share_apimon') }}" + test_security_group_name: "{{ (prefix + '-test_sg_apimon') }}" + test_router_name: "{{ (prefix + '-test_router_apimon') }}" + test_network_name: "{{ (prefix + '-test_network_apimon') }}" + test_subnet_name: "{{ (prefix + '-test_subnet_apimon') }}" + + - block: + + - name: Get Availability zones + opentelekomcloud.cloud.availability_zone_info: + register: azs + + - name: Set Availability Zone + set_fact: + az: "{{ (azs['availability_zones'] | random).name }}" + + - name: Create VPC (Reouter + Net + Subnet) + import_role: + name: opentelekomcloud.vpc + vars: + router_name: "{{ test_router_name }}" + network_name: "{{ test_network_name }}" + subnet_name: "{{ test_subnet_name }}" + state: present + + - name: Create Security Group + openstack.cloud.security_group: + name: "{{ test_security_group_name }}" + description: Test security group created by APImon + register: security + + - name: Create Security Group Rule + openstack.cloud.security_group_rule: + security_group: "{{ test_security_group_name }}" + protocol: tcp + port_range_min: 2048 + port_range_max: 2052 + remote_ip_prefix: 0.0.0.0/0 + + - name: Create SFS Turbo share + opentelekomcloud.cloud.sfsturbo_share: + name: "{{ test_share_name }}" + share_proto: "NFS" + share_type: "STANDARD" + size: 100 + availability_zone: "{{ az }}" + vpc_id: "{{ net_router.router.id }}" + subnet_id: "{{ net_network.network.id }}" + security_group_id: "{{ security.security_group.id }}" + register: share + + - name: Expand capacity of SFS Turbo share + opentelekomcloud.cloud.sfsturbo_share: + name: "{{ test_share_name }}" + size: 200 + + always: + + - block: + + - name: Delete SFS Turbo share + opentelekomcloud.cloud.sfsturbo_share: + name: "{{ test_share_name }}" + state: absent + + - name: Pause for 60 seconds + pause: + seconds: 60 + + - name: Delete Security Group Rule + openstack.cloud.security_group_rule: + state: absent + security_group: "{{ test_security_group_name }}" + protocol: tcp + port_range_min: 2048 + port_range_max: 2052 + remote_ip_prefix: 0.0.0.0/0 + + - name: Delete Security Group + openstack.cloud.security_group: + state: absent + name: "{{ test_security_group_name }}" + + - name: Delete VPC + import_role: + name: opentelekomcloud.vpc + vars: + state: absent + router_name: "{{ test_router_name }}" + network_name: "{{ test_network_name }}" + subnet_name: "{{ test_subnet_name }}" + + ignore_errors: yes