From 2bfd8d12e783fee72cf4b2bd846421035009edcd Mon Sep 17 00:00:00 2001 From: jmiskani Date: Sat, 23 Mar 2024 09:56:58 +0000 Subject: [PATCH] example of static bucket monitoring playbook --- playbooks/scenario9a_obs_static_bucket.yaml | 52 +++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 playbooks/scenario9a_obs_static_bucket.yaml diff --git a/playbooks/scenario9a_obs_static_bucket.yaml b/playbooks/scenario9a_obs_static_bucket.yaml new file mode 100644 index 0000000..840e75e --- /dev/null +++ b/playbooks/scenario9a_obs_static_bucket.yaml @@ -0,0 +1,52 @@ +--- + +# Scenario to test bascic OBS functions +# +- name: Scenario 9 - OBS + hosts: localhost + vars: + prefix: scenario9- + tasks: + - set_fact: + prefix: "{{ (prefix + ( lookup('env', 'TASK_EXECUTOR_JOB_ID') | default(99999999 | random | to_uuid | hash('md5'), true) ) )[0:24] }}" + + - set_fact: + container_name: otc-storagesquad-lz03-test-bucket + object_name: "{{ (prefix + '-object-apimon') }}" + + - block: + + - name: Create file for object + ansible.builtin.file: + path: "./{{ object_name }}.txt" + state: touch + mode: u=rw,g=r,o=r + + - name: Get Container + script: "get_container.py {{ container_name }} " + args: + executable: python3 + + - name: Create Object + script: "create_object.py {{ container_name }} ./{{ object_name }}.txt " + args: + executable: python3 + + - name: Get Object + script: "get_object.py {{ container_name }} ./{{ object_name }}.txt " + args: + executable: python3 + + always: + - block: + - name: Delete file for object + ansible.builtin.file: + path: "./{{ object_name }}.txt" + state: absent + + - name: Delete Object + script: "delete_object.py {{ container_name }} {{ object_name }}.txt " + args: + executable: python3 + + ignore_errors: true