-
Notifications
You must be signed in to change notification settings - Fork 0
/
03_talus_neues_volume_und_Share_einrichten.yml
160 lines (147 loc) · 6.94 KB
/
03_talus_neues_volume_und_Share_einrichten.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/usr/bin/env ansible-playbook
###############################################################################
# Applikation: Storage-Admin
# ScriptName: 03_talus_neues_volume_und_Share_einrichten.yml
# Version: 1.0
# Typ: ansible YAML playbook
# Beschreibung: Playbook um neue Gruppen volumen zu erstellen und qouotas zu setzten.
#
# Author: Horst Pauli Professional Services Consultant
#
# Target Systems: LINUX Server/VM used as Ansible Host at Customer Site
#
# (C) Copyright NetApp Switzerland 2020
###############################################################################
# Modifications: 22/03/2021 Initial Version # H. Pauli ###
###############################################################################
- hosts: localhost
gather_facts: false
vars:
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
vserver: "{{ vservername }}"
https: true
validate_certs: false
use_rest: Always
vars_files:
- global.vars
collections:
- netapp.ontap
tasks:
- name: Automaticaly choose the right Aggregate
set_fact:
aggrname: "{% if hostname=='tacluster01' %}aggr_tacluster01_01_data1{% elif hostname=='tbcluster01'%}aggr_tbcluster01_01_data1{% else %}aggr_ontapsim_02_data{% endif %}"
- name: Create a CIFS volume with name "gruppe{{ gruppennummer }}" on vserver "{{ vserver }}"
na_ontap_volume:
state: present
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
name: "gruppe{{ gruppennummer }}"
aggregate_name: "{{ aggrname }}"
size: "{{ volsize }}"
size_unit: gb
volume_security_style: ntfs
space_guarantee: none
snapshot_policy: cifs_daily30
tiering_policy: auto
export_policy: default
percent_snapshot_space: 0
encrypt: false
vserver: "{{ vserver }}"
junction_path: "/gruppe{{ gruppennummer }}"
wait_for_completion: True
nvfail_enabled: False
comment: ansible created volume
- name: Create a CIFS volume with name "gruppe{{ gruppennummer }}_homes" on vserver "{{ vserver }}"
na_ontap_volume:
state: present
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
name: "gruppe{{ gruppennummer }}_homes"
aggregate_name: "{{ aggrname }}"
size: "{{ volsize }}"
size_unit: gb
volume_security_style: ntfs
space_guarantee: none
snapshot_policy: cifs_daily30
tiering_policy: auto
export_policy: default
percent_snapshot_space: 0
encrypt: true
vserver: "{{ vservername }}"
junction_path: "/gruppe{{ gruppennummer }}_homes"
wait_for_completion: True
nvfail_enabled: False
comment: ansible created volume
- name: Create a CIFS Share on vserver "{{ vserver }}" and sharename "gruppe{{ gruppennummer }}$"
na_ontap_cifs:
state: present
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
share_name: "gruppe{{ gruppennummer }}$"
path: "/gruppe{{ gruppennummer }}"
vserver: "{{ vservername }}"
share_properties: browsable,changenotify,oplocks,show-previous-versions,showsnapshot
symlink_properties: enable
- name: Create a CIFS Share on vserver "{{ vserver }}" and sharename "gruppe{{ gruppennummer }}_homes$"
na_ontap_cifs:
state: present
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
share_name: "gruppe{{ gruppennummer }}_homes$"
path: "/gruppe{{ gruppennummer }}_homes"
vserver: "{{ vservername }}"
share_properties: browsable,changenotify,oplocks,show-previous-versions,showsnapshot
symlink_properties: enable
- name: Create CIFS share acl on vserver "{{ vserver }}" and "gruppe{{ gruppennummer }}$"
na_ontap_cifs_acl:
state: present
share_name: "gruppe{{ gruppennummer }}$"
user_or_group: BUILTIN\Administrators
permission: full_control
vserver: "{{ vservername }}"
hostname: "{{ hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
- name: Create CIFS share acl on vserver "{{ vserver }}" and "gruppe{{ gruppennummer }}_homes$"
na_ontap_cifs_acl:
state: present
share_name: "gruppe{{ gruppennummer }}_homes$"
user_or_group: BUILTIN\Administrators
permission: full_control
vserver: "{{ vservername }}"
hostname: "{{ hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
- name: Create a quota policy vor "gruppe{{ gruppennummer }}_homes$" of 1GB per user
na_ontap_quota_policy:
state: present
vserver: "{{ vservername }}"
name: default
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
- name: Add/Set quota vor "gruppe{{ gruppennummer }}_homes$" to 1GB per user
na_ontap_quotas:
state: present
vserver: "{{ vservername }}"
volume: "gruppe{{ gruppennummer }}_homes"
type: user
quota_target: ""
policy: default
disk_limit: "1GB"
qtree: ""
set_quota_status: yes
use_rest: always
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
- name: Abschluss Meldung ausgeben
ansible.builtin.debug:
#msg: "default plugin output: result example"
msg: "Meldung Abschluss => Erinnerung fuer CommVault und Cleondris"