Skip to content

Commit

Permalink
SFS Turbo apimon (#101)
Browse files Browse the repository at this point in the history
SFS Turbo apimon

Apimon playbook for SFS Turbo

Reviewed-by: Vladimir Hasko <[email protected]>
Reviewed-by: jmiskani
  • Loading branch information
jmiskani authored Nov 19, 2024
1 parent 569ace2 commit 9bdc9d9
Showing 1 changed file with 108 additions and 0 deletions.
108 changes: 108 additions & 0 deletions playbooks/scenario46_sfsturbo.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9bdc9d9

Please sign in to comment.