-
Notifications
You must be signed in to change notification settings - Fork 0
/
04_talus_neuer_Kunde_einrichten.yml
158 lines (141 loc) · 7.27 KB
/
04_talus_neuer_Kunde_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
#!/usr/bin/env ansible-playbook
###############################################################################
# Applikation: Storage-Admin
# ScriptName: 04_talus_neuer_Kunde_einrichten.yml
# Version: 1.0
# Typ: ansible YAML playbook
# Beschreibung: Erstelle neuen Qtree für neuen Kunden
#
# Author: Horst Pauli Professional Services Consultant
#
# Target Systems: LINUX Server/VM used as Ansible Host at Customer Site
#
# (C) Copyright NetApp Switzerland 2020
###############################################################################
# Modifications: 16/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 Vservername
set_fact:
vservername: "{% if hostname=='tacluster01' %}svm_ta_cifs{% elif hostname=='tbcluster01'%}svm_tb_cifs{% else %}svm_cifs01{% endif %}"
- name: Automaticaly choose the right Vserver IP-Address
set_fact:
vserverip: "{% if hostname=='tacluster01' %}192.168.2.224{% elif hostname=='tbcluster01'%}192.168.2.225{% else %}192.168.2.223{% endif %}"
- name: Create a Qtree on vserver "{{ vserver }}" and Volume "{{ gruppenname }}_homes" .
na_ontap_qtree:
state: present
name: "{{ kundenname }}"
flexvol_name: "{{ gruppenname }}_homes"
security_style: ntfs
oplocks: disabled
vserver: "{{ vservername }}"
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
- name: Create a Qtree on vserver "{{ vserver }}" and Volume "{{ gruppenname }}"
na_ontap_qtree:
state: present
name: "{{ kundenname }}"
flexvol_name: "{{ gruppenname }}"
security_style: ntfs
oplocks: enabled
vserver: "{{ vservername }}"
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
- name: Temporary Mount the CIFS Share "{{ vserverip }}/{{ gruppenname }}$/{{ kundenname }}" to LINUX
shell: ansible awx-pauli -m mount -a 'path=/tempmount state=mounted fstype=cifs src="//{{ vserverip }}/{{ gruppenname }}$/{{ kundenname }}/" opts="user=Administrator,password=netapp112021,vers=2.0"'
- name: CLI execute script on Host localhost
shell: ansible awx-pauli -m script -a "/var/lib/awx/projects/talus/tempmount.sh >> /tmp/tempmount.log"
remote_user: root
- name: Create CIFS Share for customer {{ kundenname }}_Appl on Volume {{ gruppenname }}
na_ontap_cifs:
state: present
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
share_name: "{{ kundenname }}_Appl$"
path: "/{{ gruppenname }}/{{ kundenname }}/Appl"
vserver: "{{ vservername }}"
share_properties: browsable,changenotify,oplocks,show-previous-versions,showsnapshot
symlink_properties: enable
- name: Create CIFS Share for customer {{ kundenname }}_Daten on Volume {{ gruppenname }}
na_ontap_cifs:
state: present
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
share_name: "{{ kundenname }}_Daten$"
path: "/{{ gruppenname }}/{{ kundenname }}/Daten"
vserver: "{{ vservername }}"
share_properties: browsable,changenotify,oplocks,show-previous-versions,showsnapshot
symlink_properties: enable
- name: Create CIFS Share for customer {{ kundenname }}_Fsprofiles Daten on Volume {{ gruppenname }}
na_ontap_cifs:
state: present
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
share_name: "{{ kundenname }}_Fsprofiles$"
path: "/{{ gruppenname }}/{{ kundenname }}/Fsprofiles"
vserver: "{{ vservername }}"
share_properties: browsable,changenotify,oplocks,show-previous-versions,showsnapshot
symlink_properties: enable
#******************** Shares unter "{{ gruppenname }}_homes" ************************************
- name: Create CIFS Share for customer "{{ kundenname }}" on Volume "{{ gruppenname }}_homes"
na_ontap_cifs:
state: present
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
share_name: "{{ kundenname }}_Homes$"
path: "/{{ gruppenname }}_homes"
vserver: "{{ vservername }}"
share_properties: browsable,changenotify,oplocks,show-previous-versions,showsnapshot
symlink_properties: enable
- name: Set ABE on new created Share {{ kundenname }}_Appl$
na_ontap_command:
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
command: "cifs share properties add -share-name {{ kundenname }}_Appl$ -vserver {{ vserver }} -share-properties access-based-enumeration"
privilege: 'admin'
return_dict: true
- name: Set ABE on new created Share {{ kundenname }}_Daten$
na_ontap_command:
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
command: "cifs share properties add -share-name {{ kundenname }}_Daten$ -vserver {{ vserver }} -share-properties access-based-enumeration"
privilege: 'admin'
return_dict: true
- name: Set ABE on new created Share {{ kundenname }}_Fsprofiles$
na_ontap_command:
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
command: "cifs share properties add -share-name {{ kundenname }}_Fsprofiles$ -vserver {{ vserver }} -share-properties access-based-enumeration"
privilege: 'admin'
return_dict: true
- name: Set ABE on new created Share {{ kundenname }}_Homes$
na_ontap_command:
hostname: "{{ hostname }}"
username: "{{ PRI_CLU_USER }}"
password: "{{ PRI_CLU_PASS }}"
command: "cifs share properties add -share-name {{ kundenname }}_Homes$ -vserver {{ vserver }} -share-properties access-based-enumeration"
privilege: 'admin'
return_dict: true