generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 10
Added ansible playbook for creating Policy Based Replication config #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Akshada-Thorat
wants to merge
25
commits into
ansible-collections:develop
Choose a base branch
from
Akshada-Thorat:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
faccbe6
Create Create_PBR_config.yml
Akshada-Thorat 546384f
Create PBR_variable.txt
Akshada-Thorat 1d3e251
Create README.txt
Akshada-Thorat 32c9c05
Update PBR_variable.txt
Akshada-Thorat a6178f4
Update Create_PBR_config.yml
Akshada-Thorat 8e3e997
Create Create_mTLs.yml
Akshada-Thorat 4e5d676
Update PBR_variable.txt
Akshada-Thorat d31200a
Update README.txt
Akshada-Thorat 24121bd
Update Create_PBR_config.yml
Akshada-Thorat d71966c
Create Create_mdiskgrp_drp.yml
Akshada-Thorat a2d18e7
Update Create_PBR_config.yml
Akshada-Thorat e26e933
Update Create_PBR_config.yml
Akshada-Thorat c58160d
Update Create_mTLs.yml
Akshada-Thorat 7ffc429
Update and rename Create_mdiskgrp_drp.yml to Create_mdiskgrp_drp_prov…
Akshada-Thorat 03ea21c
Update PBR_variable.txt
Akshada-Thorat ab06741
Update README.txt
Akshada-Thorat 7078b9e
Update README.txt
Akshada-Thorat 3dcad4d
Rename Create_PBR_config.yml to mainplaybook.yml
Akshada-Thorat 2ff3b54
Rename PBR_variable.txt to PBR_variable.yml
Akshada-Thorat 91d3ed2
Update mainplaybook.yml
Akshada-Thorat ad7b7b5
Update mainplaybook.yml
Akshada-Thorat 23a2624
Update Create_mdiskgrp_drp_proviPolicy.yml
Akshada-Thorat fcb0415
Update README.txt
Akshada-Thorat af70d49
Update Create_mTLs.yml
Akshada-Thorat b206d75
Rename mainplaybook.yml to main.yml
Akshada-Thorat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ([email protected]) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove these hard coded values