|
| 1 | +--- |
| 2 | + |
| 3 | +# Scenario to test SFS Turbo deployment |
| 4 | +# |
| 5 | +- name: Scenario 46 - Create expand delete SFS Turbo share |
| 6 | + hosts: localhost |
| 7 | + collections: |
| 8 | + - opentelekomcloud.cloud |
| 9 | + vars: |
| 10 | + prefix: scenario46- |
| 11 | + tasks: |
| 12 | + - set_fact: |
| 13 | + prefix: "{{ (prefix + ( lookup('env', 'TASK_EXECUTOR_JOB_ID') | default(99999999 | random | to_uuid | hash('md5'), true) ) ) }}" |
| 14 | + |
| 15 | + - set_fact: |
| 16 | + test_share_name: "{{ (prefix + '-test_share_apimon') }}" |
| 17 | + test_security_group_name: "{{ (prefix + '-test_sg_apimon') }}" |
| 18 | + test_router_name: "{{ (prefix + '-test_router_apimon') }}" |
| 19 | + test_network_name: "{{ (prefix + '-test_network_apimon') }}" |
| 20 | + test_subnet_name: "{{ (prefix + '-test_subnet_apimon') }}" |
| 21 | + |
| 22 | + - block: |
| 23 | + |
| 24 | + - name: Get Availability zones |
| 25 | + opentelekomcloud.cloud.availability_zone_info: |
| 26 | + register: azs |
| 27 | + |
| 28 | + - name: Set Availability Zone |
| 29 | + set_fact: |
| 30 | + az: "{{ (azs['availability_zones'] | random).name }}" |
| 31 | + |
| 32 | + - name: Create VPC (Reouter + Net + Subnet) |
| 33 | + import_role: |
| 34 | + name: opentelekomcloud.vpc |
| 35 | + vars: |
| 36 | + router_name: "{{ test_router_name }}" |
| 37 | + network_name: "{{ test_network_name }}" |
| 38 | + subnet_name: "{{ test_subnet_name }}" |
| 39 | + state: present |
| 40 | + |
| 41 | + - name: Create Security Group |
| 42 | + openstack.cloud.security_group: |
| 43 | + name: "{{ test_security_group_name }}" |
| 44 | + description: Test security group created by APImon |
| 45 | + register: security |
| 46 | + |
| 47 | + - name: Create Security Group Rule |
| 48 | + openstack.cloud.security_group_rule: |
| 49 | + security_group: "{{ test_security_group_name }}" |
| 50 | + protocol: tcp |
| 51 | + port_range_min: 2048 |
| 52 | + port_range_max: 2052 |
| 53 | + remote_ip_prefix: 0.0.0.0/0 |
| 54 | + |
| 55 | + - name: Create SFS Turbo share |
| 56 | + opentelekomcloud.cloud.sfsturbo_share: |
| 57 | + name: "{{ test_share_name }}" |
| 58 | + share_proto: "NFS" |
| 59 | + share_type: "STANDARD" |
| 60 | + size: 100 |
| 61 | + availability_zone: "{{ az }}" |
| 62 | + vpc_id: "{{ net_router.router.id }}" |
| 63 | + subnet_id: "{{ net_network.network.id }}" |
| 64 | + security_group_id: "{{ security.security_group.id }}" |
| 65 | + register: share |
| 66 | + |
| 67 | + - name: Expand capacity of SFS Turbo share |
| 68 | + opentelekomcloud.cloud.sfsturbo_share: |
| 69 | + name: "{{ test_share_name }}" |
| 70 | + size: 200 |
| 71 | + |
| 72 | + always: |
| 73 | + |
| 74 | + - block: |
| 75 | + |
| 76 | + - name: Delete SFS Turbo share |
| 77 | + opentelekomcloud.cloud.sfsturbo_share: |
| 78 | + name: "{{ test_share_name }}" |
| 79 | + state: absent |
| 80 | + |
| 81 | + - name: Pause for 60 seconds |
| 82 | + pause: |
| 83 | + seconds: 60 |
| 84 | + |
| 85 | + - name: Delete Security Group Rule |
| 86 | + openstack.cloud.security_group_rule: |
| 87 | + state: absent |
| 88 | + security_group: "{{ test_security_group_name }}" |
| 89 | + protocol: tcp |
| 90 | + port_range_min: 2048 |
| 91 | + port_range_max: 2052 |
| 92 | + remote_ip_prefix: 0.0.0.0/0 |
| 93 | + |
| 94 | + - name: Delete Security Group |
| 95 | + openstack.cloud.security_group: |
| 96 | + state: absent |
| 97 | + name: "{{ test_security_group_name }}" |
| 98 | + |
| 99 | + - name: Delete VPC |
| 100 | + import_role: |
| 101 | + name: opentelekomcloud.vpc |
| 102 | + vars: |
| 103 | + state: absent |
| 104 | + router_name: "{{ test_router_name }}" |
| 105 | + network_name: "{{ test_network_name }}" |
| 106 | + subnet_name: "{{ test_subnet_name }}" |
| 107 | + |
| 108 | + ignore_errors: yes |
0 commit comments