From faccbe674d696525cb35c1ae93114006ae440641 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Fri, 22 Sep 2023 14:09:29 +0530 Subject: [PATCH 01/25] Create Create_PBR_config.yml --- playbooks/PBR/Create_PBR_config.yml | 309 ++++++++++++++++++++++++++++ 1 file changed, 309 insertions(+) create mode 100644 playbooks/PBR/Create_PBR_config.yml diff --git a/playbooks/PBR/Create_PBR_config.yml b/playbooks/PBR/Create_PBR_config.yml new file mode 100644 index 0000000..b50459e --- /dev/null +++ b/playbooks/PBR/Create_PBR_config.yml @@ -0,0 +1,309 @@ +- name: Using the IBM Storage Virtualize collection For PBR configuration + hosts: localhost + collections: + - ibm.storage_virtualize + gather_facts: no + connection: local + vars_files: + - PBR_variable.txt + tasks: + - name: Generate certificate on primary + ibm_svctask_command: + command: [ "svctask chsystemcert -mkselfsigned" ] + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + - name: Generate certificate on secondary + ibm_svctask_command: + command: [ "svctask chsystemcert -mkselfsigned" ] + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + - name: Export SSL certificate internally on primary + ibm_sv_manage_ssl_certificate: + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + certificate_type: "system" + - name: Export SSL certificate internally on secondary + ibm_sv_manage_ssl_certificate: + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + certificate_type: "system" + - name: Create truststore on primary + ibm_sv_manage_truststore_for_replication: + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: trust + remote_clustername: "{{secondary_cluster_ip}}" + remote_username: "{{secondary_cluster_username}}" + remote_password: "{{secondary_cluster_password}}" + state: "present" + - name: Create truststore on secondary + ibm_sv_manage_truststore_for_replication: + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: trust + remote_clustername: "{{primary_cluster_ip}}" + remote_username: "{{primary_cluster_username}}" + remote_password: "{{primary_cluster_password}}" + state: "present" + - name: create mdiskgrp on primary + ibm_svc_mdiskgrp: + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: mdg0 + state: present + datareduction: yes + ext: 1024 + - name: Generate mdiskgrp on secondary + ibm_svc_mdiskgrp: + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: mdg0 + state: present + datareduction: yes + ext: 1024 + - name: create distribute array on primary + ibm_svc_mdisk: + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: mdisk0 + state: present + level: raid6 + drivecount: 6 + driveclass: 0 + encrypt: no + mdiskgrp: mdg0 + - name: create distribute array on secondary + ibm_svc_mdisk: + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: mdisk0 + state: present + level: raid6 + drivecount: 6 + driveclass: 0 + encrypt: no + mdiskgrp: mdg0 + - name: Create provisioning policy on primary + ibm_sv_manage_provisioning_policy: + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: provisioning_policy0 + capacitysaving: "drivebased" + state: present + - name: Create provisioning policy on secondary + ibm_sv_manage_provisioning_policy: + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: provisioning_policy0 + capacitysaving: "drivebased" + state: present + - name: Get mdisk info + register: results + ibm_svcinfo_command: + command: "svcinfo lsmdiskgrp" + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + - name: show mdiskgrp status + set_fact: + id: "{{ (results['stdout']) }}" + - name: Print the list + set_fact: + uid: uid + - name: show mdiskgrp status + set_fact: + uid: "{{item['replication_pool_link_uid']}}" + loop: "{{id}}" + - name: Print the pool link id + debug: var=uid + - name: Get primary cluster id info + register: results + ibm_svcinfo_command: + command: "svcinfo lspartnership" + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + - name: show cluster id + set_fact: + id1: "{{ (results['stdout']) }}" + - name: Print the list + set_fact: + uid1: uid1 + - name: show cluster id + set_fact: + uid1: "{{item['id']}}" + loop: "{{id1}}" + - name: Print the cluster id + debug: var=uid1 + - name: Get secondary cluster id info + register: results + ibm_svcinfo_command: + command: "svcinfo lspartnership" + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + - name: show cluster id + set_fact: + id2: "{{ (results['stdout']) }}" + - name: Print the list + set_fact: + uid2: uid2 + - name: show cluster id + set_fact: + uid2: "{{item['id']}}" + loop: "{{id2}}" + - name: Print the cluster id + debug: var=uid2 + - name: set provisionpolicy and replicationpoollinkuid on primary site + ibm_svc_mdiskgrp: + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: mdg0 + state: present + replicationpoollinkuid: "{{uid}}" + replication_partner_clusterid: "{{uid2}}" + provisioningpolicy: provisioning_policy0 + - name: set provisionpolicy and replicationpoollinkuid on secondary site + ibm_svc_mdiskgrp: + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: mdg0 + state: present + replicationpoollinkuid: "{{uid}}" + replication_partner_clusterid: "{{uid1}}" + provisioningpolicy: provisioning_policy0 + - name: Create replication policy + ibm_sv_manage_replication_policy: + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: replicationpolicy0 + topology: 2-site-async-dr + location1system: "{{primary_cluster_name}}" + location1iogrp: 0 + location2system: "{{secondary_cluster_name}}" + location2iogrp: 0 + rpoalert: 300 + state: present + - name: Create volume group + ibm_svc_manage_volumegroup: + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: perf_vol_group + replicationpolicy: replicationpolicy0 + state: present + - name: Create a List of variable and print it + set_fact: + list: [] + - name: Print the list + debug: var=list + - name: create list + set_fact: + list: "{{ query('sequence', user_range) }}" + vars: + start: 1 + end: "{{ number_of_volumes | default(10) }}" + user_range: "start={{ start }} end={{ end }} format=%d" + - name: print list + debug: var=list + - name: set default prefix + set_fact: + vol_: vol_ + - name: print default prefix + debug: var=vol_ + - name: Create a Prefix list variable and print it + set_fact: + prefix_list: [] + - name: Print the prefix list + debug: var=prefix_list + - name: create prefix list + set_fact: + prefix_list: "{{ [volume_prefix | default(vol_)] | product(list) | map('join') }}" + - name: print prefix list + debug: var=prefix_list + - name: Create master volume + ibm_svc_manage_volume: + clustername: "{{ primary_cluster_ip }}" + username: "{{ primary_cluster_username }}" + password: "{{ primary_cluster_password }}" + log_path: "{{ log_path | default('/tmp/playbook1.debug') }}" + name: vo1 + state: present + pool: "mdg0" + size: "2" + unit: gb + - name: Create volume + ibm_svc_manage_volume: + clustername: "{{ primary_cluster_ip }}" + username: "{{ primary_cluster_username }}" + password: "{{ primary_cluster_password }}" + log_path: "{{ log_path | default('/tmp/playbook1.debug') }}" + name: vo1 + state: present + volumegroup: "perf_vol_group" + - name: Create volumes + ibm_svc_manage_volume: + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: "{{item}}" + state: "present" + pool: "mdg0" + size: "{{volume_size}}" + unit: "gb" + volumegroup: "perf_vol_group" + with_items: "{{prefix_list}}" + - name: Delete volume + ibm_svc_manage_volume: + clustername: "{{ primary_cluster_ip }}" + username: "{{ primary_cluster_username }}" + password: "{{ primary_cluster_password }}" + log_path: "{{ log_path | default('/tmp/playbook1.debug') }}" + name: vo1 + state: absent + - name: masterVdisks-host mapping + register: results + ibm_svc_vol_map: + clustername: "{{ primary_cluster_ip }}" + username: "{{ primary_cluster_username }}" + password: "{{ primary_cluster_password }}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + state: present + volname: "{{item}}" + host: "{{host_name}}" + with_items: "{{prefix_list}}" From 546384ff9fc728aa43883ee43b1a44cf82b5a7b6 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Fri, 22 Sep 2023 14:10:31 +0530 Subject: [PATCH 02/25] Create PBR_variable.txt --- playbooks/PBR/PBR_variable.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 playbooks/PBR/PBR_variable.txt diff --git a/playbooks/PBR/PBR_variable.txt b/playbooks/PBR/PBR_variable.txt new file mode 100644 index 0000000..34010f5 --- /dev/null +++ b/playbooks/PBR/PBR_variable.txt @@ -0,0 +1,12 @@ +primary_cluster_name: Cluster_9_199_142_151 +primary_cluster_ip: 9.199.142.151 +primary_cluster_username: superuser +primary_cluster_password: l0destone +secondary_cluster_name: Cluster_9_199_142_215 +secondary_cluster_ip: 9.199.142.215 +secondary_cluster_username: superuser +secondary_cluster_password: l0destone +host_name: secondhost +volume_size: 500 +volume_prefix: volu_ +number_of_volumes: 3 From 1d3e2518cdec572041f2ca2a2a3f3d2bee6ff7c0 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Fri, 22 Sep 2023 14:11:25 +0530 Subject: [PATCH 03/25] Create README.txt --- playbooks/PBR/README.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 playbooks/PBR/README.txt diff --git a/playbooks/PBR/README.txt b/playbooks/PBR/README.txt new file mode 100644 index 0000000..4f6330e --- /dev/null +++ b/playbooks/PBR/README.txt @@ -0,0 +1,26 @@ +Objective: +Set up mTLS and configure Policy Based Replication. + +Prerequisite: +- IBM storage Virtualize ansible collection plugins must be installed + +These playbook set up mTLS and configure Policy Based Replication between a primary cluster and the secondary cluster. + - It uses storage virtualize ansible modules. + - This playbook is designed to set up mTLS on both the site and configure Policy Based Replication between source cluster to destination cluster. This is designed in a way that it creates Data Reduction Pool , links them, creates provision policy and replication policy + - These playbooks also creates multiple Volumes with specified prefix along with volume group and maps all of them to the specified host + + +There are total 2 files used for this use-case. + 1. PBR_variable.txt: + This file has all the variables required for playbooks. + - primary_cluster* : Parameters starting with primary_cluster contain primary cluster details from where user wants to replicate data. + - secondary_cluster* : Parameters starting with secondary_cluster contain secondary cluster details to where volume will be replicated to + - volume* : Parameters starting volume contain details for volume such as name prefix and size for the volumes to be created. + - number_of_volumes : It is the number of volumes to be created between clusters. + - host_name : It is the host name to which all the volumes should be mapped after creation. It assumes Host Ips are already assigned and host is already created on both clusters and are logged in. + + 2. Create_PBR_config.yml: + This playbook sets mTLS (Mutual Transport Layer Security) which includes ceritficate generation on individual cluster, export it to remote location , creates certificate store which contains the certificate bundle. This playbook creates mdiskgrp, Data reduction Pool. It links pool of both the site. It creates provision policy, replication policy. It creates voulme group and associated volumes with volume_prefix name specified in inventroy file PBR_variable.txt. It also maps all the volumes to specified host. + + Authors: Akshada Thorat (akshada.thorat@ibm.com) + From 32c9c05bd4db5fa0cf2d4cbf778d5fb0a25a28d3 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Mon, 25 Sep 2023 16:11:29 +0530 Subject: [PATCH 04/25] Update PBR_variable.txt --- playbooks/PBR/PBR_variable.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/playbooks/PBR/PBR_variable.txt b/playbooks/PBR/PBR_variable.txt index 34010f5..776e46c 100644 --- a/playbooks/PBR/PBR_variable.txt +++ b/playbooks/PBR/PBR_variable.txt @@ -1,12 +1,12 @@ -primary_cluster_name: Cluster_9_199_142_151 -primary_cluster_ip: 9.199.142.151 -primary_cluster_username: superuser -primary_cluster_password: l0destone -secondary_cluster_name: Cluster_9_199_142_215 -secondary_cluster_ip: 9.199.142.215 -secondary_cluster_username: superuser -secondary_cluster_password: l0destone -host_name: secondhost -volume_size: 500 -volume_prefix: volu_ -number_of_volumes: 3 +primary_cluster_name: <> +primary_cluster_ip: <> +primary_cluster_username: <> +primary_cluster_password: <> +secondary_cluster_name: <> +secondary_cluster_ip: <> +secondary_cluster_username: <> +secondary_cluster_password: <> +host_name: <> +volume_size: <> +volume_prefix: <> +number_of_volumes: <> From a6178f44f3e4e062b4a7bc19446741ad560373e1 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Mon, 1 Apr 2024 12:04:37 +0530 Subject: [PATCH 05/25] Update Create_PBR_config.yml --- playbooks/PBR/Create_PBR_config.yml | 224 ++++++++++++++++++++-------- 1 file changed, 163 insertions(+), 61 deletions(-) diff --git a/playbooks/PBR/Create_PBR_config.yml b/playbooks/PBR/Create_PBR_config.yml index b50459e..f2fff6a 100644 --- a/playbooks/PBR/Create_PBR_config.yml +++ b/playbooks/PBR/Create_PBR_config.yml @@ -7,56 +7,6 @@ vars_files: - PBR_variable.txt tasks: - - name: Generate certificate on primary - ibm_svctask_command: - command: [ "svctask chsystemcert -mkselfsigned" ] - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - - name: Generate certificate on secondary - ibm_svctask_command: - command: [ "svctask chsystemcert -mkselfsigned" ] - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - - name: Export SSL certificate internally on primary - ibm_sv_manage_ssl_certificate: - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - certificate_type: "system" - - name: Export SSL certificate internally on secondary - ibm_sv_manage_ssl_certificate: - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - certificate_type: "system" - - name: Create truststore on primary - ibm_sv_manage_truststore_for_replication: - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: trust - remote_clustername: "{{secondary_cluster_ip}}" - remote_username: "{{secondary_cluster_username}}" - remote_password: "{{secondary_cluster_password}}" - state: "present" - - name: Create truststore on secondary - ibm_sv_manage_truststore_for_replication: - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: trust - remote_clustername: "{{primary_cluster_ip}}" - remote_username: "{{primary_cluster_username}}" - remote_password: "{{primary_cluster_password}}" - state: "present" - name: create mdiskgrp on primary ibm_svc_mdiskgrp: clustername: "{{primary_cluster_ip}}" @@ -77,6 +27,82 @@ state: present datareduction: yes ext: 1024 + - name: Get drive info + register: results + ibm_svcinfo_command: + command: "svcinfo lsdrive" + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + - name: show drive + set_fact: + id: "{{ (results['stdout']) }}" + - name: set variable + set_fact: + kid: kid + - name: set variable + set_fact: + useD: useD + - name: show drive + set_fact: + kid: "{{item['id']}}" + loop: "{{id}}" + - name: show drive + set_fact: + useD: "{{item['use']}}" + loop: "{{id}}" + - name: Print variable + debug: var=kid + - name: Print variable + debug: var=useD + - name: Print variable + set_fact: + TotalDrive: TotalDrive + - name: Drive count + set_fact: + TotalDrive: "{{ kid|int + 1|int}}" + - name: Print Drive count + debug: var=TotalDrive + - name: set level + set_fact: + Level: + - name: Decide Level + set_fact: + Level: raid1 + when: (TotalDrive|int <= 3 ) + - name: Decide Level + set_fact: + Level: raid6 + when: (TotalDrive|int > 3 ) + - name: Print the Level + debug: var=Level + - name: Create a List of variable and print it + set_fact: + list1: [] + - name: Print the list + debug: var=list1 + - name: create list + set_fact: + list1: "{{ query('sequence', user_range) }}" + vars: + start: 0 + end: "{{ kid|int }}" + user_range: "start={{ start }} end={{ end }} format=%d" + - name: print list + debug: var=list1 + - name: set variable + set_fact: + member: member + - name: Make drive in candidate state + ibm_svctask_command: + command: [ "svctask chdrive -use candidate {{item}}" ] + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + with_items: "{{list1}}" + when: useD != member - name: create distribute array on primary ibm_svc_mdisk: clustername: "{{primary_cluster_ip}}" @@ -85,11 +111,87 @@ log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" name: mdisk0 state: present - level: raid6 - drivecount: 6 + level: "{{Level}}" + drivecount: "{{TotalDrive|int}}" driveclass: 0 encrypt: no mdiskgrp: mdg0 + - name: Get drive info + register: results + ibm_svcinfo_command: + command: "svcinfo lsdrive" + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + - name: show drive + set_fact: + id: "{{ (results['stdout']) }}" + - name: set variable + set_fact: + kid: kid + - name: set variable + set_fact: + useD1: useD1 + - name: show drive + set_fact: + kid: "{{item['id']}}" + loop: "{{id}}" + - name: show drive + set_fact: + useD1: "{{item['use']}}" + loop: "{{id}}" + - name: Print variable + debug: var=kid + - name: Print variable + debug: var=useD1 + - name: Print variable + set_fact: + TotalDrive2: TotalDrive2 + - name: Drive count + set_fact: + TotalDrive2: "{{ kid|int + 1|int}}" + - name: Print Drive count + debug: var=TotalDrive2 + - name: set level + set_fact: + Level2: + - name: Decide Level + set_fact: + Level2: raid1 + when: (TotalDrive2|int <= 3 ) + - name: Decide Level + set_fact: + Level2: raid6 + when: (TotalDrive2|int > 3 ) + - name: Print the Level + debug: var=Level2 + - name: Create a List of variable and print it + set_fact: + list2: [] + - name: Print the list + debug: var=list2 + - name: create list + set_fact: + list2: "{{ query('sequence', user_range) }}" + vars: + start: 0 + end: "{{ kid|int }}" + user_range: "start={{ start }} end={{ end }} format=%d" + - name: print list + debug: var=list2 + - name: set variable + set_fact: + member: member + - name: Make drive in candidate state + ibm_svctask_command: + command: [ "svctask chdrive -use candidate {{item}}" ] + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + with_items: "{{list2}}" + when: useD1 != member - name: create distribute array on secondary ibm_svc_mdisk: clustername: "{{secondary_cluster_ip}}" @@ -98,8 +200,8 @@ log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" name: mdisk0 state: present - level: raid6 - drivecount: 6 + level: "{{Level2}}" + drivecount: "{{TotalDrive2|int}}" driveclass: 0 encrypt: no mdiskgrp: mdg0 @@ -209,11 +311,11 @@ username: "{{primary_cluster_username}}" password: "{{primary_cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: replicationpolicy0 + name: reppoli topology: 2-site-async-dr - location1system: "{{primary_cluster_name}}" + location1system: "{{uid1}}" location1iogrp: 0 - location2system: "{{secondary_cluster_name}}" + location2system: "{{uid2}}" location2iogrp: 0 rpoalert: 300 state: present @@ -223,8 +325,8 @@ username: "{{primary_cluster_username}}" password: "{{primary_cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: perf_vol_group - replicationpolicy: replicationpolicy0 + name: "{{volume_group_name}}" + replicationpolicy: reppoli state: present - name: Create a List of variable and print it set_fact: @@ -274,7 +376,7 @@ log_path: "{{ log_path | default('/tmp/playbook1.debug') }}" name: vo1 state: present - volumegroup: "perf_vol_group" + volumegroup: "{{volume_group_name}}" - name: Create volumes ibm_svc_manage_volume: clustername: "{{primary_cluster_ip}}" @@ -286,7 +388,7 @@ pool: "mdg0" size: "{{volume_size}}" unit: "gb" - volumegroup: "perf_vol_group" + volumegroup: "{{volume_group_name}}" with_items: "{{prefix_list}}" - name: Delete volume ibm_svc_manage_volume: From 8e3e997ebe34d256ce368a88accfba7c2b0f3d89 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Mon, 1 Apr 2024 12:06:20 +0530 Subject: [PATCH 06/25] Create Create_mTLs.yml --- playbooks/PBR/Create_mTLs.yml | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 playbooks/PBR/Create_mTLs.yml diff --git a/playbooks/PBR/Create_mTLs.yml b/playbooks/PBR/Create_mTLs.yml new file mode 100644 index 0000000..ad328ce --- /dev/null +++ b/playbooks/PBR/Create_mTLs.yml @@ -0,0 +1,59 @@ +- name: Using the IBM Storage Virtualize collection For mTLS self signed certificate creation + hosts: localhost + collections: + - ibm.storage_virtualize + gather_facts: no + connection: local + vars_files: + - PBR_variable.txt + tasks: + - name: Generate certificate on primary + ibm_svctask_command: + command: [ "svctask chsystemcert -mkselfsigned" ] + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + - name: Generate certificate on secondary + ibm_svctask_command: + command: [ "svctask chsystemcert -mkselfsigned" ] + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + - name: Export SSL certificate internally on primary + ibm_sv_manage_ssl_certificate: + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + certificate_type: "system" + - name: Export SSL certificate internally on secondary + ibm_sv_manage_ssl_certificate: + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + certificate_type: "system" + - name: Create truststore on primary + ibm_sv_manage_truststore_for_replication: + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: trust + remote_clustername: "{{secondary_cluster_ip}}" + remote_username: "{{secondary_cluster_username}}" + remote_password: "{{secondary_cluster_password}}" + state: "present" + - name: Create truststore on secondary + ibm_sv_manage_truststore_for_replication: + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: trust + remote_clustername: "{{primary_cluster_ip}}" + remote_username: "{{primary_cluster_username}}" + remote_password: "{{primary_cluster_password}}" + state: "present" From 4e5d676c42282bdf230d678ee77b7d0f30bd6bd1 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Mon, 1 Apr 2024 12:07:27 +0530 Subject: [PATCH 07/25] Update PBR_variable.txt --- playbooks/PBR/PBR_variable.txt | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/playbooks/PBR/PBR_variable.txt b/playbooks/PBR/PBR_variable.txt index 776e46c..cc25567 100644 --- a/playbooks/PBR/PBR_variable.txt +++ b/playbooks/PBR/PBR_variable.txt @@ -1,12 +1,14 @@ -primary_cluster_name: <> -primary_cluster_ip: <> -primary_cluster_username: <> -primary_cluster_password: <> -secondary_cluster_name: <> -secondary_cluster_ip: <> -secondary_cluster_username: <> -secondary_cluster_password: <> -host_name: <> -volume_size: <> -volume_prefix: <> -number_of_volumes: <> +primary_cluster_name: < primary_cluster_name> +primary_cluster_ip: +primary_cluster_username: +primary_cluster_password: +secondary_cluster_name: +secondary_cluster_ip: +secondary_cluster_username: +secondary_cluster_password: +host_name: +volume_size: +volume_prefix: +volume_group_name: +number_of_volumes: +log_path: From d31200afac1b1ccf5ae8af8bdec240306d355f0c Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Mon, 1 Apr 2024 12:08:20 +0530 Subject: [PATCH 08/25] Update README.txt --- playbooks/PBR/README.txt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/playbooks/PBR/README.txt b/playbooks/PBR/README.txt index 4f6330e..c1f0e5e 100644 --- a/playbooks/PBR/README.txt +++ b/playbooks/PBR/README.txt @@ -10,17 +10,21 @@ These playbook set up mTLS and configure Policy Based Replication between a prim - These playbooks also creates multiple Volumes with specified prefix along with volume group and maps all of them to the specified host -There are total 2 files used for this use-case. +There are total 3 files used for this use-case. 1. PBR_variable.txt: This file has all the variables required for playbooks. - primary_cluster* : Parameters starting with primary_cluster contain primary cluster details from where user wants to replicate data. - secondary_cluster* : Parameters starting with secondary_cluster contain secondary cluster details to where volume will be replicated to - - volume* : Parameters starting volume contain details for volume such as name prefix and size for the volumes to be created. + - volume* : Parameters starting volume contain details for volume such as name prefix for volume ,volume group and size for the volumes to be created. - number_of_volumes : It is the number of volumes to be created between clusters. - - host_name : It is the host name to which all the volumes should be mapped after creation. It assumes Host Ips are already assigned and host is already created on both clusters and are logged in. + - host_name : It is the host name to which all the volumes should be mapped after creation. It assumes host is already created on primary clusters. + - log_path : It specifies the log path of playbook. If not specified then logs will generate at default path ‘/tmp/ansiblePB.debug’ - 2. Create_PBR_config.yml: - This playbook sets mTLS (Mutual Transport Layer Security) which includes ceritficate generation on individual cluster, export it to remote location , creates certificate store which contains the certificate bundle. This playbook creates mdiskgrp, Data reduction Pool. It links pool of both the site. It creates provision policy, replication policy. It creates voulme group and associated volumes with volume_prefix name specified in inventroy file PBR_variable.txt. It also maps all the volumes to specified host. + + 2. Create_mTLS.yml: + This playbook sets mTLS (Mutual Transport Layer Security) which includes ceritficate generation on individual cluster, export it to remote location , creates certificate truststore which contains the certificate bundle. This operation performed on primary as well as secondary site. + + 3. Create_PBR_config.yml: + This playbook check the drive status , drive count based on that it creates mdiskgrp, Data reduction Pool with specified level. It links pool of both the site. It creates provision policy, replication policy. It creates voulme group and associated volumes with volume_prefix name specified in inventroy file ‘PBR_variable.txt’. It also maps all the volumes to specified host.After first execution of this playbook for next execution we can add volumes on existing/new volume group with existing replication policy and provision policy . It mapped this newly added volumes to the existing host object. Authors: Akshada Thorat (akshada.thorat@ibm.com) - From 24121bdb99283786564ae6b176b607cb782549f1 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:16:39 +0530 Subject: [PATCH 09/25] Update Create_PBR_config.yml --- playbooks/PBR/Create_PBR_config.yml | 40 ----------------------------- 1 file changed, 40 deletions(-) diff --git a/playbooks/PBR/Create_PBR_config.yml b/playbooks/PBR/Create_PBR_config.yml index f2fff6a..2805f97 100644 --- a/playbooks/PBR/Create_PBR_config.yml +++ b/playbooks/PBR/Create_PBR_config.yml @@ -52,18 +52,12 @@ set_fact: useD: "{{item['use']}}" loop: "{{id}}" - - name: Print variable - debug: var=kid - - name: Print variable - debug: var=useD - name: Print variable set_fact: TotalDrive: TotalDrive - name: Drive count set_fact: TotalDrive: "{{ kid|int + 1|int}}" - - name: Print Drive count - debug: var=TotalDrive - name: set level set_fact: Level: @@ -75,13 +69,9 @@ set_fact: Level: raid6 when: (TotalDrive|int > 3 ) - - name: Print the Level - debug: var=Level - name: Create a List of variable and print it set_fact: list1: [] - - name: Print the list - debug: var=list1 - name: create list set_fact: list1: "{{ query('sequence', user_range) }}" @@ -89,8 +79,6 @@ start: 0 end: "{{ kid|int }}" user_range: "start={{ start }} end={{ end }} format=%d" - - name: print list - debug: var=list1 - name: set variable set_fact: member: member @@ -141,18 +129,12 @@ set_fact: useD1: "{{item['use']}}" loop: "{{id}}" - - name: Print variable - debug: var=kid - - name: Print variable - debug: var=useD1 - name: Print variable set_fact: TotalDrive2: TotalDrive2 - name: Drive count set_fact: TotalDrive2: "{{ kid|int + 1|int}}" - - name: Print Drive count - debug: var=TotalDrive2 - name: set level set_fact: Level2: @@ -164,13 +146,9 @@ set_fact: Level2: raid6 when: (TotalDrive2|int > 3 ) - - name: Print the Level - debug: var=Level2 - name: Create a List of variable and print it set_fact: list2: [] - - name: Print the list - debug: var=list2 - name: create list set_fact: list2: "{{ query('sequence', user_range) }}" @@ -178,8 +156,6 @@ start: 0 end: "{{ kid|int }}" user_range: "start={{ start }} end={{ end }} format=%d" - - name: print list - debug: var=list2 - name: set variable set_fact: member: member @@ -241,8 +217,6 @@ set_fact: uid: "{{item['replication_pool_link_uid']}}" loop: "{{id}}" - - name: Print the pool link id - debug: var=uid - name: Get primary cluster id info register: results ibm_svcinfo_command: @@ -261,8 +235,6 @@ set_fact: uid1: "{{item['id']}}" loop: "{{id1}}" - - name: Print the cluster id - debug: var=uid1 - name: Get secondary cluster id info register: results ibm_svcinfo_command: @@ -281,8 +253,6 @@ set_fact: uid2: "{{item['id']}}" loop: "{{id2}}" - - name: Print the cluster id - debug: var=uid2 - name: set provisionpolicy and replicationpoollinkuid on primary site ibm_svc_mdiskgrp: clustername: "{{primary_cluster_ip}}" @@ -331,8 +301,6 @@ - name: Create a List of variable and print it set_fact: list: [] - - name: Print the list - debug: var=list - name: create list set_fact: list: "{{ query('sequence', user_range) }}" @@ -340,23 +308,15 @@ start: 1 end: "{{ number_of_volumes | default(10) }}" user_range: "start={{ start }} end={{ end }} format=%d" - - name: print list - debug: var=list - name: set default prefix set_fact: vol_: vol_ - - name: print default prefix - debug: var=vol_ - name: Create a Prefix list variable and print it set_fact: prefix_list: [] - - name: Print the prefix list - debug: var=prefix_list - name: create prefix list set_fact: prefix_list: "{{ [volume_prefix | default(vol_)] | product(list) | map('join') }}" - - name: print prefix list - debug: var=prefix_list - name: Create master volume ibm_svc_manage_volume: clustername: "{{ primary_cluster_ip }}" From d71966c7f845d0c8433c406878abcab1bbce91af Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:18:38 +0530 Subject: [PATCH 10/25] Create Create_mdiskgrp_drp.yml --- playbooks/PBR/Create_mdiskgrp_drp.yml | 175 ++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 playbooks/PBR/Create_mdiskgrp_drp.yml diff --git a/playbooks/PBR/Create_mdiskgrp_drp.yml b/playbooks/PBR/Create_mdiskgrp_drp.yml new file mode 100644 index 0000000..fad0d7b --- /dev/null +++ b/playbooks/PBR/Create_mdiskgrp_drp.yml @@ -0,0 +1,175 @@ + tasks: + - name: create mdiskgrp on primary + ibm_svc_mdiskgrp: + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: mdg0 + state: present + datareduction: yes + ext: 1024 + - name: Generate mdiskgrp on secondary + ibm_svc_mdiskgrp: + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: mdg0 + state: present + datareduction: yes + ext: 1024 + - name: Get drive info + register: results + ibm_svcinfo_command: + command: "svcinfo lsdrive" + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + - name: show drive + set_fact: + id: "{{ (results['stdout']) }}" + - name: set variable + set_fact: + kid: kid + - name: set variable + set_fact: + useD: useD + - name: show drive + set_fact: + kid: "{{item['id']}}" + loop: "{{id}}" + - name: show drive + set_fact: + useD: "{{item['use']}}" + loop: "{{id}}" + - name: Print variable + set_fact: + TotalDrive: TotalDrive + - name: Drive count + set_fact: + TotalDrive: "{{ kid|int + 1|int}}" + - name: set level + set_fact: + Level: + - name: Decide Level + set_fact: + Level: raid1 + when: (TotalDrive|int <= 3 ) + - name: Decide Level + set_fact: + Level: raid6 + when: (TotalDrive|int > 3 ) + - name: Create a List of variable and print it + set_fact: + list1: [] + - name: create list + set_fact: + list1: "{{ query('sequence', user_range) }}" + vars: + start: 0 + end: "{{ kid|int }}" + user_range: "start={{ start }} end={{ end }} format=%d" + - name: set variable + set_fact: + member: member + - name: Make drive in candidate state + ibm_svctask_command: + command: [ "svctask chdrive -use candidate {{item}}" ] + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + with_items: "{{list1}}" + when: useD != member + - name: create distribute array on primary + ibm_svc_mdisk: + clustername: "{{primary_cluster_ip}}" + username: "{{primary_cluster_username}}" + password: "{{primary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: mdisk0 + state: present + level: "{{Level}}" + drivecount: "{{TotalDrive|int}}" + driveclass: 0 + encrypt: no + mdiskgrp: mdg0 + - name: Get drive info + register: results + ibm_svcinfo_command: + command: "svcinfo lsdrive" + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + - name: show drive + set_fact: + id: "{{ (results['stdout']) }}" + - name: set variable + set_fact: + kid: kid + - name: set variable + set_fact: + useD1: useD1 + - name: show drive + set_fact: + kid: "{{item['id']}}" + loop: "{{id}}" + - name: show drive + set_fact: + useD1: "{{item['use']}}" + loop: "{{id}}" + - name: Print variable + set_fact: + TotalDrive2: TotalDrive2 + - name: Drive count + set_fact: + TotalDrive2: "{{ kid|int + 1|int}}" + - name: set level + set_fact: + Level2: + - name: Decide Level + set_fact: + Level2: raid1 + when: (TotalDrive2|int <= 3 ) + - name: Decide Level + set_fact: + Level2: raid6 + when: (TotalDrive2|int > 3 ) + - name: Create a List of variable and print it + set_fact: + list2: [] + - name: create list + set_fact: + list2: "{{ query('sequence', user_range) }}" + vars: + start: 0 + end: "{{ kid|int }}" + user_range: "start={{ start }} end={{ end }} format=%d" + - name: set variable + set_fact: + member: member + - name: Make drive in candidate state + ibm_svctask_command: + command: [ "svctask chdrive -use candidate {{item}}" ] + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + with_items: "{{list2}}" + when: useD1 != member + - name: create distribute array on secondary + ibm_svc_mdisk: + clustername: "{{secondary_cluster_ip}}" + username: "{{secondary_cluster_username}}" + password: "{{secondary_cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: mdisk0 + state: present + level: "{{Level2}}" + drivecount: "{{TotalDrive2|int}}" + driveclass: 0 + encrypt: no + mdiskgrp: mdg0 From a2d18e706c44fca039a96b00853e5e08a6801654 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:19:15 +0530 Subject: [PATCH 11/25] Update Create_PBR_config.yml --- playbooks/PBR/Create_PBR_config.yml | 174 ---------------------------- 1 file changed, 174 deletions(-) diff --git a/playbooks/PBR/Create_PBR_config.yml b/playbooks/PBR/Create_PBR_config.yml index 2805f97..7896f67 100644 --- a/playbooks/PBR/Create_PBR_config.yml +++ b/playbooks/PBR/Create_PBR_config.yml @@ -7,180 +7,6 @@ vars_files: - PBR_variable.txt tasks: - - name: create mdiskgrp on primary - ibm_svc_mdiskgrp: - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: mdg0 - state: present - datareduction: yes - ext: 1024 - - name: Generate mdiskgrp on secondary - ibm_svc_mdiskgrp: - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: mdg0 - state: present - datareduction: yes - ext: 1024 - - name: Get drive info - register: results - ibm_svcinfo_command: - command: "svcinfo lsdrive" - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - - name: show drive - set_fact: - id: "{{ (results['stdout']) }}" - - name: set variable - set_fact: - kid: kid - - name: set variable - set_fact: - useD: useD - - name: show drive - set_fact: - kid: "{{item['id']}}" - loop: "{{id}}" - - name: show drive - set_fact: - useD: "{{item['use']}}" - loop: "{{id}}" - - name: Print variable - set_fact: - TotalDrive: TotalDrive - - name: Drive count - set_fact: - TotalDrive: "{{ kid|int + 1|int}}" - - name: set level - set_fact: - Level: - - name: Decide Level - set_fact: - Level: raid1 - when: (TotalDrive|int <= 3 ) - - name: Decide Level - set_fact: - Level: raid6 - when: (TotalDrive|int > 3 ) - - name: Create a List of variable and print it - set_fact: - list1: [] - - name: create list - set_fact: - list1: "{{ query('sequence', user_range) }}" - vars: - start: 0 - end: "{{ kid|int }}" - user_range: "start={{ start }} end={{ end }} format=%d" - - name: set variable - set_fact: - member: member - - name: Make drive in candidate state - ibm_svctask_command: - command: [ "svctask chdrive -use candidate {{item}}" ] - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - with_items: "{{list1}}" - when: useD != member - - name: create distribute array on primary - ibm_svc_mdisk: - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: mdisk0 - state: present - level: "{{Level}}" - drivecount: "{{TotalDrive|int}}" - driveclass: 0 - encrypt: no - mdiskgrp: mdg0 - - name: Get drive info - register: results - ibm_svcinfo_command: - command: "svcinfo lsdrive" - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - - name: show drive - set_fact: - id: "{{ (results['stdout']) }}" - - name: set variable - set_fact: - kid: kid - - name: set variable - set_fact: - useD1: useD1 - - name: show drive - set_fact: - kid: "{{item['id']}}" - loop: "{{id}}" - - name: show drive - set_fact: - useD1: "{{item['use']}}" - loop: "{{id}}" - - name: Print variable - set_fact: - TotalDrive2: TotalDrive2 - - name: Drive count - set_fact: - TotalDrive2: "{{ kid|int + 1|int}}" - - name: set level - set_fact: - Level2: - - name: Decide Level - set_fact: - Level2: raid1 - when: (TotalDrive2|int <= 3 ) - - name: Decide Level - set_fact: - Level2: raid6 - when: (TotalDrive2|int > 3 ) - - name: Create a List of variable and print it - set_fact: - list2: [] - - name: create list - set_fact: - list2: "{{ query('sequence', user_range) }}" - vars: - start: 0 - end: "{{ kid|int }}" - user_range: "start={{ start }} end={{ end }} format=%d" - - name: set variable - set_fact: - member: member - - name: Make drive in candidate state - ibm_svctask_command: - command: [ "svctask chdrive -use candidate {{item}}" ] - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - with_items: "{{list2}}" - when: useD1 != member - - name: create distribute array on secondary - ibm_svc_mdisk: - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: mdisk0 - state: present - level: "{{Level2}}" - drivecount: "{{TotalDrive2|int}}" - driveclass: 0 - encrypt: no - mdiskgrp: mdg0 - name: Create provisioning policy on primary ibm_sv_manage_provisioning_policy: clustername: "{{primary_cluster_ip}}" From e26e9333288184272ff7ce74357163666cbc3f76 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Wed, 3 Apr 2024 12:12:38 +0530 Subject: [PATCH 12/25] Update Create_PBR_config.yml --- playbooks/PBR/Create_PBR_config.yml | 124 +++++++++++----------------- 1 file changed, 49 insertions(+), 75 deletions(-) diff --git a/playbooks/PBR/Create_PBR_config.yml b/playbooks/PBR/Create_PBR_config.yml index 7896f67..0e6188d 100644 --- a/playbooks/PBR/Create_PBR_config.yml +++ b/playbooks/PBR/Create_PBR_config.yml @@ -7,83 +7,57 @@ vars_files: - PBR_variable.txt tasks: - - name: Create provisioning policy on primary - ibm_sv_manage_provisioning_policy: - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: provisioning_policy0 - capacitysaving: "drivebased" - state: present - - name: Create provisioning policy on secondary - ibm_sv_manage_provisioning_policy: - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: provisioning_policy0 - capacitysaving: "drivebased" - state: present + - name: Create mTLS on both the clusters + include_tasks: Create_mTLS.yml + loop: "{{users_data}}" + no_log: true + + - name: Create mdiskgrp_drp and provisionpolicy on both the clusters + include_tasks: Create_mdiskgrp_drp_proviPolicy.yml + loop: "{{users_data}}" + no_log: true + - name: Get mdisk info register: results ibm_svcinfo_command: command: "svcinfo lsmdiskgrp" - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" + clustername: "{{users_data[0].cluster_ip}}" + username: "{{users_data[0].cluster_username}}" + password: "{{users_data[0].cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - - name: show mdiskgrp status - set_fact: - id: "{{ (results['stdout']) }}" - - name: Print the list - set_fact: - uid: uid - name: show mdiskgrp status set_fact: uid: "{{item['replication_pool_link_uid']}}" - loop: "{{id}}" + loop: "{{ (results['stdout']) }}" - name: Get primary cluster id info register: results ibm_svcinfo_command: command: "svcinfo lspartnership" - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" + clustername: "{{users_data[1].cluster_ip}}" + username: "{{users_data[1].cluster_username}}" + password: "{{users_data[1].cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - - name: show cluster id - set_fact: - id1: "{{ (results['stdout']) }}" - - name: Print the list - set_fact: - uid1: uid1 - name: show cluster id set_fact: uid1: "{{item['id']}}" - loop: "{{id1}}" + loop: "{{ (results['stdout']) }}" - name: Get secondary cluster id info register: results ibm_svcinfo_command: command: "svcinfo lspartnership" - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" + clustername: "{{users_data[0].cluster_ip}}" + username: "{{users_data[0].cluster_username}}" + password: "{{users_data[0].cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - - name: show cluster id - set_fact: - id2: "{{ (results['stdout']) }}" - - name: Print the list - set_fact: - uid2: uid2 - name: show cluster id set_fact: uid2: "{{item['id']}}" - loop: "{{id2}}" + loop: "{{ (results['stdout']) }}" - name: set provisionpolicy and replicationpoollinkuid on primary site ibm_svc_mdiskgrp: - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" + clustername: "{{users_data[0].cluster_ip}}" + username: "{{users_data[0].cluster_username}}" + password: "{{users_data[0].cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" name: mdg0 state: present @@ -92,9 +66,9 @@ provisioningpolicy: provisioning_policy0 - name: set provisionpolicy and replicationpoollinkuid on secondary site ibm_svc_mdiskgrp: - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" + clustername: "{{users_data[1].cluster_ip}}" + username: "{{users_data[1].cluster_username}}" + password: "{{users_data[1].cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" name: mdg0 state: present @@ -103,9 +77,9 @@ provisioningpolicy: provisioning_policy0 - name: Create replication policy ibm_sv_manage_replication_policy: - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" + clustername: "{{users_data[0].cluster_ip}}" + username: "{{users_data[0].cluster_username}}" + password: "{{users_data[0].cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" name: reppoli topology: 2-site-async-dr @@ -117,9 +91,9 @@ state: present - name: Create volume group ibm_svc_manage_volumegroup: - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" + clustername: "{{users_data[0].cluster_ip}}" + username: "{{users_data[0].cluster_username}}" + password: "{{users_data[0].cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" name: "{{volume_group_name}}" replicationpolicy: reppoli @@ -145,9 +119,9 @@ prefix_list: "{{ [volume_prefix | default(vol_)] | product(list) | map('join') }}" - name: Create master volume ibm_svc_manage_volume: - clustername: "{{ primary_cluster_ip }}" - username: "{{ primary_cluster_username }}" - password: "{{ primary_cluster_password }}" + clustername: "{{users_data[0].cluster_ip}}" + username: "{{users_data[0].cluster_username}}" + password: "{{users_data[0].cluster_password}}" log_path: "{{ log_path | default('/tmp/playbook1.debug') }}" name: vo1 state: present @@ -156,18 +130,18 @@ unit: gb - name: Create volume ibm_svc_manage_volume: - clustername: "{{ primary_cluster_ip }}" - username: "{{ primary_cluster_username }}" - password: "{{ primary_cluster_password }}" + clustername: "{{users_data[0].cluster_ip}}" + username: "{{users_data[0].cluster_username}}" + password: "{{users_data[0].cluster_password}}" log_path: "{{ log_path | default('/tmp/playbook1.debug') }}" name: vo1 state: present volumegroup: "{{volume_group_name}}" - name: Create volumes ibm_svc_manage_volume: - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" + clustername: "{{users_data[0].cluster_ip}}" + username: "{{users_data[0].cluster_username}}" + password: "{{users_data[0].cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" name: "{{item}}" state: "present" @@ -178,18 +152,18 @@ with_items: "{{prefix_list}}" - name: Delete volume ibm_svc_manage_volume: - clustername: "{{ primary_cluster_ip }}" - username: "{{ primary_cluster_username }}" - password: "{{ primary_cluster_password }}" + clustername: "{{users_data[0].cluster_ip}}" + username: "{{users_data[0].cluster_username}}" + password: "{{users_data[0].cluster_password}}" log_path: "{{ log_path | default('/tmp/playbook1.debug') }}" name: vo1 state: absent - name: masterVdisks-host mapping register: results ibm_svc_vol_map: - clustername: "{{ primary_cluster_ip }}" - username: "{{ primary_cluster_username }}" - password: "{{ primary_cluster_password }}" + clustername: "{{users_data[0].cluster_ip}}" + username: "{{users_data[0].cluster_username}}" + password: "{{users_data[0].cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" state: present volname: "{{item}}" From c58160d8c2c59b99b3e3b9a7fa6d8efcb649308e Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Wed, 3 Apr 2024 12:13:27 +0530 Subject: [PATCH 13/25] Update Create_mTLs.yml --- playbooks/PBR/Create_mTLs.yml | 100 ++++++++++++++-------------------- 1 file changed, 41 insertions(+), 59 deletions(-) diff --git a/playbooks/PBR/Create_mTLs.yml b/playbooks/PBR/Create_mTLs.yml index ad328ce..827d2af 100644 --- a/playbooks/PBR/Create_mTLs.yml +++ b/playbooks/PBR/Create_mTLs.yml @@ -1,59 +1,41 @@ -- name: Using the IBM Storage Virtualize collection For mTLS self signed certificate creation - hosts: localhost - collections: - - ibm.storage_virtualize - gather_facts: no - connection: local - vars_files: - - PBR_variable.txt - tasks: - - name: Generate certificate on primary - ibm_svctask_command: - command: [ "svctask chsystemcert -mkselfsigned" ] - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - - name: Generate certificate on secondary - ibm_svctask_command: - command: [ "svctask chsystemcert -mkselfsigned" ] - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - - name: Export SSL certificate internally on primary - ibm_sv_manage_ssl_certificate: - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - certificate_type: "system" - - name: Export SSL certificate internally on secondary - ibm_sv_manage_ssl_certificate: - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - certificate_type: "system" - - name: Create truststore on primary - ibm_sv_manage_truststore_for_replication: - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: trust - remote_clustername: "{{secondary_cluster_ip}}" - remote_username: "{{secondary_cluster_username}}" - remote_password: "{{secondary_cluster_password}}" - state: "present" - - name: Create truststore on secondary - ibm_sv_manage_truststore_for_replication: - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: trust - remote_clustername: "{{primary_cluster_ip}}" - remote_username: "{{primary_cluster_username}}" - remote_password: "{{primary_cluster_password}}" - state: "present" +- name: Generate certificate + ibm_svctask_command: + command: [ "svctask chsystemcert -mkselfsigned" ] + clustername: "{{item.cluster_ip}}" + username: "{{item.cluster_username}}" + password: "{{item.cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + loop: "{{users_data}}" + +- name: Export SSL certificate internally + ibm_sv_manage_ssl_certificate: + clustername: "{{item.cluster_ip}}" + username: "{{item.cluster_username}}" + password: "{{item.cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + certificate_type: "system" + loop: "{{users_data}}" + +- name: Create truststore on primary + ibm_sv_manage_truststore_for_replication: + clustername: "{{users_data[0].cluster_ip}}" + username: "{{users_data[0].cluster_username}}" + password: "{{users_data[0].cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: trust + remote_clustername: "{{users_data[1].cluster_ip}}" + remote_username: "{{users_data[1].cluster_username}}" + remote_password: "{{users_data[1].cluster_password}}" + state: "present" + +- name: Create truststore on secondary + ibm_sv_manage_truststore_for_replication: + clustername: "{{users_data[1].cluster_ip}}" + username: "{{users_data[1].cluster_username}}" + password: "{{users_data[1].cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: trust + remote_clustername: "{{users_data[0].cluster_ip}}" + remote_username: "{{users_data[0].cluster_username}}" + remote_password: "{{users_data[0].cluster_password}}" + state: "present" From 7ffc429c8a7f70ebbefbea2d9fd8fbae81e6a3f3 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Wed, 3 Apr 2024 12:14:12 +0530 Subject: [PATCH 14/25] Update and rename Create_mdiskgrp_drp.yml to Create_mdiskgrp_drp_proviPolicy.yml --- playbooks/PBR/Create_mdiskgrp_drp.yml | 175 ------------------ .../PBR/Create_mdiskgrp_drp_proviPolicy.yml | 154 +++++++++++++++ 2 files changed, 154 insertions(+), 175 deletions(-) delete mode 100644 playbooks/PBR/Create_mdiskgrp_drp.yml create mode 100644 playbooks/PBR/Create_mdiskgrp_drp_proviPolicy.yml diff --git a/playbooks/PBR/Create_mdiskgrp_drp.yml b/playbooks/PBR/Create_mdiskgrp_drp.yml deleted file mode 100644 index fad0d7b..0000000 --- a/playbooks/PBR/Create_mdiskgrp_drp.yml +++ /dev/null @@ -1,175 +0,0 @@ - tasks: - - name: create mdiskgrp on primary - ibm_svc_mdiskgrp: - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: mdg0 - state: present - datareduction: yes - ext: 1024 - - name: Generate mdiskgrp on secondary - ibm_svc_mdiskgrp: - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: mdg0 - state: present - datareduction: yes - ext: 1024 - - name: Get drive info - register: results - ibm_svcinfo_command: - command: "svcinfo lsdrive" - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - - name: show drive - set_fact: - id: "{{ (results['stdout']) }}" - - name: set variable - set_fact: - kid: kid - - name: set variable - set_fact: - useD: useD - - name: show drive - set_fact: - kid: "{{item['id']}}" - loop: "{{id}}" - - name: show drive - set_fact: - useD: "{{item['use']}}" - loop: "{{id}}" - - name: Print variable - set_fact: - TotalDrive: TotalDrive - - name: Drive count - set_fact: - TotalDrive: "{{ kid|int + 1|int}}" - - name: set level - set_fact: - Level: - - name: Decide Level - set_fact: - Level: raid1 - when: (TotalDrive|int <= 3 ) - - name: Decide Level - set_fact: - Level: raid6 - when: (TotalDrive|int > 3 ) - - name: Create a List of variable and print it - set_fact: - list1: [] - - name: create list - set_fact: - list1: "{{ query('sequence', user_range) }}" - vars: - start: 0 - end: "{{ kid|int }}" - user_range: "start={{ start }} end={{ end }} format=%d" - - name: set variable - set_fact: - member: member - - name: Make drive in candidate state - ibm_svctask_command: - command: [ "svctask chdrive -use candidate {{item}}" ] - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - with_items: "{{list1}}" - when: useD != member - - name: create distribute array on primary - ibm_svc_mdisk: - clustername: "{{primary_cluster_ip}}" - username: "{{primary_cluster_username}}" - password: "{{primary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: mdisk0 - state: present - level: "{{Level}}" - drivecount: "{{TotalDrive|int}}" - driveclass: 0 - encrypt: no - mdiskgrp: mdg0 - - name: Get drive info - register: results - ibm_svcinfo_command: - command: "svcinfo lsdrive" - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - - name: show drive - set_fact: - id: "{{ (results['stdout']) }}" - - name: set variable - set_fact: - kid: kid - - name: set variable - set_fact: - useD1: useD1 - - name: show drive - set_fact: - kid: "{{item['id']}}" - loop: "{{id}}" - - name: show drive - set_fact: - useD1: "{{item['use']}}" - loop: "{{id}}" - - name: Print variable - set_fact: - TotalDrive2: TotalDrive2 - - name: Drive count - set_fact: - TotalDrive2: "{{ kid|int + 1|int}}" - - name: set level - set_fact: - Level2: - - name: Decide Level - set_fact: - Level2: raid1 - when: (TotalDrive2|int <= 3 ) - - name: Decide Level - set_fact: - Level2: raid6 - when: (TotalDrive2|int > 3 ) - - name: Create a List of variable and print it - set_fact: - list2: [] - - name: create list - set_fact: - list2: "{{ query('sequence', user_range) }}" - vars: - start: 0 - end: "{{ kid|int }}" - user_range: "start={{ start }} end={{ end }} format=%d" - - name: set variable - set_fact: - member: member - - name: Make drive in candidate state - ibm_svctask_command: - command: [ "svctask chdrive -use candidate {{item}}" ] - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - with_items: "{{list2}}" - when: useD1 != member - - name: create distribute array on secondary - ibm_svc_mdisk: - clustername: "{{secondary_cluster_ip}}" - username: "{{secondary_cluster_username}}" - password: "{{secondary_cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: mdisk0 - state: present - level: "{{Level2}}" - drivecount: "{{TotalDrive2|int}}" - driveclass: 0 - encrypt: no - mdiskgrp: mdg0 diff --git a/playbooks/PBR/Create_mdiskgrp_drp_proviPolicy.yml b/playbooks/PBR/Create_mdiskgrp_drp_proviPolicy.yml new file mode 100644 index 0000000..780181a --- /dev/null +++ b/playbooks/PBR/Create_mdiskgrp_drp_proviPolicy.yml @@ -0,0 +1,154 @@ +- name: create mdiskgrp on both clusters + ibm_svc_mdiskgrp: + clustername: "{{item.cluster_ip}}" + username: "{{item.cluster_username}}" + password: "{{item.cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: mdg0 + state: present + datareduction: yes + ext: 1024 + loop: "{{users_data}}" + +- name: Get drive info + register: results + ibm_svcinfo_command: + command: "svcinfo lsdrive" + clustername: "{{users_data[0].cluster_ip}}" + username: "{{users_data[0].cluster_username}}" + password: "{{users_data[0].cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" +- name: show drive + set_fact: + kid: "{{item['id']}}" + loop: "{{ (results['stdout']) }}" +- name: show drive + set_fact: + useD: "{{item['use']}}" + loop: "{{ (results['stdout']) }}" +- name: Drive count + set_fact: + TotalDrive: "{{ kid|int + 1|int}}" +- name: set level + set_fact: + Level: +- name: Decide Level + set_fact: + Level: raid1 + when: (TotalDrive|int <= 3 ) +- name: Decide Level + set_fact: + Level: raid6 + when: (TotalDrive|int > 3 ) +- name: Create a List of variable and print it + set_fact: + list1: [] +- name: create list + set_fact: + list1: "{{ query('sequence', user_range) }}" + vars: + start: 0 + end: "{{ kid|int }}" + user_range: "start={{ start }} end={{ end }} format=%d" +- name: set variable + set_fact: + member: member +- name: Make drive in candidate state + ibm_svctask_command: + command: [ "svctask chdrive -use candidate {{item}}" ] + clustername: "{{users_data[0].cluster_ip}}" + username: "{{users_data[0].cluster_username}}" + password: "{{users_data[0].cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + with_items: "{{list1}}" + when: useD != member +- name: create distribute array on primary + ibm_svc_mdisk: + clustername: "{{users_data[0].cluster_ip}}" + username: "{{users_data[0].cluster_username}}" + password: "{{users_data[0].cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: mdisk0 + state: present + level: "{{Level}}" + drivecount: "{{TotalDrive|int}}" + driveclass: 0 + encrypt: no + mdiskgrp: mdg0 + +- name: Get drive info + register: results + ibm_svcinfo_command: + command: "svcinfo lsdrive" + clustername: "{{users_data[1].cluster_ip}}" + username: "{{users_data[1].cluster_username}}" + password: "{{users_data[1].cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" +- name: show drive + set_fact: + kid: "{{item['id']}}" + loop: "{{ (results['stdout']) }}" +- name: show drive + set_fact: + useD1: "{{item['use']}}" + loop: "{{ (results['stdout']) }}" +- name: Drive count + set_fact: + TotalDrive2: "{{ kid|int + 1|int}}" +- name: set level + set_fact: + Level2: +- name: Decide Level + set_fact: + Level2: raid1 + when: (TotalDrive2|int <= 3 ) +- name: Decide Level + set_fact: + Level2: raid6 + when: (TotalDrive2|int > 3 ) +- name: Create a List of variable and print it + set_fact: + list2: [] +- name: create list + set_fact: + list2: "{{ query('sequence', user_range) }}" + vars: + start: 0 + end: "{{ kid|int }}" + user_range: "start={{ start }} end={{ end }} format=%d" +- name: set variable + set_fact: + member: member +- name: Make drive in candidate state + ibm_svctask_command: + command: [ "svctask chdrive -use candidate {{item}}" ] + clustername: "{{users_data[1].cluster_ip}}" + username: "{{users_data[1].cluster_username}}" + password: "{{users_data[1].cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + with_items: "{{list2}}" + when: useD1 != member +- name: create distribute array on secondary + ibm_svc_mdisk: + clustername: "{{users_data[1].cluster_ip}}" + username: "{{users_data[1].cluster_username}}" + password: "{{users_data[1].cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: mdisk0 + state: present + level: "{{Level2}}" + drivecount: "{{TotalDrive2|int}}" + driveclass: 0 + encrypt: no + mdiskgrp: mdg0 + +- name: Create provisioning policy on both the clusters + ibm_sv_manage_provisioning_policy: + clustername: "{{item.cluster_ip}}" + username: "{{item.cluster_username}}" + password: "{{item.cluster_password}}" + log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + name: provisioning_policy0 + capacitysaving: "drivebased" + state: present + loop: "{{users_data}}" From 03ea21c202629d5be4c0a2fbde735e515e788887 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Wed, 3 Apr 2024 12:16:30 +0530 Subject: [PATCH 15/25] Update PBR_variable.txt --- playbooks/PBR/PBR_variable.txt | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/playbooks/PBR/PBR_variable.txt b/playbooks/PBR/PBR_variable.txt index cc25567..e9de47a 100644 --- a/playbooks/PBR/PBR_variable.txt +++ b/playbooks/PBR/PBR_variable.txt @@ -1,14 +1,17 @@ -primary_cluster_name: < primary_cluster_name> -primary_cluster_ip: -primary_cluster_username: -primary_cluster_password: -secondary_cluster_name: -secondary_cluster_ip: -secondary_cluster_username: -secondary_cluster_password: -host_name: -volume_size: -volume_prefix: -volume_group_name: -number_of_volumes: -log_path: +- users_data: + - cluster_name: < primary_cluster_name> + cluster_ip: + cluster_username: + cluster_password: + + - cluster_name: + cluster_ip: + cluster_username: + cluster_password: + +- host_name: +- volume_size: +- volume_prefix: +- volume_group_name: +- number_of_volumes: +- log_path: From ab067415a380f8a8452bd9693b4a1425584b093f Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Wed, 3 Apr 2024 12:26:48 +0530 Subject: [PATCH 16/25] Update README.txt --- playbooks/PBR/README.txt | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/playbooks/PBR/README.txt b/playbooks/PBR/README.txt index c1f0e5e..913be18 100644 --- a/playbooks/PBR/README.txt +++ b/playbooks/PBR/README.txt @@ -7,24 +7,28 @@ Prerequisite: These playbook set up mTLS and configure Policy Based Replication between a primary cluster and the secondary cluster. - It uses storage virtualize ansible modules. - This playbook is designed to set up mTLS on both the site and configure Policy Based Replication between source cluster to destination cluster. This is designed in a way that it creates Data Reduction Pool , links them, creates provision policy and replication policy - - These playbooks also creates multiple Volumes with specified prefix along with volume group and maps all of them to the specified host + - These playbooks also creates multiple Volumes with specified prefix along with volume group and maps all of them to the specified host. - -There are total 3 files used for this use-case. +There are total 4 files used for this use-case. 1. PBR_variable.txt: This file has all the variables required for playbooks. - - primary_cluster* : Parameters starting with primary_cluster contain primary cluster details from where user wants to replicate data. - - secondary_cluster* : Parameters starting with secondary_cluster contain secondary cluster details to where volume will be replicated to - - volume* : Parameters starting volume contain details for volume such as name prefix for volume ,volume group and size for the volumes to be created. + - user_data : Parameters contain primary cluster details from where user wants to replicate data as well as secondary cluster details to where volume will be replicated to. + - host_name : It is the host name to which all the volumes should be mapped after creation. It assumes host is already created on primary clusters. + - volume* : Parameters starting volume contain details for volume such as name prefix for volume and size for the volumes to be created.It also has a volume group name - number_of_volumes : It is the number of volumes to be created between clusters. - - host_name : It is the host name to which all the volumes should be mapped after creation. It assumes host is already created on primary clusters. - log_path : It specifies the log path of playbook. If not specified then logs will generate at default path ‘/tmp/ansiblePB.debug’ 2. Create_mTLS.yml: - This playbook sets mTLS (Mutual Transport Layer Security) which includes ceritficate generation on individual cluster, export it to remote location , creates certificate truststore which contains the certificate bundle. This operation performed on primary as well as secondary site. + This playbook sets mTLS (Mutual Transport Layer Security) which includes ceritficate generation on individual cluster, export it to remote location , creates certificate truststore which contains the certificate bundle. This operation performed on primary as well as secondary site. This playbook is called under 'Create_PBR_config.yml'. + + 3. Create_mdiskgrp_drp_proviPolicy.yml: + This playbook check the drive status , drive count based on that it creates mdiskgrp, Data reduction Pool with specified level. It links pool of both the site. It creates provision policy, replication policy.This playbook is called under 'Create_PBR_config.yml'. + - 3. Create_PBR_config.yml: - This playbook check the drive status , drive count based on that it creates mdiskgrp, Data reduction Pool with specified level. It links pool of both the site. It creates provision policy, replication policy. It creates voulme group and associated volumes with volume_prefix name specified in inventroy file ‘PBR_variable.txt’. It also maps all the volumes to specified host.After first execution of this playbook for next execution we can add volumes on existing/new volume group with existing replication policy and provision policy . It mapped this newly added volumes to the existing host object. + 4. Create_PBR_config.yml: + This is main playbook file user need to execute only this playbook it leaverages rest of the 3 files. + It execute 2 playbooks like 'Create_mTLS.yml' and 'Create_mdiskgrp_drp_proviPolicy.yml' and later on this the playbook creates voulme group and associated volumes with volume_prefix name specified in inventroy file ‘PBR_variable.txt’. It also maps all the volumes to specified host. + After first execution of this playbook for next execution we can add volumes on existing/new volume group with existing replication policy and provision policy . It mapped this newly added volumes to the existing host object. Authors: Akshada Thorat (akshada.thorat@ibm.com) From 7078b9e0c2e6d5da5a5f9e1c1a463999c2d9101c Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:02:38 +0530 Subject: [PATCH 17/25] Update README.txt --- playbooks/PBR/README.txt | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/playbooks/PBR/README.txt b/playbooks/PBR/README.txt index 913be18..8acd853 100644 --- a/playbooks/PBR/README.txt +++ b/playbooks/PBR/README.txt @@ -2,7 +2,7 @@ Objective: Set up mTLS and configure Policy Based Replication. Prerequisite: -- IBM storage Virtualize ansible collection plugins must be installed +- IBM storage Virtualize ansible collection plugins must be installed. These playbook set up mTLS and configure Policy Based Replication between a primary cluster and the secondary cluster. - It uses storage virtualize ansible modules. @@ -10,25 +10,24 @@ These playbook set up mTLS and configure Policy Based Replication between a prim - These playbooks also creates multiple Volumes with specified prefix along with volume group and maps all of them to the specified host. There are total 4 files used for this use-case. - 1. PBR_variable.txt: + 1. mainplaybook.yml: + This is main playbook file user needs to execute only this playbook it leaverages rest of the 3 files. + It executes 2 playbooks like 'Create_mTLS.yml' and 'Create_mdiskgrp_drp_proviPolicy.yml' and later on this the playbook creates volume group and associated volumes with volume_prefix name specified in inventroy file ‘PBR_variable.txt’. It also maps all the volumes to specified host. + After first execution of this playbook for next execution we can add volumes on existing/new volume group with existing replication policy and provision policy. It mapped this newly added volumes to the existing host object. + + 2. PBR_inventory.yml: This file has all the variables required for playbooks. - user_data : Parameters contain primary cluster details from where user wants to replicate data as well as secondary cluster details to where volume will be replicated to. - - host_name : It is the host name to which all the volumes should be mapped after creation. It assumes host is already created on primary clusters. - - volume* : Parameters starting volume contain details for volume such as name prefix for volume and size for the volumes to be created.It also has a volume group name - - number_of_volumes : It is the number of volumes to be created between clusters. + - host_name : It is the host name to which all the volumes should be mapped after creation. It assumes host is already created on primary clusters. + - volume* : Parameters starting volume contain details for volume such as name prefix for volume and size for the volumes to be created.It also has a volume group name + - number_of_volumes : It is the number of volumes to be created between clusters. - log_path : It specifies the log path of playbook. If not specified then logs will generate at default path ‘/tmp/ansiblePB.debug’ - 2. Create_mTLS.yml: - This playbook sets mTLS (Mutual Transport Layer Security) which includes ceritficate generation on individual cluster, export it to remote location , creates certificate truststore which contains the certificate bundle. This operation performed on primary as well as secondary site. This playbook is called under 'Create_PBR_config.yml'. - - 3. Create_mdiskgrp_drp_proviPolicy.yml: - This playbook check the drive status , drive count based on that it creates mdiskgrp, Data reduction Pool with specified level. It links pool of both the site. It creates provision policy, replication policy.This playbook is called under 'Create_PBR_config.yml'. - + 3. Create_mTLS.yml: + This playbook sets mTLS (Mutual Transport Layer Security) which includes ceritficate generation on individual cluster, export it to remote location, creates certificate truststore which contains the certificate bundle. This operation performed on primary as well as secondary site. This playbook is called under 'Create_PBR_config.yml'. - 4. Create_PBR_config.yml: - This is main playbook file user need to execute only this playbook it leaverages rest of the 3 files. - It execute 2 playbooks like 'Create_mTLS.yml' and 'Create_mdiskgrp_drp_proviPolicy.yml' and later on this the playbook creates voulme group and associated volumes with volume_prefix name specified in inventroy file ‘PBR_variable.txt’. It also maps all the volumes to specified host. - After first execution of this playbook for next execution we can add volumes on existing/new volume group with existing replication policy and provision policy . It mapped this newly added volumes to the existing host object. + 4. Create_mdiskgrp_drp_proviPolicy.yml: + This playbook check the drive status, drive count based on that it creates mdiskgrp, Data reduction Pool with specified level. It links pool of both the site. It creates provision policy, replication policy.This playbook is called under 'Create_PBR_config.yml'. Authors: Akshada Thorat (akshada.thorat@ibm.com) From 3dcad4d8fb58c747657ba046c9c4dd23eb6c8c4b Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:03:40 +0530 Subject: [PATCH 18/25] Rename Create_PBR_config.yml to mainplaybook.yml --- playbooks/PBR/{Create_PBR_config.yml => mainplaybook.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename playbooks/PBR/{Create_PBR_config.yml => mainplaybook.yml} (100%) diff --git a/playbooks/PBR/Create_PBR_config.yml b/playbooks/PBR/mainplaybook.yml similarity index 100% rename from playbooks/PBR/Create_PBR_config.yml rename to playbooks/PBR/mainplaybook.yml From 2ff3b5485c8c60c1036187b78be67603e981eeb4 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:04:05 +0530 Subject: [PATCH 19/25] Rename PBR_variable.txt to PBR_variable.yml --- playbooks/PBR/{PBR_variable.txt => PBR_variable.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename playbooks/PBR/{PBR_variable.txt => PBR_variable.yml} (100%) diff --git a/playbooks/PBR/PBR_variable.txt b/playbooks/PBR/PBR_variable.yml similarity index 100% rename from playbooks/PBR/PBR_variable.txt rename to playbooks/PBR/PBR_variable.yml From 91d3ed24dc565ffef4ca287ac19df02f7e6d866b Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:04:23 +0530 Subject: [PATCH 20/25] Update mainplaybook.yml --- playbooks/PBR/mainplaybook.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/PBR/mainplaybook.yml b/playbooks/PBR/mainplaybook.yml index 0e6188d..faf96d6 100644 --- a/playbooks/PBR/mainplaybook.yml +++ b/playbooks/PBR/mainplaybook.yml @@ -5,7 +5,7 @@ gather_facts: no connection: local vars_files: - - PBR_variable.txt + - PBR_variable.yml tasks: - name: Create mTLS on both the clusters include_tasks: Create_mTLS.yml From ad7b7b51d1ff2a86bb7d991a31353a0036a81ec3 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:58:02 +0530 Subject: [PATCH 21/25] Update mainplaybook.yml --- playbooks/PBR/mainplaybook.yml | 68 +++++++++++++++++----------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/playbooks/PBR/mainplaybook.yml b/playbooks/PBR/mainplaybook.yml index faf96d6..da7f146 100644 --- a/playbooks/PBR/mainplaybook.yml +++ b/playbooks/PBR/mainplaybook.yml @@ -6,6 +6,9 @@ connection: local vars_files: - PBR_variable.yml + vars: + volume_count: "{{number_of_volumes | default(10)}}" + vol_prefix: "{{volume_prefix | default('vol_')}}" tasks: - name: Create mTLS on both the clusters include_tasks: Create_mTLS.yml @@ -25,10 +28,12 @@ username: "{{users_data[0].cluster_username}}" password: "{{users_data[0].cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + - name: show mdiskgrp status set_fact: uid: "{{item['replication_pool_link_uid']}}" loop: "{{ (results['stdout']) }}" + - name: Get primary cluster id info register: results ibm_svcinfo_command: @@ -37,10 +42,12 @@ username: "{{users_data[1].cluster_username}}" password: "{{users_data[1].cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + - name: show cluster id set_fact: uid1: "{{item['id']}}" loop: "{{ (results['stdout']) }}" + - name: Get secondary cluster id info register: results ibm_svcinfo_command: @@ -49,10 +56,12 @@ username: "{{users_data[0].cluster_username}}" password: "{{users_data[0].cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + - name: show cluster id set_fact: uid2: "{{item['id']}}" loop: "{{ (results['stdout']) }}" + - name: set provisionpolicy and replicationpoollinkuid on primary site ibm_svc_mdiskgrp: clustername: "{{users_data[0].cluster_ip}}" @@ -64,6 +73,7 @@ replicationpoollinkuid: "{{uid}}" replication_partner_clusterid: "{{uid2}}" provisioningpolicy: provisioning_policy0 + - name: set provisionpolicy and replicationpoollinkuid on secondary site ibm_svc_mdiskgrp: clustername: "{{users_data[1].cluster_ip}}" @@ -75,13 +85,14 @@ replicationpoollinkuid: "{{uid}}" replication_partner_clusterid: "{{uid1}}" provisioningpolicy: provisioning_policy0 + - name: Create replication policy ibm_sv_manage_replication_policy: clustername: "{{users_data[0].cluster_ip}}" username: "{{users_data[0].cluster_username}}" password: "{{users_data[0].cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: reppoli + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" + name: replication_policy_1 topology: 2-site-async-dr location1system: "{{uid1}}" location1iogrp: 0 @@ -89,83 +100,70 @@ location2iogrp: 0 rpoalert: 300 state: present + - name: Create volume group ibm_svc_manage_volumegroup: clustername: "{{users_data[0].cluster_ip}}" username: "{{users_data[0].cluster_username}}" password: "{{users_data[0].cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" name: "{{volume_group_name}}" - replicationpolicy: reppoli + replicationpolicy: replication_policy_1 state: present - - name: Create a List of variable and print it - set_fact: - list: [] - - name: create list - set_fact: - list: "{{ query('sequence', user_range) }}" - vars: - start: 1 - end: "{{ number_of_volumes | default(10) }}" - user_range: "start={{ start }} end={{ end }} format=%d" - - name: set default prefix - set_fact: - vol_: vol_ - - name: Create a Prefix list variable and print it - set_fact: - prefix_list: [] - - name: create prefix list - set_fact: - prefix_list: "{{ [volume_prefix | default(vol_)] | product(list) | map('join') }}" + - name: Create master volume ibm_svc_manage_volume: clustername: "{{users_data[0].cluster_ip}}" username: "{{users_data[0].cluster_username}}" password: "{{users_data[0].cluster_password}}" - log_path: "{{ log_path | default('/tmp/playbook1.debug') }}" - name: vo1 + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" + name: vol state: present pool: "mdg0" size: "2" unit: gb + - name: Create volume ibm_svc_manage_volume: clustername: "{{users_data[0].cluster_ip}}" username: "{{users_data[0].cluster_username}}" password: "{{users_data[0].cluster_password}}" - log_path: "{{ log_path | default('/tmp/playbook1.debug') }}" - name: vo1 + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" + name: vol state: present volumegroup: "{{volume_group_name}}" + - name: Create volumes ibm_svc_manage_volume: clustername: "{{users_data[0].cluster_ip}}" username: "{{users_data[0].cluster_username}}" password: "{{users_data[0].cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - name: "{{item}}" + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" + name: "{{vol_prefix}}{{item}}" state: "present" pool: "mdg0" size: "{{volume_size}}" unit: "gb" volumegroup: "{{volume_group_name}}" - with_items: "{{prefix_list}}" + with_sequence: start=1 end="{{volume_count}}" + - name: Delete volume ibm_svc_manage_volume: clustername: "{{users_data[0].cluster_ip}}" username: "{{users_data[0].cluster_username}}" password: "{{users_data[0].cluster_password}}" - log_path: "{{ log_path | default('/tmp/playbook1.debug') }}" - name: vo1 + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" + name: vol state: absent + - name: masterVdisks-host mapping register: results ibm_svc_vol_map: clustername: "{{users_data[0].cluster_ip}}" username: "{{users_data[0].cluster_username}}" password: "{{users_data[0].cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" state: present - volname: "{{item}}" + volname: "{{vol_prefix}}{{item}}" host: "{{host_name}}" - with_items: "{{prefix_list}}" + with_sequence: start=1 end="{{volume_count}}" From 23a2624d5f5618abe4230a3742a0de677f742047 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:58:50 +0530 Subject: [PATCH 22/25] Update Create_mdiskgrp_drp_proviPolicy.yml --- .../PBR/Create_mdiskgrp_drp_proviPolicy.yml | 98 ++++++++++--------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/playbooks/PBR/Create_mdiskgrp_drp_proviPolicy.yml b/playbooks/PBR/Create_mdiskgrp_drp_proviPolicy.yml index 780181a..48dfb56 100644 --- a/playbooks/PBR/Create_mdiskgrp_drp_proviPolicy.yml +++ b/playbooks/PBR/Create_mdiskgrp_drp_proviPolicy.yml @@ -17,57 +17,60 @@ clustername: "{{users_data[0].cluster_ip}}" username: "{{users_data[0].cluster_username}}" password: "{{users_data[0].cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" -- name: show drive + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" + +- name: set drive id set_fact: - kid: "{{item['id']}}" - loop: "{{ (results['stdout']) }}" -- name: show drive + drive_id: "{{item['id']}}" + loop: "{{(results['stdout'])}}" + +- name: set drive status set_fact: - useD: "{{item['use']}}" - loop: "{{ (results['stdout']) }}" -- name: Drive count + drive_status: "{{item['use']}}" + loop: "{{(results['stdout'])}}" + +- name: Set drive count set_fact: - TotalDrive: "{{ kid|int + 1|int}}" + TotalDrive: "{{drive_id|int + 1|int}}" + - name: set level set_fact: - Level: + Level: + - name: Decide Level set_fact: Level: raid1 - when: (TotalDrive|int <= 3 ) + when: (TotalDrive|int <= 3) + - name: Decide Level set_fact: Level: raid6 - when: (TotalDrive|int > 3 ) -- name: Create a List of variable and print it + when: (TotalDrive|int > 3) + +- name: Create a List of variable set_fact: list1: [] -- name: create list - set_fact: - list1: "{{ query('sequence', user_range) }}" - vars: - start: 0 - end: "{{ kid|int }}" - user_range: "start={{ start }} end={{ end }} format=%d" + - name: set variable set_fact: member: member + - name: Make drive in candidate state ibm_svctask_command: command: [ "svctask chdrive -use candidate {{item}}" ] clustername: "{{users_data[0].cluster_ip}}" username: "{{users_data[0].cluster_username}}" password: "{{users_data[0].cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - with_items: "{{list1}}" - when: useD != member + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" + with_sequence: start=0 end="{{drive_id}}" + when: drive_status != member + - name: create distribute array on primary ibm_svc_mdisk: clustername: "{{users_data[0].cluster_ip}}" username: "{{users_data[0].cluster_username}}" password: "{{users_data[0].cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" name: mdisk0 state: present level: "{{Level}}" @@ -83,42 +86,40 @@ clustername: "{{users_data[1].cluster_ip}}" username: "{{users_data[1].cluster_username}}" password: "{{users_data[1].cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" -- name: show drive + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" + +- name: set drive id set_fact: - kid: "{{item['id']}}" - loop: "{{ (results['stdout']) }}" -- name: show drive + drive_id: "{{item['id']}}" + loop: "{{(results['stdout'])}}" + +- name: set drive status set_fact: - useD1: "{{item['use']}}" - loop: "{{ (results['stdout']) }}" + drive_status1: "{{item['use']}}" + loop: "{{(results['stdout'])}}" + - name: Drive count set_fact: - TotalDrive2: "{{ kid|int + 1|int}}" + TotalDrive2: "{{drive_id|int + 1|int}}" + - name: set level set_fact: - Level2: + Level2: + - name: Decide Level set_fact: Level2: raid1 when: (TotalDrive2|int <= 3 ) + - name: Decide Level set_fact: Level2: raid6 when: (TotalDrive2|int > 3 ) -- name: Create a List of variable and print it - set_fact: - list2: [] -- name: create list - set_fact: - list2: "{{ query('sequence', user_range) }}" - vars: - start: 0 - end: "{{ kid|int }}" - user_range: "start={{ start }} end={{ end }} format=%d" -- name: set variable + +- name: set variable as a member set_fact: member: member + - name: Make drive in candidate state ibm_svctask_command: command: [ "svctask chdrive -use candidate {{item}}" ] @@ -126,14 +127,15 @@ username: "{{users_data[1].cluster_username}}" password: "{{users_data[1].cluster_password}}" log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" - with_items: "{{list2}}" - when: useD1 != member + with_sequence: start=0 end="{{drive_id}}" + when: drive_status1 != member + - name: create distribute array on secondary ibm_svc_mdisk: clustername: "{{users_data[1].cluster_ip}}" username: "{{users_data[1].cluster_username}}" password: "{{users_data[1].cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" name: mdisk0 state: present level: "{{Level2}}" @@ -147,7 +149,7 @@ clustername: "{{item.cluster_ip}}" username: "{{item.cluster_username}}" password: "{{item.cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" name: provisioning_policy0 capacitysaving: "drivebased" state: present From fcb041517d013f1ed5f1da5aee8200df838d5c97 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Wed, 24 Apr 2024 11:00:40 +0530 Subject: [PATCH 23/25] Update README.txt --- playbooks/PBR/README.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/playbooks/PBR/README.txt b/playbooks/PBR/README.txt index 8acd853..dcf92b3 100644 --- a/playbooks/PBR/README.txt +++ b/playbooks/PBR/README.txt @@ -23,11 +23,10 @@ There are total 4 files used for this use-case. - number_of_volumes : It is the number of volumes to be created between clusters. - log_path : It specifies the log path of playbook. If not specified then logs will generate at default path ‘/tmp/ansiblePB.debug’ - 3. Create_mTLS.yml: This playbook sets mTLS (Mutual Transport Layer Security) which includes ceritficate generation on individual cluster, export it to remote location, creates certificate truststore which contains the certificate bundle. This operation performed on primary as well as secondary site. This playbook is called under 'Create_PBR_config.yml'. 4. Create_mdiskgrp_drp_proviPolicy.yml: This playbook check the drive status, drive count based on that it creates mdiskgrp, Data reduction Pool with specified level. It links pool of both the site. It creates provision policy, replication policy.This playbook is called under 'Create_PBR_config.yml'. - Authors: Akshada Thorat (akshada.thorat@ibm.com) + Authors: Akshada Thorat (akshada.thorat@ibm.com) , Sandip Rajbanshi (Sandip.Rajbanshi@ibm.com) From af70d498611c0d4d2226da14343ffd3e133c2f46 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Wed, 24 Apr 2024 11:01:27 +0530 Subject: [PATCH 24/25] Update Create_mTLs.yml --- playbooks/PBR/Create_mTLs.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/playbooks/PBR/Create_mTLs.yml b/playbooks/PBR/Create_mTLs.yml index 827d2af..afc3563 100644 --- a/playbooks/PBR/Create_mTLs.yml +++ b/playbooks/PBR/Create_mTLs.yml @@ -1,10 +1,10 @@ - name: Generate certificate ibm_svctask_command: - command: [ "svctask chsystemcert -mkselfsigned" ] + command: "svctask chsystemcert -mkselfsigned" clustername: "{{item.cluster_ip}}" username: "{{item.cluster_username}}" password: "{{item.cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" loop: "{{users_data}}" - name: Export SSL certificate internally @@ -12,7 +12,7 @@ clustername: "{{item.cluster_ip}}" username: "{{item.cluster_username}}" password: "{{item.cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" certificate_type: "system" loop: "{{users_data}}" @@ -33,7 +33,7 @@ clustername: "{{users_data[1].cluster_ip}}" username: "{{users_data[1].cluster_username}}" password: "{{users_data[1].cluster_password}}" - log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" + log_path: "{{log_path | default('/tmp/ansiblePB.debug')}}" name: trust remote_clustername: "{{users_data[0].cluster_ip}}" remote_username: "{{users_data[0].cluster_username}}" From b206d754b15132f7c6fbcf92fa6f6168d92d01b5 Mon Sep 17 00:00:00 2001 From: Akshada-Thorat <137146798+Akshada-Thorat@users.noreply.github.com> Date: Wed, 24 Apr 2024 11:18:35 +0530 Subject: [PATCH 25/25] Rename mainplaybook.yml to main.yml --- playbooks/PBR/{mainplaybook.yml => main.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename playbooks/PBR/{mainplaybook.yml => main.yml} (100%) diff --git a/playbooks/PBR/mainplaybook.yml b/playbooks/PBR/main.yml similarity index 100% rename from playbooks/PBR/mainplaybook.yml rename to playbooks/PBR/main.yml