├── .gitignore ├── ActiveIQ └── get_capacity_example.ps1 ├── LICENSE ├── README.md ├── ntaplod_init ├── docker_images │ ├── awx_17_lod_db_images.tar.gz.aa │ └── awx_17_lod_db_images.tar.gz.ab ├── ontapapi_sl10599_init.sh ├── ontapapi_sl10599_init_helper │ ├── init_inventory │ ├── sl10599_init_ad.yml │ ├── sl10599_init_awx.yml │ └── sl10599_init_cluster.sh └── storagegrid_sl10610_init.sh ├── ontap9 ├── ansible │ ├── 01_get_cluster_details.yml │ ├── 02_get_svm_details.yml │ ├── 03_get_filesystem_details.yml │ ├── 05_check_cluster.yml │ ├── 05_check_cluster_silent.yml │ ├── 11_create_ipspace_pri_clu.yml │ ├── 12_create_vlanmgmt_pri_clu.yml │ ├── 13_create_vlandata_pri_clu.yml │ ├── 14_create_bcdomainmgmt_pri_clu.yml │ ├── 15_create_bcdomaindata_pri_clu.yml │ ├── 16_create_subnetmgmt_pri_clu.yml │ ├── 17_create_subnetdata_pri_clu.yml │ ├── 21_create_pri_svm.yml │ ├── 22_create_mgmtlif_pri_svm.yml │ ├── 23_create_dns_pri_svm.yml │ ├── 25_create_cifslif_pri_svm.yml │ ├── 25_create_iscsilif_pri_svm.yml │ ├── 25_create_nfslif_pri_svm.yml │ ├── 26_create_cifs_pri_svm.yml │ ├── 26_create_iscsi_pri_svm.yml │ ├── 26_create_nfs_pri_svm.yml │ ├── 27_create_qospolicy_pri_svm.yml │ ├── 31_create_cifsvol_pri_svm.yml │ ├── 32_create_cifsqtree_pri_svm.yml │ ├── 33_create_cifsshare_pri_svm.yml │ ├── 36_create_nfsvol_pri_svm.yml │ ├── 37_create_nfsqtree_pri_svm.yml │ ├── 41_create_iscsiwinvol_pri_svm.yml │ ├── 42_create_iscsiwinlun_pri_svm.yml │ ├── 43_create_winigroup_pri_svm.yml │ ├── 44_create_winlunmap_pri_svm.yml │ ├── 46_create_iscsilinvol_pri_svm.yml │ ├── 47_create_iscsilinlun_pri_svm.yml │ ├── 48_create_linigroup_pri_svm.yml │ ├── 49_create_linlunmap_pri_svm.yml │ └── 90_delete_all.yml ├── ansible_pilot │ ├── host_vars │ │ ├── cluster1 │ │ └── cluster2 │ ├── ontap_inventory │ ├── pilot_play.yml │ ├── pilot_play_ip_interface.yml │ └── roles │ │ ├── ontap_ip_interface │ │ ├── README.md │ │ ├── defaults │ │ │ └── main.yml │ │ ├── handlers │ │ │ └── main.yml │ │ ├── meta │ │ │ └── main.yml │ │ ├── tasks │ │ │ └── main.yml │ │ ├── tests │ │ │ ├── inventory │ │ │ └── test.yml │ │ └── vars │ │ │ └── main.yml │ │ ├── ontap_svm │ │ ├── README.md │ │ ├── defaults │ │ │ └── main.yml │ │ ├── handlers │ │ │ └── main.yml │ │ ├── meta │ │ │ └── main.yml │ │ ├── tasks │ │ │ └── main.yml │ │ ├── tests │ │ │ ├── inventory │ │ │ └── test.yml │ │ └── vars │ │ │ └── main.yml │ │ └── ontap_volume │ │ ├── README.md │ │ ├── defaults │ │ └── main.yml │ │ ├── handlers │ │ └── main.yml │ │ ├── meta │ │ └── main.yml │ │ ├── tasks │ │ └── main.yml │ │ ├── tests │ │ ├── inventory │ │ └── test.yml │ │ └── vars │ │ └── main.yml ├── awx │ ├── 20_awxdemo_svm_create.yml │ ├── 30_awxdemo_fullcifs_create.yml │ ├── 35_awxdemo_fullnfs_create.yml │ ├── 40_awxdemo_fulliscsiwin_create.yml │ ├── 45_awxdemo_fulliscsilin_create.yml │ ├── 90_awxdemo_full_delete.yml │ ├── requirements.yml │ └── roles │ │ ├── awxdemo_full_delete │ │ ├── LICENSE │ │ ├── README.md │ │ ├── defaults │ │ │ └── main.yml │ │ ├── handlers │ │ │ └── main.yml │ │ ├── meta │ │ │ └── main.yml │ │ ├── tasks │ │ │ └── main.yml │ │ ├── tests │ │ │ ├── inventory │ │ │ └── test.yml │ │ └── vars │ │ │ └── main.yml │ │ ├── awxdemo_fullcifs_create │ │ ├── LICENSE │ │ ├── README.md │ │ ├── defaults │ │ │ └── main.yml │ │ ├── handlers │ │ │ └── main.yml │ │ ├── meta │ │ │ └── main.yml │ │ ├── tasks │ │ │ └── main.yml │ │ ├── tests │ │ │ ├── inventory │ │ │ └── test.yml │ │ └── vars │ │ │ └── main.yml │ │ ├── awxdemo_fulliscsilin_create │ │ ├── LICENSE │ │ ├── README.md │ │ ├── defaults │ │ │ └── main.yml │ │ ├── handlers │ │ │ └── main.yml │ │ ├── meta │ │ │ └── main.yml │ │ ├── tasks │ │ │ └── main.yml │ │ ├── tests │ │ │ ├── inventory │ │ │ └── test.yml │ │ └── vars │ │ │ └── main.yml │ │ ├── awxdemo_fulliscsiwin_create │ │ ├── LICENSE │ │ ├── README.md │ │ ├── defaults │ │ │ └── main.yml │ │ ├── handlers │ │ │ └── main.yml │ │ ├── meta │ │ │ └── main.yml │ │ ├── tasks │ │ │ └── main.yml │ │ ├── tests │ │ │ ├── inventory │ │ │ └── test.yml │ │ └── vars │ │ │ └── main.yml │ │ ├── awxdemo_fullnfs_create │ │ ├── LICENSE │ │ ├── README.md │ │ ├── defaults │ │ │ └── main.yml │ │ ├── handlers │ │ │ └── main.yml │ │ ├── meta │ │ │ └── main.yml │ │ ├── tasks │ │ │ └── main.yml │ │ ├── tests │ │ │ ├── inventory │ │ │ └── test.yml │ │ └── vars │ │ │ └── main.yml │ │ └── awxdemo_svm_create │ │ ├── LICENSE │ │ ├── README.md │ │ ├── defaults │ │ └── main.yml │ │ ├── handlers │ │ └── main.yml │ │ ├── meta │ │ └── main.yml │ │ ├── tasks │ │ └── main.yml │ │ ├── tests │ │ ├── inventory │ │ └── test.yml │ │ └── vars │ │ └── main.yml ├── curl │ ├── 01_get_cluster_details.curl │ ├── 02_get_svm_details.curl │ ├── 03_get_filesystem_details.curl │ ├── 21_create_pri_svm.curl │ ├── 22_create_mgmtlif_pri_svm.curl │ ├── 23_create_dns_pri_svm.curl │ ├── 24_create_snappolicy.curl │ ├── 25_create_cifslif_pri_svm.curl │ ├── 25_create_nfslif_pri_svm.curl │ ├── 26_create_cifs_pri_svm.curl │ ├── 26_create_nfs_pri_svm.curl │ ├── 31_create_cifsvol_pri_svm.curl │ ├── 32_create_cifsqtree_pri_svm.curl │ ├── 33_create_cifsshare_pri_svm.curl │ ├── 36_create_nfsvol_pri_svm.curl │ ├── 37_create_nfsqtree_pri_svm.curl │ ├── 51_create_iclif_pri_clu.curl │ ├── 52_create_iclif_sec_clu.curl │ ├── 53_create_cluster_peer.curl │ ├── 61_create_sec_svm.curl │ ├── 62_create_mgmtlif_sec_svm.curl │ ├── 63_create_dns_sec_svm.curl │ ├── 64_create_cifs_sec_svm.curl │ ├── 65_create_cifslif_sec_svm.curl │ ├── 66_create_nfs_sec_svm.curl │ ├── 67_create_nfslif_sec_svm.curl │ ├── 68_create_mirrorpolicy.curl │ └── 90_delete_all.curl ├── global.vars ├── playground │ ├── aiqum_test_script.sh │ ├── awx_aiqum_inventory.py │ ├── awx_ci_inventory.py │ ├── get_snaps_final.yml │ ├── get_snaps_rest_final.yml │ └── vol_create_by_iops.yml ├── powershell │ ├── 00_certs_and_protocols.ps1 │ ├── 01_get_cluster_details.ps1 │ └── 21_create_pri_svm.ps1 └── python │ ├── 01_get_cluster_details.py │ ├── 02_get_svm_details.py │ ├── 03_get_filesystem_details.py │ ├── 21_create_pri_svm.py │ ├── 22_create_mgmtlif_pri_svm.py │ ├── 23_create_dns_pri_svm.py │ ├── 25_create_cifslif_pri_svm.py │ ├── 25_create_nfslif_pri_svm.py │ ├── 26_create_cifs_pri_svm.py │ ├── 26_create_nfs_pri_svm.py │ ├── 31_create_cifsvol_pri_svm.py │ ├── 32_create_cifsqtree_pri_svm.py │ ├── 33_create_cifsshare_pri_svm.py │ ├── 36_create_nfsvol_pri_svm.py │ ├── 37_create_nfsqtree_pri_svm.py │ └── 90_delete_all.py └── storagegrid ├── ansible ├── 01_get_grid_details.yml ├── 02_get_all_tenant_details.yml ├── 02_get_single_tenant_details.yml ├── 03_get_bucket_details.yml ├── 21_create_tenant.yml ├── 22_create_tenant_group.yml ├── 23_create_tenant_user.yml ├── 24_create_s3credentials.yml ├── 31_create_s3bucket.yml ├── 41_create_hagroup.yml ├── 80_onboard_new_app.yml ├── 90_delete_all.yml └── 91_delete_new_app.yml ├── global.vars ├── new_app.vars └── python ├── 01_get_grid_details.py ├── 02_get_tenant_details.py ├── 03_get_bucket_details.py ├── 21_create_tenant.py ├── 22_create_tenant_group.py ├── 23_create_tenant_user.py ├── 24_create_s3credentials.py ├── 31_create_s3bucket.py ├── 80_onboard_new_app.py ├── 90_delete_all.py └── 91_delete_new_app.py /.gitignore: -------------------------------------------------------------------------------- 1 | tokens.json 2 | 3 | # OS generated files 4 | .DS_Store 5 | .DS_Store? 6 | ._* 7 | .Spotlight-V100 8 | .Trashes 9 | ehthumbs.db 10 | Thumbs.db 11 | 12 | # exclude output folders 13 | cred_store/* 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NetApp Automation Demos 2 | 3 | Welcome to my collection of automation demos. In this repository you will find various examples on how to automate administrative and operational tasks on NetApp solutions. The main purpose is enabling you writing your own scripts/integartions by providing simple examples in small chunks. The scripts in this repository are not tuned for production use. 4 | 5 | ## Quick Start - ONTAP 6 | If you are a customer, partner or NetApp employee: 7 | 8 | 1. Please use the virtual hands-on lab (log in with your NetApp support account): 9 | - https://labondemand.netapp.com/search/ontapapi 10 | 11 | 2. Log into the Ansible Linux host ("ansible.demo.netapp.com") and clone this repository: 12 | ``` 13 | # git clone https://github.com/AdrianBronder/ntap-automation.git 14 | ``` 15 | 16 | 3. Initialize the environment by running the lab init script: 17 | ``` 18 | # sudo ./ntap-automation/ntaplod_init/ontapapi_sl10599_init.sh 19 | ``` 20 | 21 | 4. Execute scripts from subfolders depending on type of solution, method and task, e.g.: ontap9 --> python --> create SVM 22 | ``` 23 | # ./ntap-automation/ontap9/ansible/21_create_pri_svm.yml 24 | # ./ntap-automation/ontap9/curl/02_get_svm_details.curl 25 | # ./ntap-automation/ontap9/python/90_delete_all.py 26 | ``` 27 | 28 | 29 | ## Quick Start - StorageGRID 30 | If you are a customer, partner or NetApp employee: 31 | 32 | 1. Please use the virtual hands-on lab (log in with your NetApp support account): 33 | - Customer: https://labondemand.netapp.com/lab/storagegrid 34 | - NetApp/Partner: https://labondemand.netapp.com/lab/storagegrid-hol 35 | 36 | 2. Log into the first Linux machine (Linux1) and make sure "git" utilities are installed on the machine: 37 | ``` 38 | # yum install git -y 39 | ``` 40 | 41 | 3. Clone this repository: 42 | ``` 43 | # git clone https://github.com/AdrianBronder/ntap-automation.git 44 | ``` 45 | 46 | 4. Initialize the environment by running the lab init script (Ansible collections for StorageGRID have to be loaded and installed manually): 47 | ``` 48 | # ./ntap-automation/ntaplod_init/storagegrid_sl10610_init.sh 49 | ``` 50 | 51 | 5. Execute scripts from subfolders depending on type of solution, method and task, e.g.: storagegrid --> ansible --> create tenant 52 | ``` 53 | # ./ntap-automation/storagegrid/ansible/21_create_tenant.yml 54 | ``` 55 | -------------------------------------------------------------------------------- /ntaplod_init/docker_images/awx_17_lod_db_images.tar.gz.aa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdrianBronder/ntap-automation/956f72d77c12181ba8f43a509fcbb7906f02228e/ntaplod_init/docker_images/awx_17_lod_db_images.tar.gz.aa -------------------------------------------------------------------------------- /ntaplod_init/docker_images/awx_17_lod_db_images.tar.gz.ab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AdrianBronder/ntap-automation/956f72d77c12181ba8f43a509fcbb7906f02228e/ntaplod_init/docker_images/awx_17_lod_db_images.tar.gz.ab -------------------------------------------------------------------------------- /ntaplod_init/ontapapi_sl10599_init_helper/init_inventory: -------------------------------------------------------------------------------- 1 | [rhel] 2 | rhel1 3 | rhel2 4 | 5 | [ontap] 6 | cluster1 7 | cluster2 8 | 9 | [windows] 10 | dc1 11 | jumphost 12 | 13 | [windows:vars] 14 | ansible_user=Administrator@DEMO.NETAPP.COM 15 | ansible_password=Netapp1! 16 | ansible_connection=winrm 17 | ansible_winrm_transport=kerberos 18 | ansible_port=5985 19 | ansible_winrm_message_encryption=auto 20 | -------------------------------------------------------------------------------- /ntaplod_init/ontapapi_sl10599_init_helper/sl10599_init_ad.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: sl10599_init_ad.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-10-13 8 | # Description: Configure users and groups in Active Directoy 9 | # 10 | # Collections: community.windows 11 | # 12 | # URL: https://galaxy.ansible.com/community/windows 13 | # 14 | ################################################################################ 15 | 16 | - hosts: dc1 17 | gather_facts: false 18 | vars: 19 | ad_awx_org_groups: 20 | - name: "LoD Org Admins" 21 | users: 22 | - LoD_Org_Admin_01 23 | - LoD_Org_Admin_02 24 | - name: "LoD Org Users" 25 | users: 26 | - LoD_Org_User_01 27 | - LoD_Org_User_02 28 | - name: "LoD Org Approvers" 29 | users: 30 | - LoD_Org_Approver_01 31 | - LoD_Org_Approver_02 32 | - name: "LoD Org Auditors" 33 | users: 34 | - LoD_Org_Auditor_01 35 | - LoD_Org_Auditor_02 36 | collections: 37 | - community.windows 38 | 39 | tasks: 40 | - name: creating AWX LDAP Bind User 41 | win_domain_user: 42 | state: present 43 | name: "AWX_Bind" 44 | path: "CN=Users,DC=demo,DC=netapp,DC=com" 45 | password: "Netapp1!" 46 | update_password: "on_create" 47 | password_never_expires: "yes" 48 | user_cannot_change_password: "yes" 49 | groups: 50 | - "Domain Admins" 51 | 52 | - name: creating LoD Groups in AD 53 | win_domain_group: 54 | state: present 55 | name: "{{ item.name }}" 56 | scope: "global" 57 | path: "CN=Users,DC=demo,DC=netapp,DC=com" 58 | loop: 59 | "{{ ad_awx_org_groups }}" 60 | 61 | - name: creating LoD Users in AD 62 | win_domain_user: 63 | state: present 64 | name: "{{ item.1 }}" 65 | path: "CN=Users,DC=demo,DC=netapp,DC=com" 66 | password: "Netapp1!" 67 | update_password: "on_create" 68 | password_never_expires: "yes" 69 | user_cannot_change_password: "yes" 70 | groups: 71 | - "{{ item.0.name }}" 72 | with_subelements: 73 | - "{{ ad_awx_org_groups }}" 74 | - users 75 | 76 | -------------------------------------------------------------------------------- /ntaplod_init/ontapapi_sl10599_init_helper/sl10599_init_cluster.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: sl10599_init_cluster.sh 6 | # Author: Adrian Bronder 7 | # Date: 2020-09-03 8 | # Description: Prepare primary storage cluster "cluster1" in LoD lab sl10599 9 | # --> "Exploring the ONTAP REST API v1.2" 10 | # 11 | # URLs: https://labondemand.netapp.com/lab/sl10599 12 | # http://docs.netapp.com/ontap-9/index.jsp 13 | # https://pypi.org/project/netapp-ontap/ 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | ################################################################################ 17 | 18 | 19 | ### Step 1 - Get list of aggregates and available spares from cluster" 20 | 21 | REST_RESPONSE=`curl -s \ 22 | -H "accept: application/hal+json"\ 23 | -H "authorization: Basic YWRtaW46TmV0YXBwMSE="\ 24 | -X GET\ 25 | "https://cluster1.demo.netapp.com/api/storage/aggregates?show_spares=true"` 26 | 27 | 28 | ### STEP 2 - Create aggreagets, if spare count is sufficient 29 | 30 | if [[ `echo $REST_RESPONSE | jq -r '.spares | length'` -gt 0 ]]; then 31 | echo $REST_RESPONSE | jq -r '.spares[] | [.node.name, .usable] | @tsv' | 32 | while IFS=$'\t' read -r NODE SPARES; do 33 | if [[ $SPARES -gt 5 ]]; then 34 | echo "--> Creating aggr with $(($SPARES)) disks on node $NODE" 35 | POST_DATA=`cat < "Enterprise Object Storage in the Data Fabric 10 | # with StorageGRID v1.0" 11 | # 12 | # URLs: https://labondemand.netapp.com/lab/sl10610 (NetApp + Partner) 13 | # https://handsonlabs.netapp.com/lab/storagegrid (Customer) 14 | # https://docs.netapp.com/sgws-113/index.jsp 15 | # https://galaxy.ansible.com/netapp/storagegrid 16 | # 17 | ################################################################################ 18 | 19 | echo "--> Updating Red Hat system" 20 | yum -y update 21 | 22 | echo "--> Installing additional packages" 23 | yum -y install wget gcc libffi-devel epel-release zlib-devel openssl-devel jq 24 | 25 | echo "--> Installing Python 3.7.6 (as alternative version)" 26 | wget -P /opt/ https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tgz 27 | tar xf /opt/Python-3.7.6.tgz -C /opt/ 28 | cd /opt/Python-3.7.6 29 | ./configure --enable-optimizations 30 | make altinstall 31 | ln -s /usr/local/bin/python3.7 /usr/bin/python3 32 | ln -s /usr/local/bin/pip3.7 /usr/bin/pip3 33 | cd ~ 34 | 35 | echo "--> Upgrading pip" 36 | pip install --upgrade pip 37 | pip3 install --upgrade pip 38 | 39 | echo "--> Make sure, required packages for Python are installed" 40 | pip install requests selinux boto3 41 | pip3 install requests selinux boto3 42 | 43 | echo "--> Installing Ansible" 44 | pip3 install ansible 45 | 46 | # echo "--> Installing StorageGRID collection for Ansible" 47 | ansible-galaxy collection install -f netapp.storagegrid 48 | 49 | echo "--> Adding line to ignore warnings in .bashrc" 50 | echo 'export PYTHONWARNINGS="ignore:Unverified HTTPS request"' >> ~/.bashrc 51 | export PYTHONWARNINGS="ignore:Unverified HTTPS request" 52 | 53 | echo "" 54 | echo "" 55 | echo ">>> MANUAL STEP REQUIRED <<<" 56 | echo "- Content on Ansible Galaxy cannot be downloaded directly" 57 | echo " from this lab environment." 58 | echo "- Please load 'netapp.storagegrid' collection from another" 59 | echo " location and install it manually with e.g. this command:" 60 | echo "" 61 | echo "# ansible-galaxy collection install ./netapp-storagegrid-20.6.1.tar.gz -p ~/.ansible/collections" 62 | echo "" 63 | -------------------------------------------------------------------------------- /ontap9/ansible/05_check_cluster.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 05_check_cluster.yml 6 | # Author: Adrian Bronder 7 | # Date: 2021-02-03 8 | # Description: Run a series of check routines against a cluster 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_info 12 | # assert (ansible.builtin) 13 | # 14 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 15 | # https://galaxy.ansible.com/netapp/ontap 16 | # 17 | # Built-in help: 18 | # ansible-doc netapp.ontap.na_ontap_info 19 | # 20 | ################################################################################ 21 | 22 | - hosts: localhost 23 | gather_facts: false 24 | vars: 25 | input: &input 26 | hostname: "{{ PRI_CLU }}" 27 | username: "{{ PRI_CLU_USER }}" 28 | password: "{{ PRI_CLU_PASS }}" 29 | https: true 30 | validate_certs: false 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Get Ontap Info 38 | na_ontap_info: 39 | gather_subset: 40 | - subsys_health_info 41 | - aggregate_info 42 | <<: *input 43 | register: netapp 44 | 45 | - name: Check Subsystem Health Status 46 | ansible.builtin.assert: 47 | that: 48 | - item.value.health == "ok" 49 | fail_msg: "{{ item.key }} is not healthy" 50 | success_msg: "{{ item.key }} is ok" 51 | loop: 52 | "{{ lookup('dict', netapp.ontap_info.subsys_health_info) }}" 53 | loop_control: 54 | label: "{{ item.key }}" 55 | # ignore_errors: yes 56 | 57 | - name: Check for Offline Aggregates 58 | ansible.builtin.assert: 59 | that: 60 | - item.value.aggr_raid_attributes.state == "online" 61 | fail_msg: "{{ item.key }} is offline" 62 | success_msg: "{{ item.key }} is online" 63 | loop: 64 | "{{ lookup('dict', netapp.ontap_info.aggregate_info) }}" 65 | loop_control: 66 | label: "{{ item.key }}" 67 | # ignore_errors: yes 68 | 69 | - name: Check for Root Aggregate Naming 70 | ansible.builtin.assert: 71 | that: 72 | - item.key | regex_search('^aggr0_{{ item.value.aggr_ownership_attributes.cluster }}_.*$') 73 | fail_msg: "{{ item.key }} is not compliant with naming rules" 74 | success_msg: "{{ item.key }} is compliant with naming rules" 75 | when: 76 | - item.value.aggr_raid_attributes.is_root_aggregate == "true" 77 | loop: 78 | "{{ lookup('dict', netapp.ontap_info.aggregate_info) }}" 79 | loop_control: 80 | label: "{{ item.key }}" 81 | # ignore_errors: yes 82 | -------------------------------------------------------------------------------- /ontap9/ansible/05_check_cluster_silent.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 05_check_cluster_silent.yml 6 | # Author: Adrian Bronder 7 | # Date: 2021-02-03 8 | # Description: Run a series of check routines against a cluster 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_info 12 | # fail (ansible.builtin) 13 | # 14 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 15 | # https://galaxy.ansible.com/netapp/ontap 16 | # 17 | # Built-in help: 18 | # ansible-doc netapp.ontap.na_ontap_info 19 | # 20 | ################################################################################ 21 | 22 | - hosts: localhost 23 | gather_facts: false 24 | vars: 25 | input: &input 26 | hostname: "{{ PRI_CLU }}" 27 | username: "{{ PRI_CLU_USER }}" 28 | password: "{{ PRI_CLU_PASS }}" 29 | https: true 30 | validate_certs: false 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Get Ontap Info 38 | na_ontap_info: 39 | gather_subset: 40 | - subsys_health_info 41 | - aggregate_info 42 | <<: *input 43 | register: netapp 44 | 45 | - name: Fail on unhealthy subsystem status 46 | ansible.builtin.fail: 47 | msg: "check failed on {{ item.key }}" 48 | when: 49 | - item.value.health != "ok" 50 | loop: 51 | "{{ lookup('dict', netapp.ontap_info.subsys_health_info ) }}" 52 | loop_control: 53 | label: "{{ item.key }}" 54 | # ignore_errors: yes 55 | 56 | - name: Fail on offline aggregates 57 | ansible.builtin.fail: 58 | msg: "check failed on {{ item.key }}" 59 | when: 60 | - item.value.aggr_raid_attributes.state != "online" 61 | loop: 62 | "{{ lookup('dict', netapp.ontap_info.aggregate_info) }}" 63 | loop_control: 64 | label: "{{ item.key }}" 65 | # ignore_errors: yes 66 | 67 | - name: Fail on non-compliant aggregate names 68 | ansible.builtin.fail: 69 | msg: "check failed on {{ item.key }}" 70 | when: 71 | - item.value.aggr_raid_attributes.is_root_aggregate == "true" 72 | - not item.key | regex_search('^aggr0_{{ item.value.aggr_ownership_attributes.cluster }}_.*$') 73 | loop: 74 | "{{ lookup('dict', netapp.ontap_info.aggregate_info) }}" 75 | loop_control: 76 | label: "{{ item.key }}" 77 | # ignore_errors: yes 78 | 79 | # - name: Print cluster details 80 | # ansible.builtin.debug: 81 | # msg: "{{ item.key }}" 82 | # loop: 83 | # "{{ lookup('dict', netapp.ontap_info.subsys_health_info)}}" 84 | -------------------------------------------------------------------------------- /ontap9/ansible/11_create_ipspace_pri_clu.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 11_create_ipspace_pri_clu.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-09-09 8 | # Description: Create an IPspace on the primary cluster 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_ipspace 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_ipspace 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | vars_files: 31 | - ../global.vars 32 | collections: 33 | - netapp.ontap 34 | 35 | tasks: 36 | - name: Create IPspace on the primary cluster 37 | na_ontap_ipspace: 38 | state: present 39 | name: "{{ IPSPACE }}" 40 | <<: *input 41 | -------------------------------------------------------------------------------- /ontap9/ansible/12_create_vlanmgmt_pri_clu.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 12_create_vlanmgmt_pri_clu.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-09-09 8 | # Description: Create VLAN 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_net_vlan 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_net_vlan 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | vars_files: 31 | - ../global.vars 32 | collections: 33 | - netapp.ontap 34 | 35 | tasks: 36 | - name: Create VLAN on both nodes of the primary cluster 37 | na_ontap_net_vlan: 38 | state: present 39 | vlanid: "{{ VLAN_MGMT }}" 40 | node: "{{ item }}" 41 | parent_interface: "{{ VLAN_PORT }}" 42 | <<: *input 43 | with_items: 44 | - "{{ PRI_CLU_NODE1 }}" 45 | - "{{ PRI_CLU_NODE2 }}" 46 | -------------------------------------------------------------------------------- /ontap9/ansible/13_create_vlandata_pri_clu.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 13_create_vlandata_pri_clu.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-09-09 8 | # Description: Create VLAN for data traffic 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_net_vlan 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_net_vlan 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | vars_files: 31 | - ../global.vars 32 | collections: 33 | - netapp.ontap 34 | 35 | tasks: 36 | - name: Create VLAN on both nodes of the primary cluster 37 | na_ontap_net_vlan: 38 | state: present 39 | vlanid: "{{ VLAN_DATA }}" 40 | node: "{{ item }}" 41 | parent_interface: "{{ VLAN_PORT }}" 42 | <<: *input 43 | with_items: 44 | - "{{ PRI_CLU_NODE1 }}" 45 | - "{{ PRI_CLU_NODE2 }}" 46 | -------------------------------------------------------------------------------- /ontap9/ansible/14_create_bcdomainmgmt_pri_clu.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 14_create_bcdomainmgmt_pri_clu.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-09-09 8 | # Description: Create a broadcast domain for mgmt LIFs on the primary cluster 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_broadcast_domain 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_broadcast_domain 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | vars_files: 31 | - ../global.vars 32 | collections: 33 | - netapp.ontap 34 | 35 | tasks: 36 | - name: Create broadcast domain on the primary cluster 37 | na_ontap_broadcast_domain: 38 | state: present 39 | name: "{{ BCDOMAIN_MGMT }}" 40 | mtu: 1500 41 | ipspace: "{{ IPSPACE }}" 42 | ports: 43 | - "{{ PRI_CLU_NODE1 }}:{{ VLAN_PORT }}-{{ VLAN_MGMT }}" 44 | - "{{ PRI_CLU_NODE2 }}:{{ VLAN_PORT }}-{{ VLAN_MGMT }}" 45 | <<: *input 46 | -------------------------------------------------------------------------------- /ontap9/ansible/15_create_bcdomaindata_pri_clu.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 15_create_bcdomaindata_pri_clu.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-09-09 8 | # Description: Create a broadcast domain for data LIFs on the primary cluster 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_broadcast_domain 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_broadcast_domain 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | vars_files: 31 | - ../global.vars 32 | collections: 33 | - netapp.ontap 34 | 35 | tasks: 36 | - name: Create broadcast domain on the primary cluster 37 | na_ontap_broadcast_domain: 38 | state: present 39 | name: "{{ BCDOMAIN_DATA }}" 40 | mtu: 1500 41 | ipspace: "{{ IPSPACE }}" 42 | ports: 43 | - "{{ PRI_CLU_NODE1 }}:{{ VLAN_PORT }}-{{ VLAN_DATA }}" 44 | - "{{ PRI_CLU_NODE2 }}:{{ VLAN_PORT }}-{{ VLAN_DATA }}" 45 | <<: *input 46 | -------------------------------------------------------------------------------- /ontap9/ansible/16_create_subnetmgmt_pri_clu.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 16_create_subnetmgmt_pri_clu.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-09-10 8 | # Description: Create a subnet for mgmt on the primary cluster 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_net_subnet 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_net_subnet 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | vars_files: 31 | - ../global.vars 32 | collections: 33 | - netapp.ontap 34 | 35 | tasks: 36 | - name: Create broadcast domain on the primary cluster 37 | na_ontap_net_subnet: 38 | state: present 39 | name: "{{ BCDOMAIN_MGMT }}" 40 | ipspace: "{{ IPSPACE }}" 41 | broadcast_domain: "{{ BCDOMAIN_MGMT }}" 42 | subnet: "{{ PRI_CLU_MGMTSUBNET }}" 43 | ip_ranges: "{{ PRI_CLU_MGMTIPRANGE }}" 44 | <<: *input 45 | -------------------------------------------------------------------------------- /ontap9/ansible/17_create_subnetdata_pri_clu.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 17_create_subnetdata_pri_clu.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-09-10 8 | # Description: Create a subnet for data on the primary cluster 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_net_subnet 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_net_subnet 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | vars_files: 31 | - ../global.vars 32 | collections: 33 | - netapp.ontap 34 | 35 | tasks: 36 | - name: Create broadcast domain on the primary cluster 37 | na_ontap_net_subnet: 38 | state: present 39 | name: "{{ BCDOMAIN_DATA }}" 40 | ipspace: "{{ IPSPACE }}" 41 | broadcast_domain: "{{ BCDOMAIN_MGMT }}" 42 | subnet: "{{ PRI_CLU_DATASUBNET }}" 43 | ip_ranges: "{{ PRI_CLU_DATAIPRANGE }}" 44 | <<: *input 45 | -------------------------------------------------------------------------------- /ontap9/ansible/21_create_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 21_create_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-20 8 | # Description: Create a primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_svm 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_svm 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | vars_files: 31 | - ../global.vars 32 | collections: 33 | - netapp.ontap 34 | 35 | tasks: 36 | - name: Create primary SVM 37 | na_ontap_svm: 38 | state: present 39 | name: "{{ PRI_SVM }}" 40 | root_volume_aggregate: "{{ PRI_AGGR }}" 41 | comment: Created with Ansible 42 | <<: *input 43 | -------------------------------------------------------------------------------- /ontap9/ansible/22_create_mgmtlif_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 22_create_mgmtlif_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-20 8 | # Description: Create management interface on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_interface 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_interface 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create management interface on primary SVM 38 | na_ontap_interface: 39 | state: present 40 | interface_name: "{{ PRI_SVM }}" 41 | vserver: "{{ PRI_SVM }}" 42 | address: "{{ PRI_SVM_IP }}" 43 | netmask: "{{ PRI_SVM_NETMASK }}" 44 | home_node: "{{ PRI_CLU_NODE1 }}" 45 | home_port: "{{ PRI_MGMT_PORT }}" 46 | service_policy: "default-management" 47 | role: data 48 | <<: *input 49 | -------------------------------------------------------------------------------- /ontap9/ansible/23_create_dns_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 23_create_dns_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-20 8 | # Description: Create DNS on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_dns 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_dns 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create DNS on primary SVM 38 | na_ontap_dns: 39 | state: present 40 | vserver: "{{ PRI_SVM }}" 41 | domains: "{{ PRI_DOMAIN }}" 42 | nameservers: "{{ PRI_DNS1 }}" 43 | <<: *input 44 | -------------------------------------------------------------------------------- /ontap9/ansible/25_create_cifslif_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 25_create_cifslif_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-20 8 | # Description: Create CIFS interface on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_interface 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_interface 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create CIFS interface on primary SVM 38 | na_ontap_interface: 39 | state: present 40 | interface_name: "{{ PRI_SVM }}_cifs_01" 41 | vserver: "{{ PRI_SVM }}" 42 | address: "{{ PRI_SVM_CIFS_IP }}" 43 | netmask: "{{ PRI_SVM_CIFS_NETMASK }}" 44 | home_node: "{{ PRI_CLU_NODE1 }}" 45 | home_port: "{{ PRI_DATA_PORT }}" 46 | role: data 47 | protocols: cifs 48 | <<: *input 49 | -------------------------------------------------------------------------------- /ontap9/ansible/25_create_iscsilif_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 25_create_iscsilif_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Ronald Feist 8 | # Date: 2020-06-16 9 | # Description: Create iSCSI interfaces on primary SVM 10 | # with Ansible modules 11 | # 12 | # Modules: na_ontap_interface 13 | # 14 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 15 | # https://galaxy.ansible.com/netapp/ontap 16 | # 17 | # Built-in help: 18 | # ansible-doc netapp.ontap.na_ontap_interface 19 | # 20 | ################################################################################ 21 | 22 | - hosts: localhost 23 | gather_facts: false 24 | vars: 25 | input: &input 26 | hostname: "{{ PRI_CLU }}" 27 | username: "{{ PRI_CLU_USER }}" 28 | password: "{{ PRI_CLU_PASS }}" 29 | https: true 30 | validate_certs: false 31 | use_rest: Always 32 | vars_files: 33 | - ../global.vars 34 | collections: 35 | - netapp.ontap 36 | 37 | tasks: 38 | - name: Create 1st iSCSI interface for primary SVM 39 | na_ontap_interface: 40 | state: present 41 | interface_name: "{{ PRI_SVM }}_iscsi_01" 42 | vserver: "{{ PRI_SVM }}" 43 | address: "{{ PRI_SVM_ISCSI1_IP }}" 44 | netmask: "{{ PRI_SVM_ISCSI_NETMASK }}" 45 | home_node: "{{ PRI_CLU_NODE1 }}" 46 | home_port: "{{ PRI_DATA_PORT }}" 47 | protocols: iscsi 48 | role: data 49 | <<: *input 50 | 51 | - name: Create 2nd iSCSI interface for primary SVM 52 | na_ontap_interface: 53 | state: present 54 | interface_name: "{{ PRI_SVM }}_iscsi_02" 55 | vserver: "{{ PRI_SVM }}" 56 | address: "{{ PRI_SVM_ISCSI2_IP }}" 57 | netmask: "{{ PRI_SVM_ISCSI_NETMASK }}" 58 | home_node: "{{ PRI_CLU_NODE2 }}" 59 | home_port: "{{ PRI_DATA_PORT }}" 60 | protocols: iscsi 61 | role: data 62 | <<: *input 63 | -------------------------------------------------------------------------------- /ontap9/ansible/25_create_nfslif_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 25_create_nfslif_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-20 8 | # Description: Create NFS interface on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_interface 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_interface 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create NFS interface on primary SVM 38 | na_ontap_interface: 39 | state: present 40 | interface_name: "{{ PRI_SVM }}_nfs_01" 41 | vserver: "{{ PRI_SVM }}" 42 | address: "{{ PRI_SVM_NFS_IP }}" 43 | netmask: "{{ PRI_SVM_NFS_NETMASK }}" 44 | home_node: "{{ PRI_CLU_NODE1 }}" 45 | home_port: "{{ PRI_DATA_PORT }}" 46 | role: data 47 | protocols: nfs 48 | <<: *input 49 | -------------------------------------------------------------------------------- /ontap9/ansible/26_create_cifs_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 26_create_cifs_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-20 8 | # Description: Create CIFS server on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_cifs_server 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_cifs_server 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create CIFS server on primary SVM 38 | na_ontap_cifs_server: 39 | state: present 40 | service_state: started 41 | name: "{{ PRI_SVM }}" 42 | vserver: "{{ PRI_SVM }}" 43 | domain: "{{ PRI_AD_DOMAIN }}" 44 | admin_user_name: "{{ PRI_AD_USER }}" 45 | admin_password: "{{ PRI_AD_PASS }}" 46 | <<: *input 47 | -------------------------------------------------------------------------------- /ontap9/ansible/26_create_iscsi_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 26_create_iscsi_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Ronald Feist 8 | # Date: 2020-06-16 9 | # Description: Create iSCSI service on primary SVM 10 | # with Ansible modules 11 | # 12 | # Modules: na_ontap_iscsi 13 | # 14 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 15 | # https://galaxy.ansible.com/netapp/ontap 16 | # 17 | # Built-in help: 18 | # ansible-doc netapp.ontap.na_ontap_iscsi 19 | # 20 | ################################################################################ 21 | 22 | - hosts: localhost 23 | gather_facts: false 24 | vars: 25 | input: &input 26 | hostname: "{{ PRI_CLU }}" 27 | username: "{{ PRI_CLU_USER }}" 28 | password: "{{ PRI_CLU_PASS }}" 29 | https: true 30 | validate_certs: false 31 | # use_rest: Always 32 | vars_files: 33 | - ../global.vars 34 | collections: 35 | - netapp.ontap 36 | 37 | tasks: 38 | - name: Create iSCSI service on primary SVM 39 | na_ontap_iscsi: 40 | state: present 41 | vserver: "{{ PRI_SVM }}" 42 | service_state: started 43 | <<: *input 44 | -------------------------------------------------------------------------------- /ontap9/ansible/26_create_nfs_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 26_create_nfs_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-20 8 | # Description: Create NFS server on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_nfs 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_nfs 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create NFS server on primary SVM 38 | na_ontap_nfs: 39 | state: present 40 | vserver: "{{ PRI_SVM }}" 41 | nfsv3: enabled 42 | nfsv4: disabled 43 | nfsv41: disabled 44 | <<: *input 45 | -------------------------------------------------------------------------------- /ontap9/ansible/27_create_qospolicy_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 27_create_qospolicy_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-10-13 WIP 8 | # Description: Create a primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_svm 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_svm 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | vars_files: 31 | - ../global.vars 32 | collections: 33 | - netapp.ontap 34 | 35 | tasks: 36 | - name: Create primary SVM 37 | na_ontap_qos_policy_group: 38 | state: present 39 | name: "{{ PRI_SVM }}" 40 | <<: *input 41 | -------------------------------------------------------------------------------- /ontap9/ansible/31_create_cifsvol_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 31_create_cifsvol_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-20 8 | # Description: Create volume on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_volume 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_volume 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create volume on primary SVM 38 | na_ontap_volume: 39 | state: present 40 | name: "{{ PRI_SVM }}_cifs_01" 41 | vserver: "{{ PRI_SVM }}" 42 | size: "{{ VOL_SIZE }}" 43 | size_unit: b 44 | aggregate_name: "{{ PRI_AGGR }}" 45 | comment: Created with Ansible 46 | space_guarantee: volume 47 | policy: default 48 | junction_path: "/{{ PRI_SVM }}_cifs_01" 49 | volume_security_style: ntfs 50 | <<: *input 51 | -------------------------------------------------------------------------------- /ontap9/ansible/32_create_cifsqtree_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 32_create_cifsqtree_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-20 8 | # Description: Create qtree on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_qtree 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_qtree 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create qtree on primary SVM 38 | na_ontap_qtree: 39 | state: present 40 | name: "cifs_01" 41 | vserver: "{{ PRI_SVM }}" 42 | flexvol_name: "{{ PRI_SVM }}_cifs_01" 43 | security_style: ntfs 44 | <<: *input 45 | -------------------------------------------------------------------------------- /ontap9/ansible/33_create_cifsshare_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 33_create_cifsshare_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-20 8 | # Description: Create CIFS share on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_cifs 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_cifs 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create CIFS share on primary SVM 38 | na_ontap_cifs: 39 | state: present 40 | share_name: "share_01" 41 | vserver: "{{ PRI_SVM }}" 42 | path: "/{{ PRI_SVM }}_cifs_01/cifs_01/" 43 | <<: *input 44 | -------------------------------------------------------------------------------- /ontap9/ansible/36_create_nfsvol_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 36_create_nfsvol_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-20 8 | # Description: Create volume on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_volume 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_volume 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create volume on primary SVM 38 | na_ontap_volume: 39 | state: present 40 | name: "{{ PRI_SVM }}_nfs_01" 41 | vserver: "{{ PRI_SVM }}" 42 | size: "{{ VOL_SIZE }}" 43 | size_unit: b 44 | aggregate_name: "{{ PRI_AGGR }}" 45 | comment: Created with Ansible 46 | space_guarantee: volume 47 | policy: default 48 | junction_path: "/{{ PRI_SVM }}_nfs_01" 49 | volume_security_style: unix 50 | <<: *input 51 | -------------------------------------------------------------------------------- /ontap9/ansible/37_create_nfsqtree_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 37_create_nfsqtree_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-30 8 | # Description: Create qtree on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_qtree 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_qtree 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create qtree on primary SVM 38 | na_ontap_qtree: 39 | state: present 40 | name: "nfs_01" 41 | vserver: "{{ PRI_SVM }}" 42 | flexvol_name: "{{ PRI_SVM }}_nfs_01" 43 | security_style: unix 44 | <<: *input 45 | -------------------------------------------------------------------------------- /ontap9/ansible/41_create_iscsiwinvol_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 41_create_iscsiwinvol_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-06-16 8 | # Description: Create volume on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_volume 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_volume 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create volume on primary SVM 38 | na_ontap_volume: 39 | state: present 40 | name: "{{ PRI_SVM }}_iscsiwin_01" 41 | vserver: "{{ PRI_SVM }}" 42 | size: "{{ VOL_SIZE }}" 43 | size_unit: b 44 | aggregate_name: "{{ PRI_AGGR }}" 45 | comment: Created with Ansible 46 | space_guarantee: volume 47 | policy: default 48 | volume_security_style: unix 49 | <<: *input 50 | -------------------------------------------------------------------------------- /ontap9/ansible/42_create_iscsiwinlun_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 42_create_iscsiwinlun_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-06-16 8 | # Description: Create lun on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_lun 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_lun 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create lun on primary SVM 38 | na_ontap_lun: 39 | state: present 40 | name: "{{ PRI_SVM }}_lunwin_01" 41 | vserver: "{{ PRI_SVM }}" 42 | flexvol_name: "{{ PRI_SVM }}_iscsiwin_01" 43 | size: "{{ LUN_SIZE }}" 44 | size_unit: b 45 | space_reserve: true 46 | ostype: windows 47 | <<: *input 48 | -------------------------------------------------------------------------------- /ontap9/ansible/43_create_winigroup_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 43_create_winigroup_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-06-16 8 | # Description: Create igroup on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_igroup 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_igroup 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create igroup on primary SVM 38 | na_ontap_igroup: 39 | state: present 40 | name: "{{ PRI_SVM }}_winig_01" 41 | vserver: "{{ PRI_SVM }}" 42 | initiator_group_type: iscsi 43 | ostype: windows 44 | initiator: "{{ WIN_IQN }}" 45 | <<: *input 46 | -------------------------------------------------------------------------------- /ontap9/ansible/44_create_winlunmap_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 44_create_winlunmap_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-06-16 8 | # Description: Create lun mapping on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_lun_map 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_lun_map 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create igroup on primary SVM 38 | na_ontap_lun_map: 39 | state: present 40 | vserver: "{{ PRI_SVM }}" 41 | initiator_group_name: "{{ PRI_SVM }}_winig_01" 42 | path: "/vol/{{ PRI_SVM }}_iscsiwin_01/{{ PRI_SVM }}_lunwin_01" 43 | <<: *input 44 | -------------------------------------------------------------------------------- /ontap9/ansible/46_create_iscsilinvol_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 46_create_iscsilinvol_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-06-16 8 | # Description: Create volume on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_volume 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_volume 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create volume on primary SVM 38 | na_ontap_volume: 39 | state: present 40 | name: "{{ PRI_SVM }}_iscsilin_01" 41 | vserver: "{{ PRI_SVM }}" 42 | size: "{{ VOL_SIZE }}" 43 | size_unit: b 44 | aggregate_name: "{{ PRI_AGGR }}" 45 | comment: Created with Ansible 46 | space_guarantee: volume 47 | policy: default 48 | volume_security_style: unix 49 | <<: *input 50 | -------------------------------------------------------------------------------- /ontap9/ansible/47_create_iscsilinlun_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 42_create_iscsilinlun_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-06-16 8 | # Description: Create lun on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_lun 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_lun 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create lun on primary SVM 38 | na_ontap_lun: 39 | state: present 40 | name: "{{ PRI_SVM }}_lunlin_01" 41 | vserver: "{{ PRI_SVM }}" 42 | flexvol_name: "{{ PRI_SVM }}_iscsilin_01" 43 | size: "{{ LUN_SIZE }}" 44 | size_unit: b 45 | space_reserve: true 46 | ostype: linux 47 | <<: *input 48 | -------------------------------------------------------------------------------- /ontap9/ansible/48_create_linigroup_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 48_create_linigroup_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-06-16 8 | # Description: Create igroup on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_igroup 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_igroup 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create igroup on primary SVM 38 | na_ontap_igroup: 39 | state: present 40 | name: "{{ PRI_SVM }}_linig_01" 41 | vserver: "{{ PRI_SVM }}" 42 | initiator_group_type: iscsi 43 | ostype: linux 44 | initiator: "{{ LIN_IQN }}" 45 | <<: *input 46 | -------------------------------------------------------------------------------- /ontap9/ansible/49_create_linlunmap_pri_svm.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 49_create_linlunmap_pri_svm.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-06-16 8 | # Description: Create lun mapping on primary SVM 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_lun_map 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_lun_map 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | use_rest: Always 31 | vars_files: 32 | - ../global.vars 33 | collections: 34 | - netapp.ontap 35 | 36 | tasks: 37 | - name: Create igroup on primary SVM 38 | na_ontap_lun_map: 39 | state: present 40 | vserver: "{{ PRI_SVM }}" 41 | initiator_group_name: "{{ PRI_SVM }}_linig_01" 42 | path: "/vol/{{ PRI_SVM }}_iscsilin_01/{{ PRI_SVM }}_lunlin_01" 43 | <<: *input 44 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/ontap_inventory: -------------------------------------------------------------------------------- 1 | [ontap] 2 | cluster1 ontap_hostname=cluster1.demo.netapp.com 3 | cluster2 ontap_hostname=cluster2.demo.netapp.com 4 | 5 | [ontap:vars] 6 | ansible_connection=local 7 | ansible_python_interpreter="{{ansible_playbook_python}}" 8 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/pilot_play.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: "{{ ontap_host }}" 3 | gather_facts: false 4 | 5 | roles: 6 | - role: ontap_svm 7 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/pilot_play_ip_interface.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: cluster1 3 | gather_facts: false 4 | 5 | roles: 6 | - role: ontap_ip_interface 7 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_ip_interface/README.md: -------------------------------------------------------------------------------- 1 | Role Name 2 | ========= 3 | 4 | A brief description of the role goes here. 5 | 6 | Requirements 7 | ------------ 8 | 9 | Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. 10 | 11 | Role Variables 12 | -------------- 13 | 14 | A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. 15 | 16 | Dependencies 17 | ------------ 18 | 19 | A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. 20 | 21 | Example Playbook 22 | ---------------- 23 | 24 | Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: 25 | 26 | - hosts: servers 27 | roles: 28 | - { role: username.rolename, x: 42 } 29 | 30 | License 31 | ------- 32 | 33 | BSD 34 | 35 | Author Information 36 | ------------------ 37 | 38 | An optional section for the role authors to include contact information, or a website (HTML is not allowed). 39 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_ip_interface/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for ontap_ip_interface 3 | location: 4 | auto_revert: 5 | home_node: 6 | name: 7 | uuid: 8 | failover: 9 | home_port: 10 | name: 11 | uuid: 12 | node: 13 | name: 14 | broadcast_domain: 15 | name: 16 | uuid: 17 | ip: 18 | netmask: 19 | address: 20 | name: 21 | ipspace: 22 | name: 23 | uuid: 24 | vip: 25 | svm: 26 | name: 27 | uuid: 28 | service_policy: 29 | name: 30 | uuid: 31 | enabled: 32 | scope: 33 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_ip_interface/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for ontap_ip_interface 3 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_ip_interface/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: your name 3 | description: your role description 4 | company: your company (optional) 5 | 6 | # If the issue tracker for your role is not on github, uncomment the 7 | # next line and provide a value 8 | # issue_tracker_url: http://example.com/issue/tracker 9 | 10 | # Choose a valid license ID from https://spdx.org - some suggested licenses: 11 | # - BSD-3-Clause (default) 12 | # - MIT 13 | # - GPL-2.0-or-later 14 | # - GPL-3.0-only 15 | # - Apache-2.0 16 | # - CC-BY-4.0 17 | license: license (GPL-2.0-or-later, MIT, etc) 18 | 19 | min_ansible_version: 2.1 20 | 21 | # If this a Container Enabled role, provide the minimum Ansible Container version. 22 | # min_ansible_container_version: 23 | 24 | # 25 | # Provide a list of supported platforms, and for each platform a list of versions. 26 | # If you don't wish to enumerate all versions for a particular platform, use 'all'. 27 | # To view available platforms and versions (or releases), visit: 28 | # https://galaxy.ansible.com/api/v1/platforms/ 29 | # 30 | # platforms: 31 | # - name: Fedora 32 | # versions: 33 | # - all 34 | # - 25 35 | # - name: SomePlatform 36 | # versions: 37 | # - all 38 | # - 1.0 39 | # - 7 40 | # - 99.99 41 | 42 | galaxy_tags: [] 43 | # List tags for your role here, one per line. A tag is a keyword that describes 44 | # and categorizes the role. Users find roles by searching for tags. Be sure to 45 | # remove the '[]' above, if you add tags to this list. 46 | # 47 | # NOTE: A tag is limited to a single word comprised of alphanumeric characters. 48 | # Maximum 20 tags per role. 49 | 50 | dependencies: [] 51 | # List your role dependencies here, one per line. Be sure to remove the '[]' above, 52 | # if you add dependencies to this list. 53 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_ip_interface/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # tasks file for ontap_ip_interface 3 | - name: Check for mandatory variables 4 | fail: 5 | msg: 6 | - "Following variables required with role 'ontap_ip_interface':" 7 | - "'ontap_svm_name'" 8 | - "'ontap_ip_interface_name'" 9 | when: 10 | - (ontap_svm_name is undefined) or 11 | (ontap_ip_interface_name is undefined) 12 | tags: 13 | - always 14 | 15 | - name: Set Connection Details 16 | ansible.builtin.set_fact: 17 | ontap_login: &ontap_login 18 | hostname: "{{ ontap_hostname }}" 19 | username: "{{ ontap_username }}" 20 | password: "{{ ontap_password }}" 21 | https: true 22 | validate_certs: false 23 | use_rest: never 24 | tags: 25 | - always 26 | no_log: true 27 | 28 | - name: Source Inventory Information 29 | block: 30 | - name: Find SVM 31 | ansible.builtin.set_fact: 32 | ontap_svm_obj: "{{ item }}" 33 | loop: 34 | "{{ svms | list }}" 35 | when: 36 | - item.name == ontap_svm_name 37 | - name: Find IP Interface 38 | ansible.builtin.set_fact: 39 | ontap_ip_interface_obj: "{{ item }}" 40 | loop: 41 | "{{ ontap_svm_obj.ip_interfaces | list}}" 42 | when: 43 | - item.name == ontap_ip_interface_name 44 | tags: 45 | - source_inventory 46 | 47 | - name: Create LIF 48 | na_ontap_interface: 49 | state: present 50 | interface_name: "{{ ontap_ip_interface_name }}" 51 | vserver: "{{ ontap_svm_name }}" 52 | address: "{{ ontap_ip_interface_obj.ip.address }}" 53 | netmask: "{{ ontap_ip_interface_obj.ip.netmask }}" 54 | service_policy: "{{ ontap_ip_interface_obj.service_policy.name }}" 55 | home_node: "{{ ontap_ip_interface_obj.location.home_node.name }}" 56 | home_port: "{{ ontap_ip_interface_obj.location.home_port.name }}" 57 | # FIXME - This one is ugly, but "role" must be provided as long as we have to use ZAPI here 58 | role: "data" 59 | <<: *ontap_login 60 | tags: 61 | - create_all 62 | - create_ontap_svm 63 | - create_ontap_ip_interface 64 | 65 | - name: Delete LIF 66 | na_ontap_interface: 67 | state: absent 68 | interface_name: "{{ ontap_ip_interface_name }}" 69 | vserver: "{{ ontap_svm_name }}" 70 | <<: *ontap_login 71 | tags: 72 | - never 73 | - delete_all 74 | - delete_ontap_ip_interface 75 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_ip_interface/tests/inventory: -------------------------------------------------------------------------------- 1 | localhost 2 | 3 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_ip_interface/tests/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | remote_user: root 4 | roles: 5 | - ontap_ip_interface 6 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_ip_interface/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # vars file for ontap_ip_interface 3 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_svm/README.md: -------------------------------------------------------------------------------- 1 | Role Name 2 | ========= 3 | 4 | A brief description of the role goes here. 5 | 6 | Requirements 7 | ------------ 8 | 9 | Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. 10 | 11 | Role Variables 12 | -------------- 13 | 14 | A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. 15 | 16 | Dependencies 17 | ------------ 18 | 19 | A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. 20 | 21 | Example Playbook 22 | ---------------- 23 | 24 | Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: 25 | 26 | - hosts: servers 27 | roles: 28 | - { role: username.rolename, x: 42 } 29 | 30 | License 31 | ------- 32 | 33 | BSD 34 | 35 | Author Information 36 | ------------------ 37 | 38 | An optional section for the role authors to include contact information, or a website (HTML is not allowed). 39 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_svm/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for ontap_svm 3 | dns: 4 | domains: [] 5 | servers: [] 6 | nfs: 7 | enabled: 8 | ip_interfaces: 9 | - location: 10 | home_node: 11 | name: 12 | uuid: 13 | broadcast_domain: 14 | name: 15 | uuid: 16 | ip: 17 | netmask: 18 | address: 19 | name: 20 | service_policy: 21 | cifs: 22 | name: 23 | ad_domain: 24 | organizational_unit: 25 | fqdn: 26 | password: 27 | user: 28 | enabled: 29 | fc_interfaces: 30 | - data_protocol: 31 | location: 32 | port: 33 | name: 34 | uuid: 35 | node: 36 | name: 37 | name: 38 | subtype: 39 | routes: 40 | - gateway: 41 | destination: 42 | netmask: 43 | address: 44 | nis: 45 | domain: 46 | servers: [] 47 | enabled: 48 | snapshot_policy: 49 | name: 50 | uuid: 51 | ipspace: 52 | name: 53 | uuid: 54 | s3: 55 | is_http_enabled: 56 | certificate: 57 | name: 58 | uuid: 59 | name: 60 | port: 61 | secure_port: 62 | enabled: 63 | is_https_enabled: 64 | iscsi: 65 | enabled: 66 | language: "de.utf_8" 67 | aggregates: 68 | - name: 69 | uuid: 70 | fcp: 71 | enabled: 72 | ldap: 73 | base_dn: 74 | servers: [] 75 | bind_dn: 76 | ad_domain: 77 | enabled: 78 | name: 79 | nvme: 80 | enabled: 81 | nsswitch: 82 | passwd: [] 83 | hosts: [] 84 | netgroup: [] 85 | group: [] 86 | namemap: [] 87 | comment: 88 | volume_efficiency_policy: 89 | name: 90 | uuid: 91 | snapmirror: {} 92 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_svm/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for ontap_svm 3 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_svm/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Adrian Bronder 3 | description: Standard definitions for managing Storage Virtual Machines(SVMs) 4 | company: NetApp 5 | 6 | # If the issue tracker for your role is not on github, uncomment the 7 | # next line and provide a value 8 | # issue_tracker_url: http://example.com/issue/tracker 9 | 10 | # Choose a valid license ID from https://spdx.org - some suggested licenses: 11 | # - BSD-3-Clause (default) 12 | # - MIT 13 | # - GPL-2.0-or-later 14 | # - GPL-3.0-only 15 | # - Apache-2.0 16 | # - CC-BY-4.0 17 | license: license (GPL-2.0-or-later, MIT, etc) 18 | 19 | min_ansible_version: 2.9 20 | 21 | # If this a Container Enabled role, provide the minimum Ansible Container version. 22 | # min_ansible_container_version: 23 | 24 | # 25 | # Provide a list of supported platforms, and for each platform a list of versions. 26 | # If you don't wish to enumerate all versions for a particular platform, use 'all'. 27 | # To view available platforms and versions (or releases), visit: 28 | # https://galaxy.ansible.com/api/v1/platforms/ 29 | # 30 | # platforms: 31 | # - name: Fedora 32 | # versions: 33 | # - all 34 | # - 25 35 | # - name: SomePlatform 36 | # versions: 37 | # - all 38 | # - 1.0 39 | # - 7 40 | # - 99.99 41 | 42 | galaxy_tags: [] 43 | # List tags for your role here, one per line. A tag is a keyword that describes 44 | # and categorizes the role. Users find roles by searching for tags. Be sure to 45 | # remove the '[]' above, if you add tags to this list. 46 | # 47 | # NOTE: A tag is limited to a single word comprised of alphanumeric characters. 48 | # Maximum 20 tags per role. 49 | 50 | dependencies: [] 51 | # List your role dependencies here, one per line. Be sure to remove the '[]' above, 52 | # if you add dependencies to this list. 53 | 54 | collections: 55 | - netapp.ontap 56 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_svm/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # tasks file for ontap_svm 3 | - name: Check for mandatory variables 4 | fail: 5 | msg: "You must pass the 'ontap_svm_name' variable" 6 | when: 7 | ontap_svm_name is undefined 8 | tags: 9 | - always 10 | 11 | - name: Set Connection Details 12 | ansible.builtin.set_fact: 13 | ontap_login: &ontap_login 14 | hostname: "{{ ontap_hostname }}" 15 | username: "{{ ontap_username }}" 16 | password: "{{ ontap_password }}" 17 | https: true 18 | validate_certs: false 19 | use_rest: never 20 | tags: 21 | - always 22 | no_log: true 23 | 24 | - name: Source Inventory Information 25 | block: 26 | - name: Find SVM 27 | ansible.builtin.set_fact: 28 | ontap_svm_obj: "{{ item }}" 29 | loop: 30 | "{{ svms | list }}" 31 | when: 32 | - item.name == ontap_svm_name 33 | tags: 34 | - source_inventory 35 | 36 | - name: Create SVM 37 | na_ontap_svm: 38 | state: present 39 | name: "{{ ontap_svm_name }}" 40 | language: "{{ ontap_svm_obj.language }}" 41 | comment: "{{ ontap_svm_obj.comment }}" 42 | ipspace: "{{ ontap_svm_obj.ipspace.name }}" 43 | snapshot_policy: "{{ ontap_svm_obj.snapshot_policy.name }}" 44 | <<: *ontap_login 45 | tags: 46 | - create_all 47 | - create_ontap_svm 48 | - modify_ontap_svm 49 | 50 | - name: Create Management LIF 51 | include_role: 52 | name: ontap_ip_interface 53 | when: 54 | - ontap_ip_interface_name is defined 55 | tags: 56 | - create_all 57 | - create_ontap_svm 58 | 59 | - name: Configure DNS 60 | na_ontap_dns: 61 | state: present 62 | vserver: "{{ ontap_svm_name }}" 63 | domains: "{{ ontap_svm_obj.dns.domains }}" 64 | nameservers: "{{ ontap_svm_obj.dns.servers }}" 65 | <<: *ontap_login 66 | tags: 67 | - create_all 68 | - create_ontap_svm 69 | - modify_ontap_svm 70 | 71 | - name: Delete SVM 72 | na_ontap_svm: 73 | state: absent 74 | name: "{{ ontap_svm_name }}" 75 | <<: *ontap_login 76 | tags: 77 | - never 78 | - delete_all 79 | - delete_ontap_svm 80 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_svm/tests/inventory: -------------------------------------------------------------------------------- 1 | localhost 2 | 3 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_svm/tests/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | remote_user: root 4 | roles: 5 | - ontap_svm 6 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_svm/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # vars file for ontap_svm 3 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_volume/README.md: -------------------------------------------------------------------------------- 1 | Role Name 2 | ========= 3 | 4 | A brief description of the role goes here. 5 | 6 | Requirements 7 | ------------ 8 | 9 | Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. 10 | 11 | Role Variables 12 | -------------- 13 | 14 | A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. 15 | 16 | Dependencies 17 | ------------ 18 | 19 | A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. 20 | 21 | Example Playbook 22 | ---------------- 23 | 24 | Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: 25 | 26 | - hosts: servers 27 | roles: 28 | - { role: username.rolename, x: 42 } 29 | 30 | License 31 | ------- 32 | 33 | BSD 34 | 35 | Author Information 36 | ------------------ 37 | 38 | An optional section for the role authors to include contact information, or a website (HTML is not allowed). 39 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_volume/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for ontap_volume 3 | name: 4 | uuid: 5 | type: 6 | size: 7 | snapshot_policy: 8 | name: 9 | uuid: 10 | svm: 11 | name: 12 | uuid: 13 | aggregates: 14 | - name: 15 | uuid: 16 | nas: 17 | security_style: 18 | uid: 19 | path: 20 | export_policy: 21 | name: 22 | id: 23 | unix_permissions: 24 | gid: 25 | cloud_retrieval_policy: 26 | files: 27 | maximum: 28 | used: 29 | qos: 30 | policy: 31 | max_throughput_iops: 32 | max_throughput_mbps: 33 | name: 34 | min_throughput_iops: 35 | min_throughput_mbps: 36 | uuid: 37 | autosize: 38 | minimum: 39 | shrink_threshold: 40 | maximum: 41 | mode: 42 | grow_threshold: 43 | clone: 44 | parent_volume: 45 | name: 46 | uuid: 47 | parent_snapshot: 48 | name: 49 | uuid: 50 | split_estimate: 51 | split_complete_percent: 52 | split_initiated: 53 | is_flexclone: 54 | parent_svm: 55 | name: 56 | uuid: 57 | is_object_store: 58 | flexcache_endpoint_type: 59 | quota: 60 | state: 61 | efficiency: 62 | compression: 63 | compaction: 64 | dedupe: 65 | policy: 66 | name: 67 | cross_volume_dedupe: 68 | application_io_size: 69 | schedule: 70 | create_time: 71 | access_time_enabled: 72 | queue_for_encryption: 73 | consistency_group: 74 | name: 75 | snaplock: 76 | autocommit_period: 77 | expiry_time: 78 | append_mode_enabled: 79 | litigation_count: 80 | unspecified_retention_file_count: 81 | is_audit_log: 82 | privileged_delete: 83 | compliance_clock_time: 84 | type: 85 | retention: 86 | minimum: 87 | maximum: 88 | default: 89 | language: 90 | movement: 91 | percent_complete: 92 | cutover_window: 93 | destination_aggregate: 94 | name: 95 | uuid: 96 | state: 97 | style: 98 | application: 99 | name: 100 | uuid: 101 | encryption: 102 | rekey: 103 | status: 104 | message: 105 | code: 106 | key_id: 107 | type: 108 | state: 109 | enabled: 110 | tiering: 111 | object_tags: 112 | - 113 | policy: 114 | min_cooling_days: 115 | space: 116 | block_storage_inactive_user_data: 117 | over_provisioned: 118 | performance_tier_footprint: 119 | footprint: 120 | capacity_tier_footprint: 121 | total_footprint: 122 | size: 123 | logical_space: 124 | reporting: 125 | enforcement: 126 | used_by_afs: 127 | available: 128 | used: 129 | snapshot: 130 | used: 131 | reserve_percent: 132 | metadata: 133 | available: 134 | local_tier_footprint: 135 | comment: 136 | guarantee: 137 | type: 138 | honored: 139 | is_svm_root: 140 | snapmirror: 141 | is_protected: 142 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_volume/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for ontap_volume 3 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_volume/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Adrian Bronder 3 | description: Standard definitions for managing volumes 4 | company: NetApp 5 | 6 | # If the issue tracker for your role is not on github, uncomment the 7 | # next line and provide a value 8 | # issue_tracker_url: http://example.com/issue/tracker 9 | 10 | # Choose a valid license ID from https://spdx.org - some suggested licenses: 11 | # - BSD-3-Clause (default) 12 | # - MIT 13 | # - GPL-2.0-or-later 14 | # - GPL-3.0-only 15 | # - Apache-2.0 16 | # - CC-BY-4.0 17 | license: license (GPL-2.0-or-later, MIT, etc) 18 | 19 | min_ansible_version: 2.9 20 | 21 | # If this a Container Enabled role, provide the minimum Ansible Container version. 22 | # min_ansible_container_version: 23 | 24 | # 25 | # Provide a list of supported platforms, and for each platform a list of versions. 26 | # If you don't wish to enumerate all versions for a particular platform, use 'all'. 27 | # To view available platforms and versions (or releases), visit: 28 | # https://galaxy.ansible.com/api/v1/platforms/ 29 | # 30 | # platforms: 31 | # - name: Fedora 32 | # versions: 33 | # - all 34 | # - 25 35 | # - name: SomePlatform 36 | # versions: 37 | # - all 38 | # - 1.0 39 | # - 7 40 | # - 99.99 41 | 42 | galaxy_tags: [] 43 | # List tags for your role here, one per line. A tag is a keyword that describes 44 | # and categorizes the role. Users find roles by searching for tags. Be sure to 45 | # remove the '[]' above, if you add tags to this list. 46 | # 47 | # NOTE: A tag is limited to a single word comprised of alphanumeric characters. 48 | # Maximum 20 tags per role. 49 | 50 | dependencies: [] 51 | # List your role dependencies here, one per line. Be sure to remove the '[]' above, 52 | # if you add dependencies to this list. 53 | 54 | collections: 55 | - netapp.ontap 56 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_volume/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # tasks file for ontap_volume 3 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_volume/tests/inventory: -------------------------------------------------------------------------------- 1 | localhost 2 | 3 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_volume/tests/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | remote_user: root 4 | roles: 5 | - ontap_volume 6 | -------------------------------------------------------------------------------- /ontap9/ansible_pilot/roles/ontap_volume/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # vars file for ontap_volume 3 | -------------------------------------------------------------------------------- /ontap9/awx/20_awxdemo_svm_create.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 20_awxdemo_svm_create.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-09-02 8 | # Description: Create an SVM from a role 9 | # with Ansible modules 10 | # 11 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 12 | # https://galaxy.ansible.com/netapp/ontap 13 | # 14 | # Built-in help: 15 | # ansible-doc netapp.ontap.na_ontap_svm 16 | # 17 | ################################################################################ 18 | 19 | - hosts: localhost 20 | gather_facts: false 21 | vars_files: 22 | - ../global.vars 23 | # Attention: Modules from collections called within role/tasks can't be 24 | # reference globally in the playbook. Each module has to be specified with 25 | # its full path! 26 | 27 | roles: 28 | - awxdemo_svm_create 29 | -------------------------------------------------------------------------------- /ontap9/awx/30_awxdemo_fullcifs_create.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 30_awxdemo_fullcifs_create.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-09-02 8 | # Description: Create a CIFS share from a role 9 | # with Ansible modules 10 | # 11 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 12 | # https://galaxy.ansible.com/netapp/ontap 13 | # 14 | # Built-in help: 15 | # ansible-doc netapp.ontap.na_ontap_cifs 16 | # 17 | ################################################################################ 18 | 19 | - hosts: localhost 20 | gather_facts: false 21 | vars_files: 22 | - ../global.vars 23 | # Attention: Modules from collections called within role/tasks can't be 24 | # reference globally in the playbook. Each module has to be specified with 25 | # its full path! 26 | 27 | roles: 28 | - awxdemo_fullcifs_create 29 | -------------------------------------------------------------------------------- /ontap9/awx/35_awxdemo_fullnfs_create.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 35_awxdemo_fullnfs_create.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-09-02 8 | # Description: Create an NFS export from a role 9 | # with Ansible modules 10 | # 11 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 12 | # https://galaxy.ansible.com/netapp/ontap 13 | # 14 | # Built-in help: 15 | # ansible-doc netapp.ontap.na_ontap_qtree 16 | # 17 | ################################################################################ 18 | 19 | - hosts: localhost 20 | gather_facts: false 21 | vars_files: 22 | - ../global.vars 23 | # Attention: Modules from collections called within role/tasks can't be 24 | # reference globally in the playbook. Each module has to be specified with 25 | # its full path! 26 | 27 | roles: 28 | - awxdemo_fullnfs_create 29 | -------------------------------------------------------------------------------- /ontap9/awx/40_awxdemo_fulliscsiwin_create.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 40_awxdemo_fulliscsiwin_create.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-09-02 8 | # Description: Create a Windows LUN from a role 9 | # with Ansible modules 10 | # 11 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 12 | # https://galaxy.ansible.com/netapp/ontap 13 | # 14 | # Built-in help: 15 | # ansible-doc netapp.ontap.na_ontap_lun 16 | # 17 | ################################################################################ 18 | 19 | - hosts: localhost 20 | gather_facts: false 21 | vars_files: 22 | - ../global.vars 23 | # Attention: Modules from collections called within role/tasks can't be 24 | # reference globally in the playbook. Each module has to be specified with 25 | # its full path! 26 | 27 | roles: 28 | - awxdemo_fulliscsiwin_create 29 | -------------------------------------------------------------------------------- /ontap9/awx/45_awxdemo_fulliscsilin_create.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 45_awxdemo_fulliscsilin_create.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-09-02 8 | # Description: Create a Linux LUN from a role 9 | # with Ansible modules 10 | # 11 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 12 | # https://galaxy.ansible.com/netapp/ontap 13 | # 14 | # Built-in help: 15 | # ansible-doc netapp.ontap.na_ontap_lun 16 | # 17 | ################################################################################ 18 | 19 | - hosts: localhost 20 | gather_facts: false 21 | vars_files: 22 | - ../global.vars 23 | # Attention: Modules from collections called within role/tasks can't be 24 | # reference globally in the playbook. Each module has to be specified with 25 | # its full path! 26 | 27 | roles: 28 | - awxdemo_fulliscsilin_create 29 | -------------------------------------------------------------------------------- /ontap9/awx/90_awxdemo_full_delete.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 90_awxdemo_full_delete.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-09-02 8 | # Description: Delete entire SVM and related objects 9 | # with Ansible modules 10 | # 11 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 12 | # https://galaxy.ansible.com/netapp/ontap 13 | # 14 | # Built-in help: 15 | # ansible-doc netapp.ontap.na_ontap_svm 16 | # 17 | ################################################################################ 18 | 19 | - hosts: localhost 20 | gather_facts: false 21 | vars_files: 22 | - ../global.vars 23 | # Attention: Modules from collections called within role/tasks can't be 24 | # reference globally in the playbook. Each module has to be specified with 25 | # its full path! 26 | 27 | roles: 28 | - awxdemo_full_delete 29 | -------------------------------------------------------------------------------- /ontap9/awx/requirements.yml: -------------------------------------------------------------------------------- 1 | --- 2 | collections: 3 | - name: netapp.ontap 4 | version: 20.10.0 5 | - name: netapp.um_info 6 | version: 20.6.0 7 | - name: awx.awx 8 | version: 15.0.0 9 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_full_delete/README.md: -------------------------------------------------------------------------------- 1 | awxdemo_full_delete 2 | ========= 3 | Deletes entire SVM and related objects created during the demo. 4 | 5 | 6 | Requirements 7 | ------------ 8 | Since this uses the NetApp ONTAP modules it will require the python library netapp-lib as well as the Ansible 2.8 release or later. 9 | 10 | 11 | Role Variables 12 | -------------- 13 | ``` 14 | ``` 15 | 16 | 17 | Dependencies 18 | ------------ 19 | 20 | 21 | Example Playbook 22 | ---------------- 23 | ``` 24 | ``` 25 | 26 | 27 | License 28 | ------- 29 | Apache license 2.0 30 | 31 | 32 | Author Information 33 | ------------------ 34 | Adrian Bronder 35 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_full_delete/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for awxdemo-full-delete 3 | https: true 4 | validate_certs: false 5 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_full_delete/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for awxdemo-full-delete 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_full_delete/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Adrian Bronder 3 | description: Delete entire SVM and related objects 4 | license: Apache Licenses 2.0 5 | min_ansible_version: 2.8 6 | galaxy_tags: [] 7 | dependencies: [] 8 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_full_delete/tests/inventory: -------------------------------------------------------------------------------- 1 | localhost 2 | 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_full_delete/tests/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | remote_user: root 4 | roles: 5 | - awxdemo-full-delete 6 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_full_delete/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # vars file for awxdemo-full-delete 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullcifs_create/README.md: -------------------------------------------------------------------------------- 1 | awxdemo_fullcifs_create 2 | ========= 3 | Create a CIFS share on a dedicated qtree and volume. 4 | 5 | 6 | Requirements 7 | ------------ 8 | Since this uses the NetApp ONTAP modules it will require the python library netapp-lib as well as the Ansible 2.8 release or later. 9 | 10 | 11 | Role Variables 12 | -------------- 13 | ``` 14 | ``` 15 | 16 | 17 | Dependencies 18 | ------------ 19 | 20 | 21 | Example Playbook 22 | ---------------- 23 | ``` 24 | ``` 25 | 26 | 27 | License 28 | ------- 29 | Apache license 2.0 30 | 31 | 32 | Author Information 33 | ------------------ 34 | Adrian Bronder 35 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullcifs_create/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for awxdemo-fullsvm-create 3 | https: true 4 | validate_certs: false 5 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullcifs_create/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for awxdemo-fullcifs-create 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullcifs_create/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Adrian Bronder 3 | description: Create a CIFS share on a dedicated volume and qtree 4 | license: Apache Licenses 2.0 5 | min_ansible_version: 2.8 6 | galaxy_tags: [] 7 | dependencies: [] 8 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullcifs_create/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create volume on primary SVM 3 | netapp.ontap.na_ontap_volume: 4 | state: present 5 | name: "{{ PRI_SVM }}_cifs_01" 6 | vserver: "{{ PRI_SVM }}" 7 | size: "{{ VOL_SIZE }}" 8 | size_unit: b 9 | aggregate_name: "{{ PRI_AGGR }}" 10 | comment: Created with Ansible 11 | space_guarantee: volume 12 | policy: default 13 | junction_path: "/{{ PRI_SVM }}_cifs_01" 14 | volume_security_style: ntfs 15 | hostname: "{{ PRI_CLU }}" 16 | username: "{{ PRI_CLU_USER }}" 17 | password: "{{ PRI_CLU_PASS }}" 18 | https: true 19 | validate_certs: false 20 | 21 | - name: Create qtree on primary SVM 22 | netapp.ontap.na_ontap_qtree: 23 | state: present 24 | name: "cifs_01" 25 | vserver: "{{ PRI_SVM }}" 26 | flexvol_name: "{{ PRI_SVM }}_cifs_01" 27 | security_style: ntfs 28 | hostname: "{{ PRI_CLU }}" 29 | username: "{{ PRI_CLU_USER }}" 30 | password: "{{ PRI_CLU_PASS }}" 31 | https: true 32 | validate_certs: false 33 | 34 | - name: Create CIFS share on primary SVM 35 | netapp.ontap.na_ontap_cifs: 36 | state: present 37 | share_name: "share_01" 38 | vserver: "{{ PRI_SVM }}" 39 | path: "/{{ PRI_SVM }}_cifs_01/cifs_01/" 40 | hostname: "{{ PRI_CLU }}" 41 | username: "{{ PRI_CLU_USER }}" 42 | password: "{{ PRI_CLU_PASS }}" 43 | https: true 44 | validate_certs: false 45 | 46 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullcifs_create/tests/inventory: -------------------------------------------------------------------------------- 1 | localhost 2 | 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullcifs_create/tests/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | remote_user: root 4 | roles: 5 | - awxdemo-fullcifs-create 6 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullcifs_create/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # vars file for awxdemo-fullcifs-create 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsilin_create/README.md: -------------------------------------------------------------------------------- 1 | awxdemo_fulliscsilin_create 2 | ========= 3 | Create a Linux LUN on a dedicated volume. 4 | 5 | 6 | Requirements 7 | ------------ 8 | Since this uses the NetApp ONTAP modules it will require the python library netapp-lib as well as the Ansible 2.8 release or later. 9 | 10 | 11 | Role Variables 12 | -------------- 13 | ``` 14 | ``` 15 | 16 | 17 | Dependencies 18 | ------------ 19 | 20 | 21 | Example Playbook 22 | ---------------- 23 | ``` 24 | ``` 25 | 26 | 27 | License 28 | ------- 29 | Apache license 2.0 30 | 31 | 32 | Author Information 33 | ------------------ 34 | Adrian Bronder 35 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsilin_create/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for awxdemo-fulliscsilin-create 3 | https: true 4 | validate_certs: false 5 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsilin_create/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for awxdemo-fulliscsilin-create 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsilin_create/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Adrian Bronder 3 | description: Create a Linux LUN on a dedicated volume 4 | license: Apache Licenses 2.0 5 | min_ansible_version: 2.8 6 | galaxy_tags: [] 7 | dependencies: [] 8 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsilin_create/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create volume on primary SVM 3 | netapp.ontap.na_ontap_volume: 4 | state: present 5 | name: "{{ PRI_SVM }}_iscsilin_01" 6 | vserver: "{{ PRI_SVM }}" 7 | size: "{{ VOL_SIZE }}" 8 | size_unit: b 9 | aggregate_name: "{{ PRI_AGGR }}" 10 | comment: Created with Ansible 11 | space_guarantee: volume 12 | policy: default 13 | volume_security_style: unix 14 | hostname: "{{ PRI_CLU }}" 15 | username: "{{ PRI_CLU_USER }}" 16 | password: "{{ PRI_CLU_PASS }}" 17 | https: true 18 | validate_certs: false 19 | 20 | - name: Create LUN on primary SVM 21 | netapp.ontap.na_ontap_lun: 22 | state: present 23 | name: "{{ PRI_SVM }}_lunlin_01" 24 | vserver: "{{ PRI_SVM }}" 25 | flexvol_name: "{{ PRI_SVM }}_iscsilin_01" 26 | size: "{{ LUN_SIZE }}" 27 | size_unit: b 28 | space_reserve: true 29 | ostype: windows 30 | hostname: "{{ PRI_CLU }}" 31 | username: "{{ PRI_CLU_USER }}" 32 | password: "{{ PRI_CLU_PASS }}" 33 | https: true 34 | validate_certs: false 35 | 36 | - name: Create igroup on primary SVM 37 | na_ontap_igroup: 38 | state: present 39 | name: "{{ PRI_SVM }}_linig_01" 40 | vserver: "{{ PRI_SVM }}" 41 | initiator_group_type: iscsi 42 | ostype: linux 43 | initiator: "{{ LIN_IQN }}" 44 | hostname: "{{ PRI_CLU }}" 45 | username: "{{ PRI_CLU_USER }}" 46 | password: "{{ PRI_CLU_PASS }}" 47 | https: true 48 | validate_certs: false 49 | 50 | - name: Map LUN to igroup 51 | na_ontap_lun_map: 52 | state: present 53 | vserver: "{{ PRI_SVM }}" 54 | initiator_group_name: "{{ PRI_SVM }}_linig_01" 55 | path: "/vol/{{ PRI_SVM }}_iscsilin_01/{{ PRI_SVM }}_lunlin_01" 56 | hostname: "{{ PRI_CLU }}" 57 | username: "{{ PRI_CLU_USER }}" 58 | password: "{{ PRI_CLU_PASS }}" 59 | https: true 60 | validate_certs: false 61 | 62 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsilin_create/tests/inventory: -------------------------------------------------------------------------------- 1 | localhost 2 | 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsilin_create/tests/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | remote_user: root 4 | roles: 5 | - awxdemo-fulliscsilin-create 6 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsilin_create/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # vars file for awxdemo-fulliscsilin-create 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsiwin_create/README.md: -------------------------------------------------------------------------------- 1 | awxdemo_fulliscsiwin_create 2 | ========= 3 | Create a Windows LUN on a dedicated volume. 4 | 5 | 6 | Requirements 7 | ------------ 8 | Since this uses the NetApp ONTAP modules it will require the python library netapp-lib as well as the Ansible 2.8 release or later. 9 | 10 | 11 | Role Variables 12 | -------------- 13 | ``` 14 | ``` 15 | 16 | 17 | Dependencies 18 | ------------ 19 | 20 | 21 | Example Playbook 22 | ---------------- 23 | ``` 24 | ``` 25 | 26 | 27 | License 28 | ------- 29 | Apache license 2.0 30 | 31 | 32 | Author Information 33 | ------------------ 34 | Adrian Bronder 35 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsiwin_create/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for awxdemo-fulliscsiwin-create 3 | https: true 4 | validate_certs: false 5 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsiwin_create/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for awxdemo-fulliscsiwin-create 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsiwin_create/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Adrian Bronder 3 | description: Create a Windows LUN on a dedicated volume 4 | license: Apache Licenses 2.0 5 | min_ansible_version: 2.8 6 | galaxy_tags: [] 7 | dependencies: [] 8 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsiwin_create/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create volume on primary SVM 3 | netapp.ontap.na_ontap_volume: 4 | state: present 5 | name: "{{ PRI_SVM }}_iscsiwin_01" 6 | vserver: "{{ PRI_SVM }}" 7 | size: "{{ VOL_SIZE }}" 8 | size_unit: b 9 | aggregate_name: "{{ PRI_AGGR }}" 10 | comment: Created with Ansible 11 | space_guarantee: volume 12 | policy: default 13 | volume_security_style: unix 14 | hostname: "{{ PRI_CLU }}" 15 | username: "{{ PRI_CLU_USER }}" 16 | password: "{{ PRI_CLU_PASS }}" 17 | https: true 18 | validate_certs: false 19 | 20 | - name: Create LUN on primary SVM 21 | netapp.ontap.na_ontap_lun: 22 | state: present 23 | name: "{{ PRI_SVM }}_lunwin_01" 24 | vserver: "{{ PRI_SVM }}" 25 | flexvol_name: "{{ PRI_SVM }}_iscsiwin_01" 26 | size: "{{ LUN_SIZE }}" 27 | size_unit: b 28 | space_reserve: true 29 | ostype: windows 30 | hostname: "{{ PRI_CLU }}" 31 | username: "{{ PRI_CLU_USER }}" 32 | password: "{{ PRI_CLU_PASS }}" 33 | https: true 34 | validate_certs: false 35 | 36 | - name: Create igroup on primary SVM 37 | na_ontap_igroup: 38 | state: present 39 | name: "{{ PRI_SVM }}_winig_01" 40 | vserver: "{{ PRI_SVM }}" 41 | initiator_group_type: iscsi 42 | ostype: windows 43 | initiator: "{{ WIN_IQN }}" 44 | hostname: "{{ PRI_CLU }}" 45 | username: "{{ PRI_CLU_USER }}" 46 | password: "{{ PRI_CLU_PASS }}" 47 | https: true 48 | validate_certs: false 49 | 50 | - name: Map LUN to igroup 51 | na_ontap_lun_map: 52 | state: present 53 | vserver: "{{ PRI_SVM }}" 54 | initiator_group_name: "{{ PRI_SVM }}_winig_01" 55 | path: "/vol/{{ PRI_SVM }}_iscsiwin_01/{{ PRI_SVM }}_lunwin_01" 56 | hostname: "{{ PRI_CLU }}" 57 | username: "{{ PRI_CLU_USER }}" 58 | password: "{{ PRI_CLU_PASS }}" 59 | https: true 60 | validate_certs: false 61 | 62 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsiwin_create/tests/inventory: -------------------------------------------------------------------------------- 1 | localhost 2 | 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsiwin_create/tests/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | remote_user: root 4 | roles: 5 | - awxdemo-fulliscsiwin-create 6 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fulliscsiwin_create/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # vars file for awxdemo-fulliscsiwin-create 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullnfs_create/README.md: -------------------------------------------------------------------------------- 1 | awxdemo_fullnfs_create 2 | ========= 3 | Create an NFS export on a dedicated qtree and volume. 4 | 5 | 6 | Requirements 7 | ------------ 8 | Since this uses the NetApp ONTAP modules it will require the python library netapp-lib as well as the Ansible 2.8 release or later. 9 | 10 | 11 | Role Variables 12 | -------------- 13 | ``` 14 | ``` 15 | 16 | 17 | Dependencies 18 | ------------ 19 | 20 | 21 | Example Playbook 22 | ---------------- 23 | ``` 24 | ``` 25 | 26 | 27 | License 28 | ------- 29 | Apache license 2.0 30 | 31 | 32 | Author Information 33 | ------------------ 34 | Adrian Bronder 35 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullnfs_create/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for awxdemo-fullnfs-create 3 | https: true 4 | validate_certs: false 5 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullnfs_create/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for awxdemo-fullnfs-create 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullnfs_create/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Adrian Bronder 3 | description: Create an NFS exort on a dedicated volume and qtree 4 | license: Apache Licenses 2.0 5 | min_ansible_version: 2.8 6 | galaxy_tags: [] 7 | dependencies: [] 8 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullnfs_create/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create volume on primary SVM 3 | netapp.ontap.na_ontap_volume: 4 | state: present 5 | name: "{{ PRI_SVM }}_nfs_01" 6 | vserver: "{{ PRI_SVM }}" 7 | size: "{{ VOL_SIZE }}" 8 | size_unit: b 9 | aggregate_name: "{{ PRI_AGGR }}" 10 | comment: Created with Ansible 11 | space_guarantee: volume 12 | policy: default 13 | junction_path: "/{{ PRI_SVM }}_nfs_01" 14 | volume_security_style: unix 15 | hostname: "{{ PRI_CLU }}" 16 | username: "{{ PRI_CLU_USER }}" 17 | password: "{{ PRI_CLU_PASS }}" 18 | https: true 19 | validate_certs: false 20 | 21 | - name: Create qtree on primary SVM 22 | netapp.ontap.na_ontap_qtree: 23 | state: present 24 | name: "nfs_01" 25 | vserver: "{{ PRI_SVM }}" 26 | flexvol_name: "{{ PRI_SVM }}_nfs_01" 27 | security_style: unix 28 | hostname: "{{ PRI_CLU }}" 29 | username: "{{ PRI_CLU_USER }}" 30 | password: "{{ PRI_CLU_PASS }}" 31 | https: true 32 | validate_certs: false 33 | 34 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullnfs_create/tests/inventory: -------------------------------------------------------------------------------- 1 | localhost 2 | 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullnfs_create/tests/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | remote_user: root 4 | roles: 5 | - awxdemo-fullnfs-create 6 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_fullnfs_create/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # vars file for awxdemo-fullnfs-create 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_svm_create/README.md: -------------------------------------------------------------------------------- 1 | awxdemo_svm_create 2 | ========= 3 | Create an SVM on an ONTAP cluster. 4 | 5 | 6 | Requirements 7 | ------------ 8 | Since this uses the NetApp ONTAP modules it will require the python library netapp-lib as well as the Ansible 2.8 release or later. 9 | 10 | 11 | Role Variables 12 | -------------- 13 | ``` 14 | ``` 15 | 16 | 17 | Dependencies 18 | ------------ 19 | 20 | 21 | Example Playbook 22 | ---------------- 23 | ``` 24 | ``` 25 | 26 | 27 | License 28 | ------- 29 | Apache license 2.0 30 | 31 | 32 | Author Information 33 | ------------------ 34 | Adrian Bronder 35 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_svm_create/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for awxdemo-svm-create 3 | https: true 4 | validate_certs: false 5 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_svm_create/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for awxdemo-svm-create 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_svm_create/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Adrian Bronder 3 | description: Create an SVM on an ONTAP cluster 4 | license: Apache Licenses 2.0 5 | min_ansible_version: 2.8 6 | galaxy_tags: [] 7 | dependencies: [] 8 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_svm_create/tests/inventory: -------------------------------------------------------------------------------- 1 | localhost 2 | 3 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_svm_create/tests/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | remote_user: root 4 | roles: 5 | - awxdemo-svm-create 6 | -------------------------------------------------------------------------------- /ontap9/awx/roles/awxdemo_svm_create/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # vars file for awxdemo-svm-create 3 | -------------------------------------------------------------------------------- /ontap9/curl/03_get_filesystem_details.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 03_get_filesystem_details.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-16 8 | # Description: Get filesystem information 9 | # with simple curl commands 10 | # 11 | # APIs: /api/storage/volumes 12 | # /api/storage/qtrees 13 | # /api/protocols/cifs/shares 14 | # 15 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 16 | # https:///docs/api 17 | # 18 | # Sample CLI call: 19 | # curl -X GET -u ":" "https:///api/storage/volumes" --insecure 20 | # 21 | ################################################################################ 22 | 23 | 24 | ### Step 1 - Read in global variables 25 | GLOBAL_VARS=$(dirname $0)/../global.vars 26 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 27 | 28 | 29 | ### Step 2 - Create HTTP headers 30 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 31 | HEAD_AUTH="authorization: Basic $TOKEN" 32 | HEAD_APP="accept: application/hal+json" 33 | 34 | 35 | ### Step 3 - Get & print details 36 | # Volumes 37 | API="https://$PRI_CLU/api/storage/volumes?fields=*" 38 | echo -e "--> calling $API" 39 | REST_RESPONSE=`curl -s \ 40 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X GET "$API"` 41 | 42 | echo -e "--> Printing volume details" 43 | printf "%-20s %-25s %-15s %-15s\n" "SVM" "Name" "Size" "Used" 44 | echo -e $REST_RESPONSE | jq -r '.records[] | [.svm.name, .name, .size, .space.used] | @tsv' | 45 | while IFS=$'\t' read -r SVM NAME SIZE USED; do 46 | printf "%-20s %-25s %-15s %-15s\n" $SVM $NAME $SIZE $USED 47 | done 48 | echo -e "" 49 | 50 | # Qtrees 51 | API="https://$PRI_CLU/api/storage/qtrees?fields=*" 52 | echo -e "--> calling $API" 53 | REST_RESPONSE=`curl -s \ 54 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X GET "$API"` 55 | 56 | echo -e "--> Printing qtree details" 57 | printf "%-20s %-10s %-15s %-35s\n" "SVM" "Style" "Export Policy" "Path" 58 | echo -e $REST_RESPONSE | jq -r '.records[] | [.svm.name, .security_style, .export_policy.name, .path] | @tsv' | 59 | while IFS=$'\t' read -r SVM STYLE EPOLICY PATH; do 60 | printf "%-20s %-10s %-15s %-35s\n" $SVM $STYLE $EPOLICY $PATH 61 | done 62 | echo -e "" 63 | 64 | # CIFS Shares 65 | API="https://$PRI_CLU/api/protocols/cifs/shares?fields=*" 66 | echo -e "--> calling $API" 67 | REST_RESPONSE=`curl -s \ 68 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X GET "$API"` 69 | 70 | echo -e "--> Printing CIFS share details" 71 | printf "%-20s %-15s %-35s\n" "SVM" "Share" "Path" 72 | echo -e $REST_RESPONSE | sed 's/\\/\\\\/g' | jq -r '.records[] | [.svm.name, .name, .path] | @tsv' | 73 | while IFS=$'\t' read -r SVM SHARE PATH; do 74 | printf "%-20s %-15s %-35s\n" $SVM $SHARE $PATH 75 | done 76 | echo -e "" 77 | -------------------------------------------------------------------------------- /ontap9/curl/21_create_pri_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 21_create_pri_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-11 8 | # Description: Create primary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/svm/svms 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/svms/svm" -d '' --insecure 18 | # curl -X GET -u ":" "https://cluster>/api/cluster/jobs/" --insecure 19 | # 20 | ################################################################################ 21 | 22 | 23 | ### Step 1 - Read in global variables 24 | GLOBAL_VARS=$(dirname $0)/../global.vars 25 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 26 | 27 | 28 | ### Step 2 - Create HTTP headers 29 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 30 | HEAD_AUTH="authorization: Basic $TOKEN" 31 | HEAD_APP="accept: application/hal+json" 32 | 33 | 34 | ### Step 3 - Create operation 35 | API="https://$PRI_CLU/api/svm/svms" 36 | POST_DATA=`cat < SVM create job was started here:\nhttps://$PRI_CLU$JOB_URL" 54 | 55 | JOB_API="https://$PRI_CLU/$JOB_URL" 56 | JOB_STATUS="running" 57 | while [[ $JOB_STATUS == "running" ]]; do 58 | JOB_STATUS=`curl -s \ 59 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X GET "$JOB_API" | jq -r '.state'` 60 | echo -e "Job in state: $JOB_STATUS" 61 | sleep 2 62 | done 63 | echo -e "" 64 | -------------------------------------------------------------------------------- /ontap9/curl/22_create_mgmtlif_pri_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 22_create_mgmtlif_pri_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-16 8 | # Description: Create a management interface on primary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/network/ip/interfaces 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/network/ip/interfaces" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | API="https://$PRI_CLU/api/network/ip/interfaces" 35 | POST_DATA=`cat < Creating management interface on SVM:" 60 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 61 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 62 | 63 | echo -e $REST_RESPONSE 64 | echo -e "" -------------------------------------------------------------------------------- /ontap9/curl/23_create_dns_pri_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 23_create_dns_pri_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-16 8 | # Description: Create DNS on primary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/name-services/dns 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/name-services/dns" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | ### Step 2 - Create HTTP headers 27 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 28 | HEAD_AUTH="authorization: Basic $TOKEN" 29 | HEAD_APP="accept: application/hal+json" 30 | 31 | 32 | ### Step 3 - Create operation 33 | API="https://$PRI_CLU/api/name-services/dns" 34 | POST_DATA=`cat < Creating DNS configuration on SVM:" 49 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 50 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 51 | 52 | echo -e $REST_RESPONSE 53 | echo -e "" -------------------------------------------------------------------------------- /ontap9/curl/24_create_snappolicy.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 24_create_snappolicy.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-04-07 8 | # Description: Create a snapshot policy on primary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/storage/snapshot-policies 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/storage/snapshot-policies" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | API="https://$PRI_CLU/api/storage/snapshot-policies" 35 | POST_DATA=`cat < Creating snapshot policy on SVM:" 71 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 72 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 73 | 74 | echo -e $REST_RESPONSE 75 | echo -e "" 76 | -------------------------------------------------------------------------------- /ontap9/curl/25_create_cifslif_pri_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 25_create_cifslif_pri_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-16 8 | # Description: Create a CIFS interface on primary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/network/ip/interfaces 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/network/ip/interfaces" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | API="https://$PRI_CLU/api/network/ip/interfaces" 35 | POST_DATA=`cat < Creating CIFS interface on SVM:" 60 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 61 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 62 | 63 | echo -e $REST_RESPONSE 64 | echo -e "" -------------------------------------------------------------------------------- /ontap9/curl/25_create_nfslif_pri_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 25_create_nfslif_pri_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-16 8 | # Description: Create a NFS interface on primary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/network/ip/interfaces 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | 16 | # 17 | # Sample CLI calls: 18 | # curl -X POST -u ":" "https:///api/network/ip/interfaces" -d '' --insecure 19 | # 20 | ################################################################################ 21 | 22 | 23 | ### Step 1 - Read in global variables 24 | GLOBAL_VARS=$(dirname $0)/../global.vars 25 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 26 | 27 | 28 | ### Step 2 - Create HTTP headers 29 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 30 | HEAD_AUTH="authorization: Basic $TOKEN" 31 | HEAD_APP="accept: application/hal+json" 32 | 33 | 34 | ### Step 3 - Create opeartion 35 | API="https://$PRI_CLU/api/network/ip/interfaces" 36 | POST_DATA=`cat < Creating NFS interface on SVM:" 61 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 62 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 63 | 64 | echo -e $REST_RESPONSE 65 | echo -e "" 66 | -------------------------------------------------------------------------------- /ontap9/curl/26_create_cifs_pri_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 26_create_cifs_pri_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-16 8 | # Description: Create CIFS server on primary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/protocols/cifs/services 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | 16 | # 17 | # Sample CLI calls: 18 | # curl -X POST -u ":" "https:///api/protocols/cifs/services" -d '' --insecure 19 | # 20 | ################################################################################ 21 | 22 | 23 | ### Step 1 - Read in global variables 24 | GLOBAL_VARS=$(dirname $0)/../global.vars 25 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 26 | 27 | 28 | ### Step 2 - Create HTTP headers 29 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 30 | HEAD_AUTH="authorization: Basic $TOKEN" 31 | HEAD_APP="accept: application/hal+json" 32 | 33 | 34 | ### Step 3 - Create operation 35 | API="https://$PRI_CLU/api/protocols/cifs/services" 36 | POST_DATA=`cat < CIFS server create job was started here:\nhttps://$PRI_CLU$JOB_URL" 57 | 58 | JOB_API="https://$PRI_CLU/$JOB_URL" 59 | JOB_STATUS="running" 60 | while [[ $JOB_STATUS == "running" ]]; do 61 | JOB_STATUS=`curl -s \ 62 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X GET "$JOB_API" | jq -r '.state'` 63 | echo -e "Job in state: $JOB_STATUS" 64 | sleep 2 65 | done 66 | echo -e "" 67 | -------------------------------------------------------------------------------- /ontap9/curl/26_create_nfs_pri_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 26_create_nfs_pri_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-16 8 | # Description: Create NFS server on primary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/protocols/nfs/services 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/protocols/nfs/services" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | API="https://$PRI_CLU/api/protocols/nfs/services" 35 | POST_DATA=`cat < Creating NFS server on SVM:" 50 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 51 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 52 | 53 | echo -e $REST_RESPONSE 54 | echo -e "" 55 | -------------------------------------------------------------------------------- /ontap9/curl/31_create_cifsvol_pri_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 31_create_cifsvol_pri_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-16 8 | # Description: Create volume on primary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/storage/volumes 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/storage/volumes" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | API="https://$PRI_CLU/api/storage/volumes" 35 | POST_DATA=`cat < Volume (CIFS) create job was started here:\nhttps://$PRI_CLU$JOB_URL" 67 | 68 | JOB_API="https://$PRI_CLU/$JOB_URL" 69 | JOB_STATUS="running" 70 | while [[ $JOB_STATUS == "running" ]]; do 71 | JOB_STATUS=`curl -s \ 72 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X GET "$JOB_API" | jq -r '.state'` 73 | echo -e "Job in state: $JOB_STATUS" 74 | sleep 2 75 | done 76 | echo -e "" -------------------------------------------------------------------------------- /ontap9/curl/32_create_cifsqtree_pri_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 32_create_cifsqtree_pri_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-16 8 | # Description: Create qtree on on primary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/storage/qtrees 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/storage/qtrees" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | API="https://$PRI_CLU/api/storage/qtrees" 35 | POST_DATA=`cat < Qtree (CIFS) create job was started here:\nhttps://$PRI_CLU$JOB_URL" 54 | 55 | JOB_API="https://$PRI_CLU/$JOB_URL" 56 | JOB_STATUS="running" 57 | while [[ $JOB_STATUS == "running" ]]; do 58 | JOB_STATUS=`curl -s \ 59 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X GET "$JOB_API" | jq -r '.state'` 60 | echo -e "Job in state: $JOB_STATUS" 61 | sleep 2 62 | done 63 | echo -e "" -------------------------------------------------------------------------------- /ontap9/curl/33_create_cifsshare_pri_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 33_create_cifsshare_pri_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-16 8 | # Description: Create CIFS share on primary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/protocols/cifs/shares 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/protocols/cifs/shares" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | API="https://$PRI_CLU/api/protocols/cifs/shares" 35 | POST_DATA=`cat < Creating CIFS share on SVM:" 46 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 47 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 48 | 49 | echo -e $REST_RESPONSE 50 | echo -e "" -------------------------------------------------------------------------------- /ontap9/curl/36_create_nfsvol_pri_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 36_create_nfsvol_pri_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-16 8 | # Description: Create volume on primary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/storage/volumes 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/storage/volumes" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | API="https://$PRI_CLU/api/storage/volumes" 35 | POST_DATA=`cat < Volume (NFS) create job was started here:\nhttps://$PRI_CLU$JOB_URL" 67 | 68 | JOB_API="https://$PRI_CLU/$JOB_URL" 69 | JOB_STATUS="running" 70 | while [[ $JOB_STATUS == "running" ]]; do 71 | JOB_STATUS=`curl -s \ 72 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X GET "$JOB_API" | jq -r '.state'` 73 | echo -e "Job in state: $JOB_STATUS" 74 | sleep 2 75 | done 76 | echo -e "" -------------------------------------------------------------------------------- /ontap9/curl/37_create_nfsqtree_pri_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 37_create_nfsqtree_pri_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-16 8 | # Description: Create qtree on primary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/storage/qtrees 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/storage/qtrees" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | API="https://$PRI_CLU/api/storage/qtrees" 35 | POST_DATA=`cat < Qtree (NFS) create job was started here:\nhttps://$PRI_CLU$JOB_URL" 54 | 55 | JOB_API="https://$PRI_CLU/$JOB_URL" 56 | JOB_STATUS="running" 57 | while [[ $JOB_STATUS == "running" ]]; do 58 | JOB_STATUS=`curl -s \ 59 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X GET "$JOB_API" | jq -r '.state'` 60 | echo -e "Job in state: $JOB_STATUS" 61 | sleep 2 62 | done 63 | echo -e "" -------------------------------------------------------------------------------- /ontap9/curl/51_create_iclif_pri_clu.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 51_create_iclif_pri_clu.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-04-07 8 | # Description: Create interconnect LIFs on primary cluster 9 | # with simple curl commands 10 | # 11 | # APIs: /api/network/ip/interfaces 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/network/ip/interfaces" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | # NOTE: A dedicated IPspace es definitely recommended for intercluster traffic! 35 | # For simplicity reasons, the Default IPspace is used in this demo. 36 | API="https://$PRI_CLU/api/network/ip/interfaces" 37 | POST_DATA=`cat < Creating intercluster interface #1:" 62 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 63 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 64 | 65 | echo -e $REST_RESPONSE 66 | echo -e "" 67 | 68 | POST_DATA=`cat < Creating intercluster interface #2:" 93 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 94 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 95 | 96 | echo -e $REST_RESPONSE 97 | echo -e "" 98 | 99 | -------------------------------------------------------------------------------- /ontap9/curl/52_create_iclif_sec_clu.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 52_create_iclif_sec_clu.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-04-07 8 | # Description: Create interconnect LIFs on secondary cluster 9 | # with simple curl commands 10 | # 11 | # APIs: /api/network/ip/interfaces 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/network/ip/interfaces" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$SEC_CLU_USER:$SEC_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | # NOTE: A dedicated IPspace es definitely recommended for intercluster traffic! 35 | # For simplicity reasons, the Default IPspace is used in this demo. 36 | API="https://$SEC_CLU/api/network/ip/interfaces" 37 | POST_DATA=`cat < Creating intercluster interface #1:" 62 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 63 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 64 | 65 | echo -e $REST_RESPONSE 66 | echo -e "" 67 | -------------------------------------------------------------------------------- /ontap9/curl/53_create_cluster_peer.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 53_create_cluster_peer.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-04-07 8 | # Description: Create peering between primary and secondary cluster 9 | # with simple curl commands 10 | # 11 | # APIs: /api/cluster/peers 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/cluster/peers" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$PRI_CLU_USER:$PRI_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | # NOTE: A dedicated IPspace es definitely recommended for intercluster traffic! 35 | # For simplicity reasons, the Default IPspace is used in this demo. 36 | API="https://$PRI_CLU/api/cluster/peers" 37 | POST_DATA=`cat < Creating peering on $PRI_CLU:" 58 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 59 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 60 | 61 | echo -e $REST_RESPONSE 62 | echo -e "" 63 | 64 | API="https://$SEC_CLU/api/cluster/peers" 65 | POST_DATA=`cat < Creating peering on $SEC_CLU:" 87 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 88 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 89 | 90 | echo -e $REST_RESPONSE 91 | echo -e "" 92 | -------------------------------------------------------------------------------- /ontap9/curl/61_create_sec_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 51_create_sec_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-04-07 8 | # Description: Create secondary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/svm/svms 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/svms/svm" -d '' --insecure 18 | # curl -X GET -u ":" "https://cluster>/api/cluster/jobs/" --insecure 19 | # 20 | ################################################################################ 21 | 22 | 23 | ### Step 1 - Read in global variables 24 | GLOBAL_VARS=$(dirname $0)/../global.vars 25 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 26 | 27 | 28 | ### Step 2 - Create HTTP headers 29 | TOKEN=$(echo -n "$SEC_CLU_USER:$SEC_CLU_PASS" | base64) 30 | HEAD_AUTH="authorization: Basic $TOKEN" 31 | HEAD_APP="accept: application/hal+json" 32 | 33 | 34 | ### Step 3 - Create operation 35 | API="https://$SEC_CLU/api/svm/svms" 36 | POST_DATA=`cat < SVM create job was started here:\nhttps://$SEC_CLU$JOB_URL" 54 | 55 | JOB_API="https://$SEC_CLU/$JOB_URL" 56 | JOB_STATUS="running" 57 | while [[ $JOB_STATUS == "running" ]]; do 58 | JOB_STATUS=`curl -s \ 59 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X GET "$JOB_API" | jq -r '.state'` 60 | echo -e "Job in state: $JOB_STATUS" 61 | sleep 2 62 | done 63 | echo -e "" 64 | -------------------------------------------------------------------------------- /ontap9/curl/62_create_mgmtlif_sec_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 52_create_mgmtlif_pri_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-04-07 8 | # Description: Create a management interface on secondary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/network/ip/interfaces 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/network/ip/interfaces" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$SEC_CLU_USER:$SEC_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | API="https://$SEC_CLU/api/network/ip/interfaces" 35 | POST_DATA=`cat < Creating management interface on SVM:" 60 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 61 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 62 | 63 | echo -e $REST_RESPONSE 64 | echo -e "" 65 | -------------------------------------------------------------------------------- /ontap9/curl/63_create_dns_sec_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 63_create_dns_sec_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-04-23 8 | # Description: Create DNS on secondary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/name-services/dns 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/name-services/dns" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | ### Step 2 - Create HTTP headers 27 | TOKEN=$(echo -n "$SEC_CLU_USER:$SEC_CLU_PASS" | base64) 28 | HEAD_AUTH="authorization: Basic $TOKEN" 29 | HEAD_APP="accept: application/hal+json" 30 | 31 | 32 | ### Step 3 - Create operation 33 | API="https://$SEC_CLU/api/name-services/dns" 34 | POST_DATA=`cat < Creating DNS configuration on SVM:" 49 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 50 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 51 | 52 | echo -e $REST_RESPONSE 53 | echo -e "" 54 | -------------------------------------------------------------------------------- /ontap9/curl/64_create_cifs_sec_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 64_create_cifs_sec_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-04-23 8 | # Description: Create CIFS server on secondary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/protocols/cifs/services 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | 16 | # 17 | # Sample CLI calls: 18 | # curl -X POST -u ":" "https:///api/protocols/cifs/services" -d '' --insecure 19 | # 20 | ################################################################################ 21 | 22 | 23 | ### Step 1 - Read in global variables 24 | GLOBAL_VARS=$(dirname $0)/../global.vars 25 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 26 | 27 | 28 | ### Step 2 - Create HTTP headers 29 | TOKEN=$(echo -n "$SEC_CLU_USER:$SEC_CLU_PASS" | base64) 30 | HEAD_AUTH="authorization: Basic $TOKEN" 31 | HEAD_APP="accept: application/hal+json" 32 | 33 | 34 | ### Step 3 - Create operation 35 | API="https://$SEC_CLU/api/protocols/cifs/services" 36 | POST_DATA=`cat < CIFS server create job was started here:\nhttps://$SEC_CLU$JOB_URL" 57 | 58 | JOB_API="https://$SEC_CLU/$JOB_URL" 59 | JOB_STATUS="running" 60 | while [[ $JOB_STATUS == "running" ]]; do 61 | JOB_STATUS=`curl -s \ 62 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X GET "$JOB_API" | jq -r '.state'` 63 | echo -e "Job in state: $JOB_STATUS" 64 | sleep 2 65 | done 66 | echo -e "" 67 | -------------------------------------------------------------------------------- /ontap9/curl/65_create_cifslif_sec_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 65_create_cifslif_sec_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-04-23 8 | # Description: Create a CIFS interface on secondary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/network/ip/interfaces 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/network/ip/interfaces" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$SEC_CLU_USER:$SEC_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | API="https://$SEC_CLU/api/network/ip/interfaces" 35 | POST_DATA=`cat < Creating CIFS interface on SVM:" 60 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 61 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 62 | 63 | echo -e $REST_RESPONSE 64 | echo -e "" 65 | -------------------------------------------------------------------------------- /ontap9/curl/66_create_nfs_sec_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 66_create_nfs_sec_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-04-23 8 | # Description: Create NFS server on secondary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/protocols/nfs/services 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/protocols/nfs/services" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$SEC_CLU_USER:$SEC_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | API="https://$SEC_CLU/api/protocols/nfs/services" 35 | POST_DATA=`cat < Creating NFS server on SVM:" 50 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 51 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 52 | 53 | echo -e $REST_RESPONSE 54 | echo -e "" 55 | -------------------------------------------------------------------------------- /ontap9/curl/67_create_nfslif_sec_svm.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 67_create_nfslif_pri_svm.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-04-23 8 | # Description: Create a NFS interface on secondary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/network/ip/interfaces 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | 16 | # 17 | # Sample CLI calls: 18 | # curl -X POST -u ":" "https:///api/network/ip/interfaces" -d '' --insecure 19 | # 20 | ################################################################################ 21 | 22 | 23 | ### Step 1 - Read in global variables 24 | GLOBAL_VARS=$(dirname $0)/../global.vars 25 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 26 | 27 | 28 | ### Step 2 - Create HTTP headers 29 | TOKEN=$(echo -n "$SEC_CLU_USER:$SEC_CLU_PASS" | base64) 30 | HEAD_AUTH="authorization: Basic $TOKEN" 31 | HEAD_APP="accept: application/hal+json" 32 | 33 | 34 | ### Step 3 - Create opeartion 35 | API="https://$SEC_CLU/api/network/ip/interfaces" 36 | POST_DATA=`cat < Creating NFS interface on SVM:" 61 | REST_RESPONSE=`curl -s -w ' %{http_code}' \ 62 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X POST "$API" -d "$POST_DATA"` 63 | 64 | echo -e $REST_RESPONSE 65 | echo -e "" 66 | -------------------------------------------------------------------------------- /ontap9/curl/68_create_mirrorpolicy.curl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # 5 | # Title: 68_create_mirrorpolicy.curl 6 | # Author: Adrian Bronder 7 | # Date: 2020-04-23 8 | # Description: Create a SnapMirror policy on secondary SVM 9 | # with simple curl commands 10 | # 11 | # APIs: /api/snapmirror/policies 12 | # 13 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 14 | # https:///docs/api 15 | # 16 | # Sample CLI calls: 17 | # curl -X POST -u ":" "https:///api/snapmirror/policies" -d '' --insecure 18 | # 19 | ################################################################################ 20 | 21 | 22 | ### Step 1 - Read in global variables 23 | GLOBAL_VARS=$(dirname $0)/../global.vars 24 | eval "$(jq -r '. | to_entries | .[] | .key + "=\"" + .value + "\""' < $GLOBAL_VARS)" 25 | 26 | 27 | ### Step 2 - Create HTTP headers 28 | TOKEN=$(echo -n "$SEC_CLU_USER:$SEC_CLU_PASS" | base64) 29 | HEAD_AUTH="authorization: Basic $TOKEN" 30 | HEAD_APP="accept: application/hal+json" 31 | 32 | 33 | ### Step 3 - Create operation 34 | API="https://$SEC_CLU/api/snapmirror/policies" 35 | POST_DATA=`cat < Policy create job was started here:\nhttps://$SEC_CLU$JOB_URL" 68 | 69 | JOB_API="https://$SEC_CLU/$JOB_URL" 70 | JOB_STATUS="running" 71 | while [[ $JOB_STATUS == "running" ]]; do 72 | JOB_STATUS=`curl -s \ 73 | -H "$HEAD_APP" -H "$HEAD_AUTH" -X GET "$JOB_API" | jq -r '.state'` 74 | echo -e "Job in state: $JOB_STATUS" 75 | sleep 2 76 | done 77 | echo -e "" 78 | -------------------------------------------------------------------------------- /ontap9/playground/aiqum_test_script.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | HEAD_APP="content-type: application/hal+json" 4 | 5 | API="http://rhel1.demo.netapp.com/api/v2/job_templates/read_info/launch/" 6 | 7 | REST_RESPONSE=`curl -s\ 8 | -H "$HEAD_APP" -u "admin:Netapp1!" -X POST "$API"` 9 | -------------------------------------------------------------------------------- /ontap9/playground/get_snaps_final.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: get_snaps.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-12-14 8 | # Description: Query snapshot information 9 | # with Ansible modules 10 | # 11 | # Modules: na_ontap_info 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://galaxy.ansible.com/netapp/ontap 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.ontap.na_ontap_info 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input: &input 25 | hostname: "{{ PRI_CLU }}" 26 | username: "{{ PRI_CLU_USER }}" 27 | password: "{{ PRI_CLU_PASS }}" 28 | https: true 29 | validate_certs: false 30 | searchtags: 31 | vserver: "{{ PRI_SVM }}" 32 | volume: "{{ PRI_SVM }}_cifs_01" 33 | snapshots: "snap*" 34 | vars_files: 35 | - ../global.vars 36 | collections: 37 | - netapp.ontap 38 | 39 | tasks: 40 | - name: Get Volume Info 41 | na_ontap_info: 42 | state: info 43 | gather_subset: 44 | - volume_info 45 | <<: *input 46 | register: ontap_volumes 47 | 48 | - name: Get Snapshot Info 49 | na_ontap_info: 50 | state: info 51 | gather_subset: 52 | - snapshot_info 53 | desired_attributes: 54 | snapshot-info: 55 | - access-time 56 | - name 57 | - volume 58 | - vserver 59 | query: 60 | snapshot-info: 61 | vserver: "{{ searchtags.vserver }}" 62 | volume: "{{ searchtags.volume }}" 63 | name: "{{ searchtags.snapshots }}" 64 | <<: *input 65 | register: ontap_snapshots 66 | 67 | - name: Print volume details 68 | debug: 69 | msg: 70 | - "SVM: {{ ontap_volumes.ontap_info.volume_info[item].volume_id_attributes.owning_vserver_name }}" 71 | - "Name: {{ ontap_volumes.ontap_info.volume_info[item].volume_id_attributes.name }}" 72 | - "Size: {{ ontap_volumes.ontap_info.volume_info[item].volume_space_attributes.size }}" 73 | - "Used: {{ ontap_volumes.ontap_info.volume_info[item].volume_space_attributes.size_used }}" 74 | loop: 75 | "{{ ontap_volumes.ontap_info.volume_info.keys() }}" 76 | when: 77 | - ontap_volumes.ontap_info.volume_info[item].volume_id_attributes.name == searchtags.volume 78 | - ontap_volumes.ontap_info.volume_info[item].volume_id_attributes.owning_vserver_name == searchtags.vserver 79 | 80 | - name: Print snapshot details 81 | debug: 82 | msg: 83 | - "{{ ontap_snapshots.ontap_info.snapshot_info }}" 84 | -------------------------------------------------------------------------------- /ontap9/powershell/00_certs_and_protocols.ps1: -------------------------------------------------------------------------------- 1 | function Ignore-SelfSignedCerts 2 | { 3 | try 4 | { 5 | Write-Host "Adding TrustAllCertsPolicy type." -ForegroundColor White 6 | Add-Type -TypeDefinition @" 7 | using System.Net; 8 | using System.Security.Cryptography.X509Certificates; 9 | public class TrustAllCertsPolicy : ICertificatePolicy 10 | { 11 | public bool CheckValidationResult( 12 | ServicePoint srvPoint, X509Certificate certificate, 13 | WebRequest request, int certificateProblem) 14 | { 15 | return true; 16 | } 17 | } 18 | "@ 19 | Write-Host "TrustAllCertsPolicy type added." -ForegroundColor White 20 | } 21 | catch 22 | { 23 | Write-Host $_ -ForegroundColor "Yellow" 24 | } 25 | [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy 26 | } 27 | Ignore-SelfSignedCerts 28 | write-host "" 29 | 30 | # Allow all secure protocols 31 | [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12' -------------------------------------------------------------------------------- /ontap9/powershell/01_get_cluster_details.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | 3 | ################################################################################ 4 | # 5 | # Title: 01_get_cluster_details.ps1 6 | # Author: Adrian Bronder 7 | # Date: 2020-04-14 8 | # Description: Get cluster information 9 | # with PowerShell using REST method 10 | # 11 | # APIs: /api/cluster 12 | # /api/cluster/nodes 13 | # /api/storage/aggregates 14 | # /api/network/ethernet/ports 15 | # 16 | # URLs: https://docs.netapp.com/ontap-9/index.jsp 17 | # https:///docs/api 18 | # 19 | # Sample REST call: 20 | # Invoke-RestMethod -Method GET -Headers $hdrs -Uri "https:///api/cluster" 21 | # 22 | ################################################################################ 23 | 24 | 25 | ### Step 1 - Read in global variables 26 | $GLOBAL_VARS=Get-Content -Raw -Path $PSScriptRoot"\..\global.vars" | ConvertFrom-Json 27 | ### Step 1.5 ;-) - Allow self-signed certificates 28 | . $PSScriptRoot\00_certs_and_protocols.ps1 29 | 30 | 31 | ### Step 2 - Create HTTP headers 32 | $TOKEN=[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("admin:Netapp1!")) 33 | $hdrs = @{} 34 | $hdrs.Add("Accept","application/hal+json") 35 | $hdrs.Add("Authorization", "Basic $TOKEN") 36 | 37 | 38 | ### Step 3 - Get & print details 39 | # Cluster 40 | $API="https://$($GLOBAL_VARS.PRI_CLU)/api/cluster?fields=*" 41 | Write-Host "--> calling $API" 42 | $REST_RESPONSE = Invoke-RestMethod -Uri $API -Headers $hdrs -Method GET 43 | #$REST_RESPONSE | ConvertTo-Json 44 | 45 | $ntap_cluster = New-Object -TypeName psobject 46 | $ntap_cluster | Add-Member -MemberType NoteProperty -Name "Name" -Value $REST_RESPONSE.name 47 | $ntap_cluster | Add-Member -MemberType NoteProperty -Name "IP" -Value $REST_RESPONSE.management_interfaces[0].ip.address 48 | $ntap_cluster | Add-Member -MemberType NoteProperty -Name "Version" -Value $REST_RESPONSE.version.full 49 | 50 | Write-Host "--> Printing cluster details" 51 | ($ntap_cluster | Format-List | Out-String).Trim() 52 | Write-Host "" 53 | 54 | # Nodes 55 | $API="https://$($GLOBAL_VARS.PRI_CLU)/api/cluster/nodes?fields=*" 56 | Write-Host "--> calling $API" 57 | $REST_RESPONSE = Invoke-RestMethod -Uri $API -Headers $hdrs -Method GET 58 | 59 | Write-Host "--> Printing node details" 60 | ($REST_RESPONSE.records | Select-Object name, serial_number, model | Out-String).Trim() 61 | 62 | 63 | 64 | #$ntap_nodes = New-Object System.Collections.ArrayList 65 | #foreach($node in $REST_RESPONSE.records){ 66 | # $temp = "" | select "Name", "serial_number", "Model" 67 | # $temp.Name = $node.name 68 | # $temp.serial_number = $node.serial_number 69 | # $temp.Model = $node.model 70 | # $ntap_nodes.Add($temp) | Out-Null 71 | #} 72 | #$ntap_nodes -------------------------------------------------------------------------------- /ontap9/powershell/21_create_pri_svm.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | 3 | ################################################################################ 4 | # 5 | # Title: 21_create_pri_svm.ps1 6 | # Author: Adrian Bronder 7 | # Date: 2020-05-05 8 | # Description: Create a primary SVM 9 | # with ONTAP Python client library 10 | # 11 | # APIs: /api/svm/svms 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://pypi.org/project/netapp-ontap/ 15 | # 16 | ################################################################################ 17 | 18 | 19 | ### Step 1 - Read in global variables 20 | $GLOBAL_VARS = Get-Content -Raw -Path $PSScriptRoot"\..\global.vars" | ConvertFrom-Json 21 | ### Step 1.5 ;-) - Allow self-signed certificates 22 | . $PSScriptRoot\00_certs_and_protocols.ps1 23 | 24 | 25 | ### Step 2 - Create HTTP headers 26 | $TOKEN = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("admin:Netapp1!")) 27 | $hdrs = @{} 28 | $hdrs.Add("Accept","application/hal+json") 29 | $hdrs.Add("Authorization", "Basic $TOKEN") 30 | 31 | 32 | 33 | ### Step 3 - Create opeartion 34 | # execute create operation 35 | $API = "https://$($GLOBAL_VARS.PRI_CLU)/api/svm/svms" 36 | $POST_DATA = @{ 37 | "name" = $GLOBAL_VARS.PRI_SVM 38 | "aggregates" = @( 39 | @{ 40 | "name"= $GLOBAL_VARS.PRI_AGGR 41 | } 42 | ) 43 | "comment"= "Created with PS REST" 44 | } 45 | 46 | $REST_RESPONSE = Invoke-RestMethod -Uri $API -Headers $hdrs -Body ($POST_DATA|ConvertTo-Json) -Method POST 47 | 48 | $JOB_URL=$REST_RESPONSE.job._links.self.href 49 | Write-Host "--> SVM create job was started here:`nhttps://$($GLOBAL_VARS.PRI_CLU)$JOB_URL" 50 | 51 | $JOB_API="https://$($GLOBAL_VARS.PRI_CLU)/$JOB_URL" 52 | $JOB_STATUS="running" 53 | while(($JOB_STATUS -eq "running")){ 54 | $JOB_RESPONSE = Invoke-RestMethod -Uri $JOB_API -Headers $hdrs -Method GET 55 | $JOB_STATUS = $JOB_RESPONSE.state 56 | Write-Host "Job in state: $JOB_STATUS" 57 | sleep 2 58 | } -------------------------------------------------------------------------------- /ontap9/python/01_get_cluster_details.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 01_get_cluster_details.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Get cluster information 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.cluster 12 | # netapp_ontap.resources.node 13 | # netapp_ontap.resources.aggregate 14 | # netapp_ontap.resources.port 15 | # 16 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 17 | # https://pypi.org/project/netapp-ontap/ 18 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 19 | # 20 | ################################################################################ 21 | 22 | import json, os, sys 23 | from netapp_ontap import config, HostConnection, NetAppRestError 24 | from netapp_ontap.resources import Cluster, Node, Aggregate, Port 25 | 26 | 27 | ### Step 1 - Read in global variables 28 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 29 | global_vars = json.load(json_file) 30 | 31 | 32 | ### Step 2 - Configure connection 33 | config.CONNECTION = HostConnection( 34 | global_vars["PRI_CLU"], 35 | username=global_vars["PRI_CLU_USER"], 36 | password=global_vars["PRI_CLU_PASS"], 37 | verify=False 38 | ) 39 | 40 | 41 | ### Step 3 - Get & print details 42 | # Cluster 43 | cluster = Cluster() 44 | cluster.get() 45 | print("--> Printing cluster details\n" 46 | + "Name: %s\n" % (cluster.name) 47 | + "IP: %s\n" % (cluster.management_interfaces[0].ip.address) 48 | + "Version: %s\n" % (cluster.version.full) 49 | ) 50 | 51 | # Nodes 52 | print("--> Printing node details") 53 | print("{:<20}{:<15}{:<10}".format( 54 | "Name", "SN#", "Model") 55 | ) 56 | for node in Node.get_collection(): 57 | node.get() 58 | print("{:<20}{:<15}{:<10}".format( 59 | node.name, 60 | node.serial_number, 61 | node.model 62 | )) 63 | print("") 64 | 65 | # Aggregates 66 | print("--> Printing aggregate details") 67 | print("{:<20}{:<15}{:<15}{:<15}{:<10}".format( 68 | "Name", "Node", "Size", "Used", "State") 69 | ) 70 | for aggr in Aggregate.get_collection(): 71 | aggr.get() 72 | print("{:<20}{:<15}{:<15}{:<15}{:<10}".format( 73 | aggr.name, 74 | aggr.home_node.name, 75 | aggr.space.block_storage.size, 76 | aggr.space.block_storage.used, 77 | aggr.state 78 | )) 79 | print("") 80 | 81 | # Ports 82 | print("--> Printing port details") 83 | print("{:<10}{:<15}{:<10}{:<10}{:<10}{:<15}".format( 84 | "Name", "Node", "Speed", "MTU", "State", "BC Domain") 85 | ) 86 | for port in Port.get_collection(): 87 | port.get() 88 | print("{:<10}{:<15}{:<10}{:<10}{:<10}{:<15}".format( 89 | port.name, 90 | port.node.name, 91 | port.speed, 92 | port.mtu, 93 | port.state, 94 | port.broadcast_domain.name 95 | )) 96 | print("") 97 | -------------------------------------------------------------------------------- /ontap9/python/03_get_filesystem_details.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 03_get_filesystem_details.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Get filesystem information 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.volume 12 | # netapp_ontap.resources.qtree 13 | # netapp_ontap.resources.cifs_sahre 14 | # 15 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 16 | # https://pypi.org/project/netapp-ontap/ 17 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 18 | # 19 | ################################################################################ 20 | 21 | import json, os, sys 22 | from netapp_ontap import config, HostConnection, NetAppRestError 23 | from netapp_ontap.resources import Volume, Qtree, CifsShare 24 | 25 | 26 | ### Step 1 - Read in global variables 27 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 28 | global_vars = json.load(json_file) 29 | 30 | 31 | ### Step 2 - Configure connection 32 | config.CONNECTION = HostConnection( 33 | global_vars["PRI_CLU"], 34 | username=global_vars["PRI_CLU_USER"], 35 | password=global_vars["PRI_CLU_PASS"], 36 | verify=False 37 | ) 38 | 39 | 40 | ### Step 3 - Get & print details 41 | # Volumes 42 | print("--> Printing volume details") 43 | print("{:<20}{:<25}{:<15}{:<15}".format( 44 | "SVM", "Name", "Size", "Used") 45 | ) 46 | for volume in Volume.get_collection(): 47 | volume.get() 48 | print("{:<20}{:<25}{:<15}{:<15}".format( 49 | volume.svm.name, 50 | volume.name, 51 | volume.size, 52 | volume.space.used 53 | )) 54 | print("") 55 | 56 | # Qtrees 57 | print("--> Printing qtree details") 58 | print("{:<20}{:<10}{:<15}{:<35}".format( 59 | "SVM", "Style", "Export Policy", "Path") 60 | ) 61 | for qtree in Qtree.get_collection(): 62 | qtree.get() 63 | print("{:<20}{:<10}{:<15}{:<35}".format( 64 | qtree.svm.name, 65 | qtree.security_style, 66 | qtree.export_policy.name, 67 | qtree.path 68 | )) 69 | print("") 70 | 71 | # CIFS Shares 72 | print("--> Printing CIFS share details") 73 | print("{:<20}{:<15}{:<35}".format( 74 | "SVM", "Share", "Path") 75 | ) 76 | for cifsshare in CifsShare.get_collection(): 77 | cifsshare.get() 78 | print("{:<20}{:<15}{:<35}".format( 79 | cifsshare.svm.name, 80 | cifsshare.name, 81 | cifsshare.path 82 | )) 83 | print("") 84 | -------------------------------------------------------------------------------- /ontap9/python/21_create_pri_svm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 21_create_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Create a primary SVM 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.svm 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://pypi.org/project/netapp-ontap/ 15 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 16 | # 17 | ################################################################################ 18 | 19 | import json, os, sys 20 | from netapp_ontap import config, HostConnection, NetAppRestError 21 | from netapp_ontap.resources import Svm 22 | 23 | 24 | ### Step 1 - Read in global variables 25 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 26 | global_vars = json.load(json_file) 27 | 28 | 29 | ### Step 2 - Configure connection 30 | config.CONNECTION = HostConnection( 31 | global_vars["PRI_CLU"], 32 | username=global_vars["PRI_CLU_USER"], 33 | password=global_vars["PRI_CLU_PASS"], 34 | verify=False 35 | ) 36 | 37 | 38 | ### Step 3 - Create opeartion 39 | # execute create operation 40 | svm = Svm.from_dict( 41 | { 42 | "name": global_vars["PRI_SVM"], 43 | "aggregates": [ 44 | { 45 | "name": global_vars["PRI_AGGR"] 46 | } 47 | ], 48 | "comment": "Created with ONTAP PCL" 49 | }) 50 | 51 | print("--> Starting SVM create operation") 52 | try: 53 | svm.post() 54 | print("--> SVM \"{}\" created successfully".format(svm.name)) 55 | except NetAppRestError as err: 56 | print("--> Error: SVM was not created:\n{}".format(err)) 57 | print("") 58 | -------------------------------------------------------------------------------- /ontap9/python/22_create_mgmtlif_pri_svm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 22_create_mgmtlif_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Create management interface on primary SVM 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.ip_interface 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://pypi.org/project/netapp-ontap/ 15 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 16 | # 17 | ################################################################################ 18 | 19 | import json, os, sys 20 | from netapp_ontap import config, HostConnection, NetAppRestError 21 | from netapp_ontap.resources import IpInterface 22 | 23 | 24 | ### Step 1 - Read in global variables 25 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 26 | global_vars = json.load(json_file) 27 | 28 | 29 | ### Step 2 - Configure connection 30 | config.CONNECTION = HostConnection( 31 | global_vars["PRI_CLU"], 32 | username=global_vars["PRI_CLU_USER"], 33 | password=global_vars["PRI_CLU_PASS"], 34 | verify=False 35 | ) 36 | 37 | 38 | ### Step 3 - Create operation 39 | lif = IpInterface.from_dict( 40 | { 41 | "name": global_vars["PRI_SVM"], 42 | "svm": { 43 | "name": global_vars["PRI_SVM"] 44 | }, 45 | "ip": { 46 | "address": global_vars["PRI_SVM_IP"], 47 | "netmask": global_vars["PRI_SVM_NETMASK"] 48 | }, 49 | "location": { 50 | "home_port": { 51 | "name": global_vars["PRI_MGMT_PORT"], 52 | "node": { 53 | "name": global_vars["PRI_CLU_NODE1"] 54 | } 55 | } 56 | }, 57 | "service_policy": { 58 | "name": "default-management" 59 | } 60 | }) 61 | 62 | print("--> Starting management interface create operation") 63 | try: 64 | lif.post() 65 | print("--> Interface \"{}\" created successfully".format(lif.name)) 66 | except NetAppRestError as err: 67 | print("--> Error: SVM was not created:\n{}".format(err)) 68 | print("") 69 | -------------------------------------------------------------------------------- /ontap9/python/23_create_dns_pri_svm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 23_create_dns_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Create DNS on primary SVM 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.dns 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://pypi.org/project/netapp-ontap/ 15 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 16 | # 17 | ################################################################################ 18 | 19 | import json, os, sys 20 | from netapp_ontap import config, HostConnection, NetAppRestError 21 | from netapp_ontap.resources import Dns 22 | 23 | 24 | ### Step 1 - Read in global variables 25 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 26 | global_vars = json.load(json_file) 27 | 28 | 29 | ### Step 2 - Configure connection 30 | config.CONNECTION = HostConnection( 31 | global_vars["PRI_CLU"], 32 | username=global_vars["PRI_CLU_USER"], 33 | password=global_vars["PRI_CLU_PASS"], 34 | verify=False 35 | ) 36 | 37 | 38 | ### Step 3 - Create operation 39 | dns = Dns.from_dict( 40 | { 41 | "svm": { 42 | "name": global_vars["PRI_SVM"] 43 | }, 44 | "domains": [ 45 | global_vars["PRI_DOMAIN"] 46 | ], 47 | "servers": [ 48 | global_vars["PRI_DNS1"] 49 | ] 50 | }) 51 | 52 | print("--> Starting DNS create operation") 53 | try: 54 | dns.post() 55 | print("--> DNS created successfully on SVM {}".format(dns.svm.name)) 56 | except NetAppRestError as err: 57 | print("--> Error: SVM was not created:\n{}".format(err)) 58 | print("") 59 | -------------------------------------------------------------------------------- /ontap9/python/25_create_cifslif_pri_svm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 25_create_cifslif_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Create CIFS interface on primary SVM 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.IpInterface 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://pypi.org/project/netapp-ontap/ 15 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 16 | # 17 | ################################################################################ 18 | 19 | import json, os, sys 20 | from netapp_ontap import config, HostConnection, NetAppRestError 21 | from netapp_ontap.resources import IpInterface 22 | 23 | 24 | ### Step 1 - Read in global variables 25 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 26 | global_vars = json.load(json_file) 27 | 28 | 29 | ### Step 2 - Configure connection 30 | config.CONNECTION = HostConnection( 31 | global_vars["PRI_CLU"], 32 | username=global_vars["PRI_CLU_USER"], 33 | password=global_vars["PRI_CLU_PASS"], 34 | verify=False 35 | ) 36 | 37 | 38 | ### Step 3 - Create operation 39 | lif = IpInterface.from_dict( 40 | { 41 | "name": global_vars["PRI_SVM"]+"_cifs_01", 42 | "svm": { 43 | "name": global_vars["PRI_SVM"] 44 | }, 45 | "ip": { 46 | "address": global_vars["PRI_SVM_CIFS_IP"], 47 | "netmask": global_vars["PRI_SVM_CIFS_NETMASK"] 48 | }, 49 | "location": { 50 | "home_port": { 51 | "name": global_vars["PRI_DATA_PORT"], 52 | "node": { 53 | "name": global_vars["PRI_CLU_NODE1"] 54 | } 55 | } 56 | }, 57 | "service_policy": { 58 | "name": "default-data-files" 59 | } 60 | }) 61 | 62 | print("--> Starting interface create operation") 63 | try: 64 | lif.post() 65 | print("--> CIFS interface \"{}\" created successfully".format(lif.name)) 66 | except NetAppRestError as err: 67 | print("--> Error: SVM was not created:\n{}".format(err)) 68 | print("") 69 | -------------------------------------------------------------------------------- /ontap9/python/25_create_nfslif_pri_svm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 25_create_nfslif_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Create NFS interface on primary SVM 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.IpInterface 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://pypi.org/project/netapp-ontap/ 15 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 16 | # 17 | ################################################################################ 18 | 19 | import json, os, sys 20 | from netapp_ontap import config, HostConnection, NetAppRestError 21 | from netapp_ontap.resources import IpInterface 22 | 23 | 24 | ### Step 1 - Read in global variables 25 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 26 | global_vars = json.load(json_file) 27 | 28 | 29 | ### Step 2 - Configure connection 30 | config.CONNECTION = HostConnection( 31 | global_vars["PRI_CLU"], 32 | username=global_vars["PRI_CLU_USER"], 33 | password=global_vars["PRI_CLU_PASS"], 34 | verify=False 35 | ) 36 | 37 | 38 | ### Step 3 - Create operation 39 | lif = IpInterface.from_dict( 40 | { 41 | "name": global_vars["PRI_SVM"]+"_nfs_01", 42 | "svm": { 43 | "name": global_vars["PRI_SVM"] 44 | }, 45 | "ip": { 46 | "address": global_vars["PRI_SVM_NFS_IP"], 47 | "netmask": global_vars["PRI_SVM_NFS_NETMASK"] 48 | }, 49 | "location": { 50 | "home_port": { 51 | "name": global_vars["PRI_DATA_PORT"], 52 | "node": { 53 | "name": global_vars["PRI_CLU_NODE1"] 54 | } 55 | } 56 | }, 57 | "service_policy": { 58 | "name": "default-data-files" 59 | } 60 | }) 61 | 62 | print("--> Starting interface create operation") 63 | try: 64 | lif.post() 65 | print("--> NFS interface \"{}\" created successfully".format(lif.name)) 66 | except NetAppRestError as err: 67 | print("--> Error: SVM was not created:\n{}".format(err)) 68 | print("") 69 | -------------------------------------------------------------------------------- /ontap9/python/26_create_cifs_pri_svm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 26_create_cifs_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Create CIFS server on primary SVM 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.cifs_service 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://pypi.org/project/netapp-ontap/ 15 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 16 | # 17 | ################################################################################ 18 | 19 | import json, os, sys 20 | from netapp_ontap import config, HostConnection, NetAppRestError 21 | from netapp_ontap.resources import CifsService 22 | 23 | 24 | ### Step 1 - Read in global variables 25 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 26 | global_vars = json.load(json_file) 27 | 28 | 29 | ### Step 2 - Configure connection 30 | config.CONNECTION = HostConnection( 31 | global_vars["PRI_CLU"], 32 | username=global_vars["PRI_CLU_USER"], 33 | password=global_vars["PRI_CLU_PASS"], 34 | verify=False 35 | ) 36 | 37 | 38 | ### Step 3 - Create operation 39 | cifs = CifsService.from_dict( 40 | { 41 | "name": global_vars["PRI_SVM"], 42 | "svm": { 43 | "name": global_vars["PRI_SVM"] 44 | }, 45 | "ad_domain": { 46 | "fqdn": global_vars["PRI_AD_DOMAIN"], 47 | "user": global_vars["PRI_AD_USER"], 48 | "password": global_vars["PRI_AD_PASS"] 49 | }, 50 | "comment": "Created with ONTAP PCL" 51 | }) 52 | 53 | print("--> Starting CIFS create operation") 54 | try: 55 | cifs.post() 56 | print("--> CIFS Server \"{}\" created successfully".format(cifs.name)) 57 | except NetAppRestError as err: 58 | print("--> Error: SVM was not created:\n{}".format(err)) 59 | print("") 60 | -------------------------------------------------------------------------------- /ontap9/python/26_create_nfs_pri_svm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 26_create_nfs_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Create NFS server on primary SVM 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.nfs_service 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://pypi.org/project/netapp-ontap/ 15 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 16 | # 17 | ################################################################################ 18 | 19 | import json, os, sys 20 | from netapp_ontap import config, HostConnection, NetAppRestError 21 | from netapp_ontap.resources import NfsService 22 | 23 | 24 | ### Step 1 - Read in global variables 25 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 26 | global_vars = json.load(json_file) 27 | 28 | 29 | ### Step 2 - Configure connection 30 | config.CONNECTION = HostConnection( 31 | global_vars["PRI_CLU"], 32 | username=global_vars["PRI_CLU_USER"], 33 | password=global_vars["PRI_CLU_PASS"], 34 | verify=False 35 | ) 36 | 37 | 38 | ### Step 3 - Create operation 39 | nfs = NfsService.from_dict( 40 | { 41 | "svm": { 42 | "name": global_vars["PRI_SVM"] 43 | }, 44 | "enabled": "true", 45 | "protocol": { 46 | "v3_enabled": "true", 47 | "v40_enabled": "false", 48 | "v41_enabled": "false" 49 | } 50 | }) 51 | 52 | print("--> Starting interface create operation") 53 | try: 54 | nfs.post() 55 | print("--> NFS server created successfully on SVM \"{}\"".format(nfs.svm.name)) 56 | except NetAppRestError as err: 57 | print("--> Error: SVM was not created:\n{}".format(err)) 58 | print("") 59 | -------------------------------------------------------------------------------- /ontap9/python/31_create_cifsvol_pri_svm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 31_create_cifsvol_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Create volume on primary SVM 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.volume 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://pypi.org/project/netapp-ontap/ 15 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 16 | # 17 | ################################################################################ 18 | 19 | import json, os, sys 20 | from netapp_ontap import config, HostConnection, NetAppRestError 21 | from netapp_ontap.resources import Volume 22 | 23 | 24 | ### Step 1 - Read in global variables 25 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 26 | global_vars = json.load(json_file) 27 | 28 | 29 | ### Step 2 - Configure connection 30 | config.CONNECTION = HostConnection( 31 | global_vars["PRI_CLU"], 32 | username=global_vars["PRI_CLU_USER"], 33 | password=global_vars["PRI_CLU_PASS"], 34 | verify=False 35 | ) 36 | 37 | 38 | ### Step 3 - Create operation 39 | # execute create operation 40 | volume = Volume.from_dict( 41 | { 42 | "name": global_vars["PRI_SVM"]+"_cifs_01", 43 | "svm": { 44 | "name": global_vars["PRI_SVM"] 45 | }, 46 | "size": global_vars["VOL_SIZE"], 47 | "aggregates": [ 48 | { 49 | "name": global_vars["PRI_AGGR"] 50 | } 51 | ], 52 | "comment": "Created with ONTAP PCL", 53 | "guarantee": { 54 | "type": "volume" 55 | }, 56 | "nas": { 57 | "export_policy": { 58 | "name": "default" 59 | }, 60 | "path": "/"+global_vars["PRI_SVM"]+"_cifs_01", 61 | "security_style": "ntfs" 62 | } 63 | }) 64 | 65 | print("--> Starting volume create operation") 66 | try: 67 | volume.post() 68 | print("--> Volume \"{}\" created successfully".format(volume.name)) 69 | except NetAppRestError as err: 70 | print("--> Error: SVM was not created:\n{}".format(err)) 71 | print("") 72 | -------------------------------------------------------------------------------- /ontap9/python/32_create_cifsqtree_pri_svm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 32_create_cifsqtree_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Create qtree on primary SVM 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.qtree 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://pypi.org/project/netapp-ontap/ 15 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 16 | # 17 | ################################################################################ 18 | 19 | import json, os, sys 20 | from netapp_ontap import config, HostConnection, NetAppRestError 21 | from netapp_ontap.resources import Qtree 22 | 23 | 24 | ### Step 1 - Read in global variables 25 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 26 | global_vars = json.load(json_file) 27 | 28 | 29 | ### Step 2 - Configure connection 30 | config.CONNECTION = HostConnection( 31 | global_vars["PRI_CLU"], 32 | username=global_vars["PRI_CLU_USER"], 33 | password=global_vars["PRI_CLU_PASS"], 34 | verify=False 35 | ) 36 | 37 | 38 | ### Step 3 - Create operation 39 | # execute create operation 40 | qtree = Qtree.from_dict( 41 | { 42 | "name": "cifs_01", 43 | "svm": { 44 | "name": global_vars["PRI_SVM"] 45 | }, 46 | "volume": { 47 | "name": global_vars["PRI_SVM"]+"_cifs_01" 48 | }, 49 | "security_style": "ntfs" 50 | } 51 | ) 52 | 53 | print("--> Starting qtree create operation") 54 | try: 55 | qtree.post() 56 | print("--> Qtree \"{}\" created successfully".format(qtree.name)) 57 | except NetAppRestError as err: 58 | print("--> Error: SVM was not created:\n{}".format(err)) 59 | print("") 60 | -------------------------------------------------------------------------------- /ontap9/python/33_create_cifsshare_pri_svm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 33_create_cifsshare_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Create CIFS share on primary SVM 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.cifs_share 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://pypi.org/project/netapp-ontap/ 15 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 16 | # 17 | ################################################################################ 18 | 19 | import json, os, sys 20 | from netapp_ontap import config, HostConnection, NetAppRestError 21 | from netapp_ontap.resources import CifsShare 22 | 23 | 24 | ### Step 1 - Read in global variables 25 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 26 | global_vars = json.load(json_file) 27 | 28 | 29 | ### Step 2 - Configure connection 30 | config.CONNECTION = HostConnection( 31 | global_vars["PRI_CLU"], 32 | username=global_vars["PRI_CLU_USER"], 33 | password=global_vars["PRI_CLU_PASS"], 34 | verify=False 35 | ) 36 | 37 | 38 | ### Step 3 - Create operation 39 | # execute create operation 40 | cifsshare = CifsShare.from_dict( 41 | { 42 | "name": "share_01", 43 | "svm": { 44 | "name": global_vars["PRI_SVM"] 45 | }, 46 | "path": "/"+global_vars["PRI_SVM"]+"_cifs_01/cifs_01/" 47 | }) 48 | 49 | print("--> Starting CIFS share create operation") 50 | try: 51 | cifsshare.post() 52 | print("--> CIFS share \"{}\" created successfully".format(cifsshare.name)) 53 | except NetAppRestError as err: 54 | print("--> Error: SVM was not created:\n{}".format(err)) 55 | print("") 56 | -------------------------------------------------------------------------------- /ontap9/python/36_create_nfsvol_pri_svm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 36_create_nfsvol_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Create volume on primary SVM 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.volume 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://pypi.org/project/netapp-ontap/ 15 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 16 | # 17 | ################################################################################ 18 | 19 | import json, os, sys 20 | from netapp_ontap import config, HostConnection, NetAppRestError 21 | from netapp_ontap.resources import Volume 22 | 23 | 24 | ### Step 1 - Read in global variables 25 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 26 | global_vars = json.load(json_file) 27 | 28 | 29 | ### Step 2 - Configure connection 30 | config.CONNECTION = HostConnection( 31 | global_vars["PRI_CLU"], 32 | username=global_vars["PRI_CLU_USER"], 33 | password=global_vars["PRI_CLU_PASS"], 34 | verify=False 35 | ) 36 | 37 | 38 | ### Step 3 - Create operation 39 | # execute create operation 40 | volume = Volume.from_dict( 41 | { 42 | "name": global_vars["PRI_SVM"]+"_nfs_01", 43 | "svm": { 44 | "name": global_vars["PRI_SVM"] 45 | }, 46 | "size": global_vars["VOL_SIZE"], 47 | "aggregates": [ 48 | { 49 | "name": global_vars["PRI_AGGR"] 50 | } 51 | ], 52 | "comment": "Created with ONTAP PCL", 53 | "guarantee": { 54 | "type": "volume" 55 | }, 56 | "nas": { 57 | "export_policy": { 58 | "name": "default" 59 | }, 60 | "path": "/"+global_vars["PRI_SVM"]+"_nfs_01", 61 | "security_style": "unix" 62 | } 63 | }) 64 | 65 | print("--> Starting volume create operation") 66 | try: 67 | volume.post() 68 | print("--> Volume \"{}\" created successfully".format(volume.name)) 69 | except NetAppRestError as err: 70 | print("--> Error: SVM was not created:\n{}".format(err)) 71 | print("") 72 | -------------------------------------------------------------------------------- /ontap9/python/37_create_nfsqtree_pri_svm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 37_create_nfsqtree_pri_svm.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Create qtree on primary SVM 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.qtree 12 | # 13 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 14 | # https://pypi.org/project/netapp-ontap/ 15 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 16 | # 17 | ################################################################################ 18 | 19 | import json, os, sys 20 | from netapp_ontap import config, HostConnection, NetAppRestError 21 | from netapp_ontap.resources import Qtree 22 | 23 | 24 | ### Step 1 - Read in global variables 25 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 26 | global_vars = json.load(json_file) 27 | 28 | 29 | ### Step 2 - Configure connection 30 | config.CONNECTION = HostConnection( 31 | global_vars["PRI_CLU"], 32 | username=global_vars["PRI_CLU_USER"], 33 | password=global_vars["PRI_CLU_PASS"], 34 | verify=False 35 | ) 36 | 37 | 38 | ### Step 3 - Create operation 39 | # execute create operation 40 | qtree = Qtree.from_dict( 41 | { 42 | "name": "nfs_01", 43 | "svm": { 44 | "name": global_vars["PRI_SVM"] 45 | }, 46 | "volume": { 47 | "name": global_vars["PRI_SVM"]+"_nfs_01" 48 | }, 49 | "security_style": "unix" 50 | } 51 | ) 52 | 53 | print("--> Starting qtree create operation") 54 | try: 55 | qtree.post() 56 | print("--> Qtree \"{}\" created successfully".format(qtree.name)) 57 | except NetAppRestError as err: 58 | print("--> Error: SVM was not created:\n{}".format(err)) 59 | print("") 60 | -------------------------------------------------------------------------------- /ontap9/python/90_delete_all.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 90_delete_all.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Clean up the entire environment 9 | # with ONTAP Python client library 10 | # 11 | # Resources: netapp_ontap.resources.volume 12 | # netapp_ontap.resources.cifs_service 13 | # netapp_ontap.resources.svm 14 | # 15 | # URLs: http://docs.netapp.com/ontap-9/index.jsp 16 | # https://pypi.org/project/netapp-ontap/ 17 | # https://library.netapp.com/ecmdocs/ECMLP2858435/html/index.html 18 | # 19 | ################################################################################ 20 | 21 | import json, os, sys, logging 22 | from netapp_ontap import config, HostConnection, NetAppRestError 23 | from netapp_ontap.resources import Volume, CifsService, Svm 24 | 25 | 26 | ### Step 1 - Read in global variables 27 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 28 | global_vars = json.load(json_file) 29 | 30 | 31 | ### Step 2 - Configure connection 32 | config.CONNECTION = HostConnection( 33 | global_vars["PRI_CLU"], 34 | username=global_vars["PRI_CLU_USER"], 35 | password=global_vars["PRI_CLU_PASS"], 36 | verify=False 37 | ) 38 | 39 | 40 | ### Step 3 - Delete operation 41 | # Volume 42 | print("--> Starting volume delete operation") 43 | try: 44 | for volume in Volume.get_collection( 45 | **{"svm.name":global_vars["PRI_SVM"], "name":"!*_root"}): 46 | volume.delete() 47 | print("--> Volume {} deleted successfully".format(volume.name)) 48 | except NetAppRestError as err: 49 | print("--> Error: Volume was not deleted:\n{}".format(err)) 50 | print("") 51 | 52 | # CIFS Server 53 | print("--> Starting CIFS server delete operation") 54 | try: 55 | cifs = CifsService.find(name=global_vars["PRI_SVM"]) 56 | if cifs: 57 | cifs.delete(body={ 58 | "ad_domain": { 59 | "fqdn": global_vars["PRI_AD_DOMAIN"], 60 | "user": global_vars["PRI_AD_USER"], 61 | "password": global_vars["PRI_AD_PASS"] 62 | } 63 | }) 64 | print("--> CIFS server {} deleted successfully".format(cifs.name)) 65 | except NetAppRestError as err: 66 | print("--> Error: CIFS server was not deleted:\n{}".format(err)) 67 | print("") 68 | 69 | # SVM 70 | print("--> Starting SVM delete operation") 71 | try: 72 | svm = Svm.find(**{"name": global_vars["PRI_SVM"]}) 73 | if svm: 74 | svm.delete() 75 | print("--> SVM {} deleted successfully".format(svm.name)) 76 | except NetAppRestError as err: 77 | print("--> Error: SVM was not deleted:\n{}".format(err)) 78 | print("") 79 | -------------------------------------------------------------------------------- /storagegrid/ansible/01_get_grid_details.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 01_get_grid_details.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-06-23 8 | # Description: Get GRID information 9 | # with Ansible and REST APIs 10 | # 11 | # Modules: URI (calling GRID REST APIs) 12 | # 13 | # URLs: https://docs.netapp.com/sgws-113/index.jsp 14 | # https:///grid/apidocs.html 15 | # 16 | ################################################################################ 17 | 18 | - hosts: localhost 19 | gather_facts: false 20 | vars: 21 | input_grid: &input_grid 22 | api_url: "https://{{ SG_ADMIN_NODE }}" 23 | auth_token: "{{ auth_response.json.data }}" 24 | validate_certs: false 25 | vars_files: 26 | - ../global.vars 27 | collections: 28 | - netapp.storagegrid 29 | 30 | tasks: 31 | - name: Get GRID authorization token 32 | uri: 33 | url: "https://{{ SG_ADMIN_NODE }}/api/v3/authorize" 34 | method: POST 35 | validate_certs: false 36 | body_format: json 37 | body: { 38 | "username": "{{ SG_ADMIN_USER }}", 39 | "password": "{{ SG_ADMIN_PASS }}", 40 | "cookie": false, 41 | "csrfToken": false 42 | } 43 | register: auth_response 44 | 45 | - name: Get Info from Grid 46 | netapp.storagegrid.na_sg_grid_info: 47 | gather_subset: 48 | - grid_health_topology_info 49 | - grid_config_product_version_info 50 | <<: *input_grid 51 | register: grid_info_results 52 | 53 | - name: Print GRID details 54 | debug: 55 | msg: 56 | - "Name: {{ grid_info_results.sg_info['grid/health/topology'].data.name }}" 57 | - "Version: {{ grid_info_results.sg_info['grid/config/product-version'].data.productVersion }}" 58 | 59 | - name: Print GRID nodes 60 | debug: 61 | msg: 62 | - "Data Center: {{ item.0.name }}" 63 | - "Node Name: {{ item.1.name }}" 64 | - "Node Type: {{ item.1.type }}" 65 | with_subelements: 66 | - "{{ grid_info_results.sg_info['grid/health/topology'].data.children }}" 67 | - children 68 | loop_control: 69 | label: "{{ item.0.name }} - {{ item.1.name }}" 70 | -------------------------------------------------------------------------------- /storagegrid/ansible/02_get_all_tenant_details.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 02_get_all_tenant_details.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-06-23 8 | # Description: Get tenant information 9 | # with Ansible and REST APIs 10 | # 11 | # Modules: URI (calling GRID REST APIs) 12 | # 13 | # URLs: https://docs.netapp.com/sgws-113/index.jsp 14 | # https:///grid/apidocs.html 15 | # 16 | ################################################################################ 17 | 18 | - hosts: localhost 19 | gather_facts: false 20 | vars: 21 | input_grid: &input_grid 22 | api_url: "https://{{ SG_ADMIN_NODE }}" 23 | auth_token: "{{ grid_auth_response.json.data }}" 24 | validate_certs: false 25 | vars_files: 26 | - ../global.vars 27 | collections: 28 | - netapp.storagegrid 29 | 30 | tasks: 31 | - name: Get GRID authorization token 32 | uri: 33 | url: "https://{{ SG_ADMIN_NODE }}/api/v3/authorize" 34 | method: POST 35 | validate_certs: false 36 | body_format: json 37 | body: { 38 | "username": "{{ SG_ADMIN_USER }}", 39 | "password": "{{ SG_ADMIN_PASS }}", 40 | "cookie": false, 41 | "csrfToken": false 42 | } 43 | register: grid_auth_response 44 | 45 | - name: Get Grid Tenants 46 | netapp.storagegrid.na_sg_grid_info: 47 | gather_subset: grid_accounts_info 48 | <<: *input_grid 49 | register: grid_tenants 50 | 51 | - name: Print GRID tenants 52 | debug: 53 | msg: 54 | - "Tenant: {{ item.name }}" 55 | - "ID: {{ item.id }}" 56 | - "Capabilities: {{ item.capabilities }}" 57 | - "Policy: Platform Services: {{ item.policy.allowPlatformServices }}, \ 58 | Quota: {{ ((item.policy.quotaObjectBytes / 1000 | pow(3)) | int) if item.policy.quotaObjectBytes != none else '--' }} GB, \ 59 | Use Identity Source: {{ item.policy.useAccountIdentitySource }}" 60 | with_items: 61 | - "{{ grid_tenants.sg_info['grid/accounts'].data }}" 62 | loop_control: 63 | label: "{{ item.id }}" 64 | -------------------------------------------------------------------------------- /storagegrid/ansible/21_create_tenant.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ansible-playbook 2 | 3 | ################################################################################ 4 | # 5 | # Title: 21_create_tenant.yml 6 | # Author: Adrian Bronder 7 | # Date: 2020-06-18 8 | # Description: Create a tenant on StorageGRID cluster 9 | # with Ansible modules 10 | # 11 | # Modules: nac_sg_grid_account 12 | # 13 | # URLs: https://docs.netapp.com/sgws-113/index.jsp 14 | # https://galaxy.ansible.com/netapp/storagegrid 15 | # 16 | # Built-in help: 17 | # ansible-doc netapp.storagegrid.nac_sg_grid_account 18 | # 19 | ################################################################################ 20 | 21 | - hosts: localhost 22 | gather_facts: false 23 | vars: 24 | input_grid: &input_grid 25 | api_url: "https://{{ SG_ADMIN_NODE }}" 26 | auth_token: "{{ grid_auth_response.json.data }}" 27 | validate_certs: false 28 | vars_files: 29 | - ../global.vars 30 | collections: 31 | - netapp.storagegrid 32 | 33 | tasks: 34 | - name: Get GRID authorization token 35 | uri: 36 | url: "https://{{ SG_ADMIN_NODE }}/api/v3/authorize" 37 | method: POST 38 | validate_certs: false 39 | body_format: json 40 | body: { 41 | "username": "{{ SG_ADMIN_USER }}", 42 | "password": "{{ SG_ADMIN_PASS }}", 43 | "cookie": false, 44 | "csrfToken": false 45 | } 46 | register: grid_auth_response 47 | 48 | - name: Create GRID tenant 49 | netapp.storagegrid.na_sg_grid_account: 50 | state: present 51 | name: "{{ TENANT }}" 52 | protocol: s3 53 | management: true 54 | use_own_identity_source: true 55 | allow_platform_services: true 56 | password: "{{ TENANT_ROOT_PASS }}" 57 | update_password: on_create 58 | quota_size: "{{ (DEFAULT_QUOTA | int ) * ( 1000 | pow(3) ) | int }}" 59 | quota_size_unit: bytes 60 | <<: *input_grid 61 | no_log: true 62 | -------------------------------------------------------------------------------- /storagegrid/global.vars: -------------------------------------------------------------------------------- 1 | { 2 | "SG_ADMIN_NODE": "dc1-adm1.demo.netapp.com", 3 | "SG_ADMIN_USER": "admin", 4 | "SG_ADMIN_PASS": "Netapp1!", 5 | "SG_GW_NODE1": "dc1-g1.demo.netapp.com:8082", 6 | "SG_GW_NODE2": "dc1-g2.demo.netapp.com:8082", 7 | "TENANT": "gridtenant01", 8 | "TENANT_ROOT_PASS": "TenantNetapp1!", 9 | "DEFAULT_QUOTA": "10", 10 | "BUCKET_NAME": "bucket01", 11 | "TENANT_GROUP_NAME": "group01", 12 | "TENANT_USER_NAME": "user01", 13 | "TENANT_USER_PASS": "UserNetapp1!", 14 | "HA_GROUP_NAME": "HA Group London", 15 | "HA_GROUP_DESCRIPTION": "HA Group for Site London", 16 | "HA_GROUP_VIP": ["192.168.0.30"], 17 | "HA_GROUP_INTERFACES": [ 18 | { 19 | "nodeName": "DC1-ADM1", 20 | "interface": "eth0", 21 | "preferredMaster": true 22 | }, 23 | { 24 | "nodeName": "DC1-G1", 25 | "interface": "eth0", 26 | "preferredMaster": false 27 | } 28 | ], 29 | "ENDPOINT_NAME": "APP Endpoint", 30 | "ENDPOINT_PORT": 10082 31 | } 32 | -------------------------------------------------------------------------------- /storagegrid/new_app.vars: -------------------------------------------------------------------------------- 1 | { 2 | "SG_ADMIN_NODE": "dc1-adm1.demo.netapp.com", 3 | "SG_ADMIN_USER": "admin", 4 | "SG_ADMIN_PASS": "Netapp1!", 5 | "SG_GW_NODE1": "dc1-g1.demo.netapp.com:8082", 6 | "SG_GW_NODE2": "dc1-g2.demo.netapp.com:8082", 7 | "S3_KEY_DIRECTORY": "../cred_store", 8 | "TENANT": "AZ App01", 9 | "TENANT_ROOT_PASS": "netapp01", 10 | "DEFAULT_QUOTA": "20", 11 | "BUCKET_NAME": "az-app-bucket01", 12 | "TENANT_GROUP_NAME": "az-app-grp01", 13 | "TENANT_USER_NAME": "az-app-user01", 14 | "TENANT_USER_PASS": "UserNetapp01", 15 | "HA_GROUP_NAME": "HA Group London", 16 | "HA_GROUP_DESCRIPTION": "HA Group for Site London", 17 | "HA_GROUP_VIP": ["192.168.0.30"], 18 | "HA_GROUP_INTERFACES": [ 19 | { 20 | "nodeName": "DC1-ADM1", 21 | "interface": "eth0", 22 | "preferredMaster": true 23 | }, 24 | { 25 | "nodeName": "DC1-G1", 26 | "interface": "eth0", 27 | "preferredMaster": false 28 | } 29 | ], 30 | "ENDPOINT_NAME": "APP Endpoint", 31 | "ENDPOINT_PORT": 10082 32 | } 33 | -------------------------------------------------------------------------------- /storagegrid/python/01_get_grid_details.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | ################################################################################ 4 | # 5 | # Title: 01_get_grid_details.py 6 | # Author: Adrian Bronder 7 | # Date: 2020-03-17 8 | # Description: Get grid information 9 | # 10 | # Resources: 11 | # 12 | # URLs: 13 | # 14 | ################################################################################ 15 | 16 | import json, os, sys 17 | import requests 18 | 19 | ### Define Functions 20 | def _url(path): 21 | return 'https://' + global_vars["SG_ADMIN_NODE"] + '/api/v3' + path 22 | 23 | def get_info(endpoint, auth_token): 24 | return requests.get(endpoint, 25 | headers={'accept': 'application/json', 'authorization': 'Bearer {}'.format(auth_token)}, 26 | verify=False).json()['data'] 27 | 28 | ### Step 1 - Read in global variables 29 | with open(os.path.dirname(sys.argv[0])+'/../global.vars') as json_file: 30 | global_vars = json.load(json_file) 31 | 32 | 33 | ### Step 2 - Set Authorization Header 34 | auth_body = { 35 | "username": global_vars['SG_ADMIN_USER'], 36 | "password": global_vars['SG_ADMIN_PASS'], 37 | "cookie": "false", 38 | "csrfToken": "false" 39 | } 40 | 41 | ### Step 3 - Get Grid Authorization Token 42 | grid_auth = requests.post('https://' + global_vars["SG_ADMIN_NODE"] + '/api/v3/authorize', 43 | data=json.dumps(auth_body), 44 | headers={'Content-Type':'application/json', 'accept':'application/json'}, 45 | verify=False).json()['data'] 46 | 47 | ### Step 4 - Get Grid Info - Version & Topology 48 | version_resp = get_info(_url('/grid/config/product-version'), grid_auth) 49 | topology_resp = get_info(_url('/grid/health/topology'), grid_auth) 50 | 51 | ### Step 5 - Print Info 52 | print('\n{0:13}{1}'.format('Name:', topology_resp['name'])) 53 | print('{0:13}{1}\n'.format('Version:', version_resp['productVersion'])) 54 | 55 | for site in topology_resp['children']: 56 | print('Data Center: {}'.format(site['name'])) 57 | for node in site['children']: 58 | print(' - Node Name: {0:20} Type: {1}'.format(node['name'], node['type'])) 59 | print('\n') 60 | 61 | 62 | --------------------------------------------------------------------------------