├── multi-part ├── 05_create_volume.yml ├── 06_mount_nfs_datastore.yml ├── 02_create_aggregate.yml ├── netapp_full_install_multi-part.yml ├── variables.yml ├── 01_install_licenses_setup_ntp.yml ├── 04_network_setup.yml └── 03_create_svm.yml ├── README.md └── combined └── 00_netapp_full_install.yml /multi-part/05_create_volume.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | name: Create Additional NFS Volume 4 | gather_facts: false 5 | vars: 6 | login: &login 7 | hostname: "{{ clusterip }}" 8 | username: "{{ user }}" 9 | password: "{{ pass }}" 10 | https: "{{ https_option }}" 11 | validate_certs: "{{ validate_certs_option }}" 12 | vars_files: 13 | - variables.yml 14 | tasks: 15 | - name: Volume Create 16 | na_ontap_volume: 17 | state: present 18 | name: "{{ nfsvolname2 }}" 19 | vserver: "{{ vservername }}" 20 | aggregate_name: "{{ aggr }}" 21 | size: "{{ nfsvolsize2 }}" 22 | size_unit: gb 23 | policy: default 24 | junction_path: "/{{ nfsvolname2 }}" 25 | percent_snapshot_space: 0 26 | space_guarantee: none 27 | <<: *login 28 | - debug: msg="Volume {{ nfsvolname2 }} has been setup." 29 | -------------------------------------------------------------------------------- /multi-part/06_mount_nfs_datastore.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | name: Mount NetApp NFS Datastores 4 | gather_facts: false 5 | vars: 6 | login: &login 7 | hostname: "{{ vcenter_server }}" 8 | username: "{{ vcenter_user }}" 9 | password: "{{ vcenter_pass }}" 10 | validate_certs: no 11 | vars_files: 12 | - variables.yml 13 | tasks: 14 | - name: Mount NFS Datastores to ESXi Host 15 | vmware_host_datastore: 16 | state: present 17 | datastore_name: "{{ item.name }}" 18 | datastore_type: "{{ item.type }}" 19 | nfs_server: "{{ item.server }}" 20 | nfs_path: "{{ item.path }}" 21 | nfs_ro: no 22 | esxi_hostname: "{{ esxihost }}" 23 | <<: *login 24 | loop: 25 | - { 'name': '{{ nfsvolname1 }}', 'server': '{{ lifaddress }}', 'path': '/{{ nfsvolname1 }}', 'type': '{{ voltype }}'} 26 | - { 'name': '{{ nfsvolname2 }}', 'server': '{{ lifaddress }}', 'path': '/{{ nfsvolname2 }}', 'type': '{{ voltype }}'} 27 | - debug: msg="{{ nfsvolname1 }} & {{ nfsvolname2 }} datastores have been added to ESXi host {{ esxihost }}." 28 | -------------------------------------------------------------------------------- /multi-part/02_create_aggregate.yml: -------------------------------------------------------------------------------- 1 | ######################################################################################################################################### 2 | # -= Requirements =- 3 | # 4 | # 1. Make sure ansible user has been created 5 | # 1a. security login create -vserver CLUSTER96 -role admin -application http -authentication-method password -user-or-group-name ansible 6 | # 1b. security login create -vserver CLUSTER96 -role admin -application ontapi -authentication-method password -user-or-group-name ansible 7 | ########################################################################################################################################## 8 | --- 9 | - hosts: localhost 10 | gather_facts: false 11 | name: NetApp Aggregate Setup 12 | vars: 13 | login: &login 14 | hostname: "{{ clusterip }}" 15 | username: "{{ user }}" 16 | password: "{{ pass }}" 17 | https: "{{ https_option }}" 18 | validate_certs: "{{ validate_certs_option }}" 19 | vars_files: 20 | - variables.yml 21 | tasks: 22 | - name: Rename Root Aggregate 23 | na_ontap_aggregate: 24 | state: present 25 | service_state: online 26 | from_name: "{{ aggrrootoldname }}" 27 | name: "{{ aggrrootnewname }}" 28 | <<: *login 29 | - name: Create and Online Aggregate 30 | na_ontap_aggregate: 31 | state: present 32 | service_state: online 33 | name: "{{ aggrdataname }}" 34 | disk_count: "{{ diskcount }}" 35 | wait_for_online: true 36 | time_out: 300 37 | <<: *login 38 | - debug: msg="Aggregate {{ aggrrootoldname }} has been renamed to {{ aggrrootnewname }} and new data aggregate {{ aggrdataname }} has been created" 39 | -------------------------------------------------------------------------------- /multi-part/netapp_full_install_multi-part.yml: -------------------------------------------------------------------------------- 1 | ########################################################## 2 | # This Ansible Playbook calls multiple sub yml playbooks # 3 | ########################################################## 4 | 5 | ######################################################################################################################################### 6 | # -= Requirements =- 7 | # 8 | # 1. Make sure ansible user has been created 9 | # 1a. security login create -vserver CLUSTER96 -role admin -application http -authentication-method password -user-or-group-name ansible 10 | # 1b. security login create -vserver CLUSTER96 -role admin -application ontapi -authentication-method password -user-or-group-name ansible 11 | ########################################################################################################################################## 12 | 13 | --- 14 | # Install Licenses and Setup NTP 15 | - import_playbook: 01_install_licenses_setup_ntp.yml 16 | 17 | # Rename Root Aggregate, Create and online new data aggregate 18 | - import_playbook: 02_create_aggregate.yml 19 | 20 | # Crete SVM, start NFS, create NFS export rule, add DNS settings to SVM, create NFS volume 21 | - import_playbook: 03_create_svm.yml 22 | 23 | # Create NFS vlan, create broadcast-domain, create subnet, create NFS lif 24 | - import_playbook: 04_network_setup.yml 25 | 26 | # Create an additional NFS volume 27 | - import_playbook: 05_create_volume.yml 28 | 29 | # Mount NFS datastore to ESXi hosts 30 | - import_playbook: 06_mount_nfs_datastore.yml esxihost=vmhost3.vmlab.local 31 | - import_playbook: 06_mount_nfs_datastore.yml esxihost=vmhost4.vmlab.local 32 | - import_playbook: 06_mount_nfs_datastore.yml esxihost=vmhost5.vmlab.local 33 | - import_playbook: 06_mount_nfs_datastore.yml esxihost=vmhost6.vmlab.local 34 | -------------------------------------------------------------------------------- /multi-part/variables.yml: -------------------------------------------------------------------------------- 1 | ########################################################## 2 | # Variable File for 'netapp_full_install_multi-part.yml' # 3 | ########################################################## 4 | 5 | # Cluster Login 6 | clusterip: 192.168.1.50 7 | user: ansible 8 | pass: Password123 9 | https_option: true 10 | validate_certs_option: false 11 | 12 | # Variables for '01_install_licenses_setup_ntp.yml' 13 | clustername: CLUSTER96 14 | ntpservers: 192.168.1.101 15 | timezone: Australia/Sydney 16 | 17 | # Variables for '02_create_aggregate.yml' 18 | aggrrootoldname: aggr0_CLUSTER96_01 19 | aggrrootnewname: aggr0_CLUSTER96_01_root 20 | aggrdataname: aggr1_CLUSTER96_01_data 21 | diskcount: 26 22 | 23 | # Variables for '03_create_svm.yml' 24 | svmname: SVM1 25 | rootvolname: SVM1_root 26 | rootvolaggr: aggr1_CLUSTER96_01_data 27 | rootvolsecurity: unix 28 | allowedaggrs: aggr1_CLUSTER96_01_data 29 | allowedprotocols: nfs 30 | nfsclientmatchsubnet: 192.168.2.0/24 31 | svmdnsdomain: vmlab.local 32 | svmdnsservers: 192.168.1.101 33 | nfsvolname1: NFS_vol1 34 | nfsaggr: aggr1_CLUSTER96_01_data 35 | nfsvolsize: 100 # Size is in GB 36 | 37 | # Variables for '04_network_setup.yml' 38 | clustername: CLUSTER96 39 | vlan: 5 # NFS VLAN 40 | parentinterface: e0d # Interface where VLAN will be created 41 | broadcastname: NFS 42 | broadcastports: ["CLUSTER96-01:e0d-5"] # Add ports here, multiple ports use comma's 43 | subnetname: NFS-Subnet 44 | subnetnetwork: 192.168.2.0/24 45 | subnetiprange: ["192.168.2.51-192.168.2.52"] 46 | lifinterfacename: nfs_lif01 47 | lifhomeport: e0d-5 48 | lifhomenode: CLUSTER96-01 49 | lifaddress: 192.168.2.51 50 | lifnetmask: 255.255.255.0 51 | vservername: SVM1 52 | 53 | # Variables for '05_create_volume.yml' 54 | aggr: aggr1_CLUSTER96_01_data 55 | nfsvolname2: NFS_vol2 56 | vservername: SVM1 57 | nfsvolsize2: 10 # Size is in GB 58 | 59 | # Variables: for '06_mount_nfs_datastore.yml' 60 | vcenter_server: 192.168.1.104 61 | vcenter_user: ansible@vsphere.local 62 | vcenter_pass: Password123 63 | voltype: nfs 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NetApp Ansible Playbooks 2 | 3 | #### Date: 3-8-2019 4 | #### Version: 1 5 | #### Blog: www.sysadmintutorials.com 6 | #### Twitter: @systutorials 7 | 8 | ## Description 9 | 10 | Contained within this repository are NetApp Ansible playbooks 11 | 12 | ## File Listing & Description 13 | 1. combined/00_netapp_full_install.yml
14 | 15 | This playbook is part of my blog post:
16 | www.sysadmintutorials.com/how-to-automate-netapp-installations-with-ansible
17 | 18 | It will setup a NetApp cluster ready for VMware vSphere NFS datastores. It performs the following: 19 | ```sh 20 | - Set NTP 21 | - Set Timezone 22 | - Rename the Root Aggregate 23 | - Create and online a new Data Aggregate 24 | - Create a Vserver 25 | - Setup a VLAN 26 | - Creating a Broadcast Domain 27 | - Subnet Creation 28 | - Creating an NFS Lif 29 | - Start NFS 30 | - Create NFS Export Rule 31 | - Add DNS Settings to Vserver 32 | - Create first NFS Volume 33 | - Create an additional NFS Volume 34 | ``` 35 | 36 | Be sure to change the variables within the yml file to match your environment 37 | 38 | To run this ansible playbook simply execute: ansible-playbook 00_netapp_full_install.yml 39 | 40 | 2. multi-part/netapp_full_install_multi-part.yml
41 | multi-part/variables.yml
42 | multi-part/01_install_licenses_setup_ntp.yml
43 | multi-part/02_create_aggregate.yml
44 | multi-part/03_create_svm.yml
45 | multi-part/04_network_setup.yml
46 | multi-part/05_create_volume.yml
47 | multi-part/06_mount_nfs_datastore.yml
48 | 49 | This plabook is part of my second Ansible/NetApp/VMware blog post:
50 | https://www.sysadmintutorials.com/creating-multi-part-ansible-playbook-with-variables-netapp-vmware/
51 | 52 | These runbooks are an improvement on the one gigantic runbook created in step 1. above. 53 | Please head on over to the blog post to read what has changed. 54 | 55 | To run this ansible playbook simply execute: ansible-playbook netapp_full_install_multi-part.yml 56 | -------------------------------------------------------------------------------- /multi-part/01_install_licenses_setup_ntp.yml: -------------------------------------------------------------------------------- 1 | ######################################################################################################################################### 2 | # -= Requirements =- 3 | # 4 | # 1. Make sure ansible user has been created 5 | # 1a. security login create -vserver CLUSTER96 -role admin -application http -authentication-method password -user-or-group-name ansible 6 | # 1b. security login create -vserver CLUSTER96 -role admin -application ontapi -authentication-method password -user-or-group-name ansible 7 | ########################################################################################################################################## 8 | 9 | --- 10 | - hosts: localhost 11 | gather_facts: false 12 | name: NetApp licensing 13 | vars: 14 | login: &login 15 | hostname: "{{ clusterip }}" 16 | username: "{{ user }}" 17 | password: "{{ pass }}" 18 | https: "{{ https_option }}" 19 | validate_certs: "{{ validate_certs_option }}" 20 | vars_files: 21 | - variables.yml 22 | tasks: 23 | - name: Install Licenses 24 | na_ontap_cluster: 25 | state: present 26 | cluster_name: "{{ clustername }}" 27 | license_code: "{{ item }}" 28 | <<: *login 29 | loop: 30 | - CAYHXPKBFDUFZGABGAAAAAAAAAAA 31 | - APTLYPKBFDUFZGABGAAAAAAAAAAA 32 | - WSKTAQKBFDUFZGABGAAAAAAAAAAA 33 | - CGVTEQKBFDUFZGABGAAAAAAAAAAA 34 | - OUVWXPKBFDUFZGABGAAAAAAAAAAA 35 | - QFATWPKBFDUFZGABGAAAAAAAAAAA 36 | - UHGXBQKBFDUFZGABGAAAAAAAAAAA 37 | - GCEMCQKBFDUFZGABGAAAAAAAAAAA 38 | - KYMEAQKBFDUFZGABGAAAAAAAAAAA 39 | - SWBBDQKBFDUFZGABGAAAAAAAAAAA 40 | - YDPPZPKBFDUFZGABGAAAAAAAAAAA 41 | - INIIBQKBFDUFZGABGAAAAAAAAAAA 42 | - name: Set NTP 43 | na_ontap_ntp: 44 | state: present 45 | version: auto 46 | server_name: "{{ ntpservers }}" 47 | <<: *login 48 | - name: Set Timezone 49 | na_ontap_command: 50 | command: ['cluster', 'date', 'modify', '-timezone', '"{{ timezone }}"'] 51 | privilege: admin 52 | <<: *login 53 | - debug: msg="Licenses have been installed on {{ clustername }}" 54 | -------------------------------------------------------------------------------- /multi-part/04_network_setup.yml: -------------------------------------------------------------------------------- 1 | ######################################################################################################################################### 2 | # -= Requirements =- 3 | # 4 | # 1. Make sure ansible user has been created 5 | # 1a. security login create -vserver CLUSTER96 -role admin -application http -authentication-method password -user-or-group-name ansible 6 | # 1b. security login create -vserver CLUSTER96 -role admin -application ontapi -authentication-method password -user-or-group-name ansible 7 | ########################################################################################################################################## 8 | --- 9 | - hosts: localhost 10 | gather_facts: false 11 | name: NetApp Network Setup 12 | vars: 13 | login: &login 14 | hostname: "{{ clusterip }}" 15 | username: "{{ user }}" 16 | password: "{{ pass }}" 17 | https: "{{ https_option }}" 18 | validate_certs: "{{ validate_certs_option }}" 19 | vars_files: 20 | - variables.yml 21 | tasks: 22 | - name: Setup VLAN 23 | na_ontap_net_vlan: 24 | state: present 25 | vlanid: "{{ vlan }}" 26 | node: "{{ item }}" 27 | parent_interface: "{{ parentinterface }}" 28 | <<: *login 29 | loop: # Add nodes below 30 | - CLUSTER96-01 31 | - name: Create Broadcast Domain 32 | na_ontap_broadcast_domain: 33 | state: present 34 | name: "{{ broadcastname }}" 35 | mtu: 1500 36 | ipspace: Default 37 | ports: "{{ broadcastports }}" 38 | <<: *login 39 | - name: Create Subnet 40 | na_ontap_net_subnet: 41 | state: present 42 | name: "{{ subnetname }}" 43 | subnet: "{{ subnetnetwork }}" 44 | ip_ranges: "{{ subnetiprange }}" 45 | ipspace: Default 46 | broadcast_domain: "{{ broadcastname }}" 47 | <<: *login 48 | - name: Create NFS LIF 49 | na_ontap_command: 50 | command: ['network', 'interface', 'create', '-vserver', '"{{ vservername }}"', '-home-node', '"{{ lifhomenode }}"', '-home-port', '"{{ lifhomeport }}"', '-data-protocol', 'nfs', '-subnet-name', '"{{ subnetname }}"', '-failover-policy', 'system-defined', '-firewall-policy', 'data', '-lif', '"{{ lifinterfacename }}"'] 51 | privilege: admin 52 | <<: *login 53 | - debug: msg="VLAN {{ vlan }}, broadcast domain {{ broadcastname }}, subnet {{ subnetname}} and NFS lif {{ lifinterfacename }} have been setup." 54 | -------------------------------------------------------------------------------- /multi-part/03_create_svm.yml: -------------------------------------------------------------------------------- 1 | ######################################################################################################################################### 2 | # -= Requirements =- 3 | # 4 | # 1. Make sure ansible user has been created 5 | # 1a. security login create -vserver CLUSTER96 -role admin -application http -authentication-method password -user-or-group-name ansible 6 | # 1b. security login create -vserver CLUSTER96 -role admin -application ontapi -authentication-method password -user-or-group-name ansible 7 | ########################################################################################################################################## 8 | --- 9 | - hosts: localhost 10 | gather_facts: false 11 | name: NetApp SVM Setup 12 | vars_files: 13 | - variables.yml 14 | vars: 15 | login: &login 16 | hostname: "{{ clusterip }}" 17 | username: "{{ user }}" 18 | password: "{{ pass }}" 19 | https: "{{ https_option }}" 20 | validate_certs: "{{ validate_certs_option }}" 21 | vars_files: 22 | - variables.yml 23 | tasks: 24 | - name: Create SVM 25 | na_ontap_svm: 26 | state: present 27 | name: "{{ svmname }}" 28 | root_volume: "{{ rootvolname }}" 29 | root_volume_aggregate: "{{ rootvolaggr }}" 30 | root_volume_security_style: "{{ rootvolsecurity }}" 31 | aggr_list: "{{ allowedaggrs }}" 32 | allowed_protocols: "{{ allowedprotocols }}" 33 | <<: *login 34 | - name: Start NFS 35 | na_ontap_nfs: 36 | state: present 37 | service_state: started 38 | vserver: "{{ svmname }}" 39 | nfsv3: enabled 40 | <<: *login 41 | - name: Create NFS Export Rule Under Default Policy 42 | na_ontap_export_policy_rule: 43 | state: present 44 | name: default 45 | vserver: "{{ svmname }}" 46 | client_match: "{{ nfsclientmatchsubnet }}" 47 | ro_rule: sys 48 | rw_rule: sys 49 | protocol: nfs 50 | super_user_security: any 51 | <<: *login 52 | - name: Add DNS Settings to SVM 53 | na_ontap_dns: 54 | state: present 55 | vserver: "{{ svmname }}" 56 | domains: "{{ svmdnsdomain }}" 57 | nameservers: "{{ svmdnsservers }}" 58 | skip_validation: true 59 | <<: *login 60 | - name: Create First NFS Volumes 61 | na_ontap_volume: 62 | state: present 63 | name: "{{ nfsvolname1 }}" 64 | aggregate_name: "{{ nfsaggr }}" 65 | size: "{{ nfsvolsize }}" 66 | size_unit: gb 67 | space_guarantee: none 68 | policy: default 69 | percent_snapshot_space: 0 70 | vserver: "{{ svmname }}" 71 | volume_security_style: unix 72 | wait_for_completion: true 73 | junction_path: "{{ '/' + nfsvolname1 }}" 74 | <<: *login 75 | - debug: msg="{{ svmname }} has been created along with 1 NFS volume called {{ nfsvolname1 }}" 76 | -------------------------------------------------------------------------------- /combined/00_netapp_full_install.yml: -------------------------------------------------------------------------------- 1 | ######################################################################################################################################### 2 | # -= Requirements =- 3 | # 4 | # 1. Make sure ansible user has been created 5 | # 1a. security login create -vserver CLUSTER96 -role admin -application http -authentication-method password -user-or-group-name ansible 6 | # 1b. security login create -vserver CLUSTER96 -role admin -application ontapi -authentication-method password -user-or-group-name ansible 7 | # 1c. security login create -vserver CLUSTER96 -role admin -application console -authentication-method password -user-or-group-name ansible 8 | ########################################################################################################################################## 9 | 10 | --- 11 | - hosts: localhost 12 | gather_facts: false 13 | name: NetApp NFS System Setup 14 | vars: 15 | login: &login 16 | hostname: 192.168.1.50 # NetApp Cluster IP 17 | username: ansible # Cluster User 18 | password: Password123 # Cluster Password 19 | https: true 20 | validate_certs: false 21 | clustername: CLUSTER96 # Cluster Name 22 | ntpservers: 192.168.1.101 # Time Server 23 | aggrrootoldname: aggr0_CLUSTER96_01 # Aggregate root name after Cluster Setup 24 | aggrrootnewname: aggr0_CLUSTER96_01_root # New Aggregate root name 25 | aggrdataname: aggr1_CLUSTER96_01_data # New Data Aggregate name 26 | diskcount: 26 # Number of disks to add to the Data Aggregate 27 | svmname: SVM1 # SVM or Vserver name 28 | rootvolname: SVM1_root # SVM root vol name 29 | rootvolaggr: aggr1_CLUSTER96_01_data # Which aggregate to place the SVM root vol 30 | rootvolsecurity: unix # SVM Root vol security stype 31 | allowedaggrs: aggr1_CLUSTER96_01_data # Allowed SVM data Aggregates 32 | allowedprotocols: nfs # Allowed SVM Protocols 33 | nfsclientmatchsubnet: 192.168.2.0/24 # Allow this subnet to access NFS 34 | svmdnsdomain: vmlab.local # SVM DNS Domain 35 | svmdnsservers: 192.168.1.101 # SVM DNS Servers 36 | nfsvolname: NFS_vol1 # First NFS Vol withint your SVM 37 | nfsaggr: aggr1_CLUSTER96_01_data # Which Aggregate to place the NFS Vol on 38 | nfsvolsize: 100 # NFS Vol Size GB 39 | vlan: 5 # NFS VLAN 40 | parentinterface: e0d # Interface where VLAN will be created 41 | broadcastname: NFS # Create a new Broadcast Domain with this name 42 | broadcastports: ["CLUSTER96-01:e0d-5"] # Add ports here, multiple ports use comma's 43 | subnetname: NFS-Subnet # NFS Subnet Name 44 | subnetnetwork: 192.168.2.0/24 # NFS Network Subnet 45 | subnetiprange: ["192.168.2.51-192.168.2.52"] # NFS LIF IP within the NFS subnet pool 46 | lifinterfacename: nfs_lif01 # SVM NFS Lif name 47 | lifhomeport: e0d-5 # Home port for SVM NFS Lif 48 | lifhomenode: CLUSTER96-01 # Home node for SVM NFS Lif 49 | lifaddress: 192.168.2.51 # SVM NFS Lif IP Address 50 | lifnetmask: 255.255.255.0 # SVM NFS Lif Subnet 51 | vservername: SVM1 # SVM or Vserver Name 52 | aggr: aggr1_CLUSTER96_01_data # Which Aggregate to create second NFS vol 53 | vol_name: ansibleVol # Second NFS vol name 54 | tasks: 55 | - name: Install NetApp simulator Licenses 56 | na_ontap_cluster: 57 | state: present 58 | cluster_name: "{{ clustername }}" 59 | license_code: "{{ item }}" 60 | <<: *login 61 | loop: 62 | - CAYHXPKBFDUFZGABGAAAAAAAAAAA 63 | - APTLYPKBFDUFZGABGAAAAAAAAAAA 64 | - WSKTAQKBFDUFZGABGAAAAAAAAAAA 65 | - CGVTEQKBFDUFZGABGAAAAAAAAAAA 66 | - OUVWXPKBFDUFZGABGAAAAAAAAAAA 67 | - QFATWPKBFDUFZGABGAAAAAAAAAAA 68 | - UHGXBQKBFDUFZGABGAAAAAAAAAAA 69 | - GCEMCQKBFDUFZGABGAAAAAAAAAAA 70 | - KYMEAQKBFDUFZGABGAAAAAAAAAAA 71 | - SWBBDQKBFDUFZGABGAAAAAAAAAAA 72 | - YDPPZPKBFDUFZGABGAAAAAAAAAAA 73 | - INIIBQKBFDUFZGABGAAAAAAAAAAA 74 | - name: Set NTP 75 | na_ontap_ntp: 76 | state: present 77 | version: auto 78 | server_name: "{{ ntpservers }}" 79 | <<: *login 80 | - name: Set Timezone 81 | na_ontap_command: 82 | command: ['cluster', 'date', 'modify', '-timezone', 'Australia/Sydney'] 83 | privilege: admin 84 | <<: *login 85 | - name: Rename Root Aggregate 86 | na_ontap_aggregate: 87 | state: present 88 | service_state: online 89 | from_name: "{{ aggrrootoldname }}" 90 | name: "{{ aggrrootnewname }}" 91 | <<: *login 92 | - name: Create and Online New Data Aggregate 93 | na_ontap_aggregate: 94 | state: present 95 | service_state: online 96 | name: "{{ aggrdataname }}" 97 | disk_count: "{{ diskcount }}" 98 | wait_for_online: true 99 | time_out: 300 100 | <<: *login 101 | - name: Create Vserver 102 | na_ontap_svm: 103 | state: present 104 | name: "{{ vservername }}" 105 | root_volume: "{{ rootvolname }}" 106 | root_volume_aggregate: "{{ rootvolaggr }}" 107 | root_volume_security_style: "{{ rootvolsecurity }}" 108 | aggr_list: "{{ allowedaggrs }}" 109 | allowed_protocols: "{{ allowedprotocols }}" 110 | <<: *login 111 | - name: Setup VLAN 112 | na_ontap_net_vlan: 113 | state: present 114 | vlanid: "{{ vlan }}" 115 | node: "{{ item }}" 116 | parent_interface: "{{ parentinterface }}" 117 | <<: *login 118 | loop: # Add nodes below 119 | - CLUSTER96-01 120 | - name: Create Broadcast Domain 121 | na_ontap_broadcast_domain: 122 | state: present 123 | name: "{{ broadcastname }}" 124 | mtu: 1500 125 | ipspace: Default 126 | ports: "{{ broadcastports }}" 127 | <<: *login 128 | - name: Create Subnet 129 | na_ontap_net_subnet: 130 | state: present 131 | name: "{{ subnetname }}" 132 | subnet: "{{ subnetnetwork }}" 133 | ip_ranges: "{{ subnetiprange }}" 134 | ipspace: Default 135 | broadcast_domain: "{{ broadcastname }}" 136 | <<: *login 137 | - name: Create NFS LIF 138 | na_ontap_command: 139 | command: ['network', 'interface', 'create', '-vserver', '"{{ vservername }}"', '-home-node', '"{{ lifhomenode }}"', '-home-port', '"{{ lifhomeport }}"', '-data-protocol', 'nfs', '-subnet-name', '"{{ subnetname }}"', '-failover-policy', 'system-defined', '-firewall-policy', 'data', '-lif', '"{{ lifinterfacename }}"'] 140 | privilege: admin 141 | <<: *login 142 | - name: Start NFS 143 | na_ontap_nfs: 144 | state: present 145 | service_state: started 146 | vserver: "{{ vservername }}" 147 | nfsv3: enabled 148 | <<: *login 149 | - name: Create NFS Export Rule Under Default Policy 150 | na_ontap_export_policy_rule: 151 | state: present 152 | name: default 153 | vserver: "{{ vservername }}" 154 | client_match: "{{ nfsclientmatchsubnet }}" 155 | ro_rule: sys 156 | rw_rule: sys 157 | protocol: nfs 158 | super_user_security: any 159 | <<: *login 160 | - name: Add DNS Settings to SVM 161 | na_ontap_dns: 162 | state: present 163 | vserver: "{{ vservername }}" 164 | domains: "{{ svmdnsdomain }}" 165 | nameservers: "{{ svmdnsservers }}" 166 | skip_validation: true 167 | <<: *login 168 | - name: Create First NFS Volumes 169 | na_ontap_volume: 170 | state: present 171 | name: "{{ nfsvolname }}" 172 | aggregate_name: "{{ nfsaggr }}" 173 | size: "{{ nfsvolsize }}" 174 | size_unit: gb 175 | space_guarantee: none 176 | policy: default 177 | percent_snapshot_space: 0 178 | vserver: "{{ vservername }}" 179 | volume_security_style: unix 180 | wait_for_completion: true 181 | junction_path: "{{ '/' + nfsvolname }}" 182 | <<: *login 183 | - name: Create Additional Volume within Vserver 184 | na_ontap_volume: 185 | state: present 186 | name: "{{ vol_name }}" 187 | vserver: "{{ vservername }}" 188 | aggregate_name: "{{ aggr }}" 189 | size: 10 190 | size_unit: gb 191 | policy: default 192 | junction_path: "/{{ vol_name }}" 193 | percent_snapshot_space: 0 194 | space_guarantee: none 195 | volume_security_style: unix 196 | wait_for_completion: true 197 | <<: *login 198 | --------------------------------------------------------------------------------