-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathad_hoc_laboratorios.yml
242 lines (215 loc) · 7.17 KB
/
ad_hoc_laboratorios.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
######################## OBSERVAÇÕES IMPORTANTES ######################
#######################################################################
#######################################################################
# Há roles que precisam ser atualizados de tempos em tempos.
# Deve-se adicionar aqui os roles que perceberem que necessitam atualizações
# - Atualizar os patrimonio do role configura_monitores
#######################################################################
# - name: Servidor controlador
# hosts: controlador
# tasks:
# # USAR O CPF COMO USUÁRIO E A SENHA DEVE TER NO MÍNIMO 8 dígitos
# - name: Cria usuários para o IFSC-Terceirizados
# ansible.builtin.shell: "samba-tool user create {{ item.user }} {{ item.password }} --userou=OU=terceirizados && samba-tool user setexpiry --days=365 {{ item.user }}"
# loop:
# - { user: 12345678910, password: 87654321 }
# - name: Manage local user aluno on a Windows remote host # ( ESTÁ funcionando )
# hosts: sje-ctic-866467.maquinas.sj.ifsc.edu.br
# gather_facts: no
# vars:
# ansible_winrm_transport: basic
# ansible_winrm_server_cert_validation: ignore
# tasks:
# - name: Add user "aluno" to local group "Usuários"
# win_group_membership:
# name: Usuários
# members:
# - aluno
# state: present
#
# ## Remover do LDAP ##############
# - hosts: sj-lin-ciehu-710790.maquinas.sj.ifsc.edu.br
# roles:
# - remove_ldap
#
# ## Instala Impressoras CUPS ##############
# - name: Desligar todos os computadores de um grupo
# hosts: programacao_lin
# tasks:
# - name: Enviar comando de desligamento
# ansible.builtin.command:
# cmd: /sbin/shutdown -h now
# ignore_errors: true
# register: shutdown_result
# - name: Mostrar status do desligamento
# ansible.builtin.debug:
# var: shutdown_result
######### Executar o Windows Update em Hosts windows remotos
# - name: Executar o Windows Update em Hosts windows remotos
# hosts: sj-labter-614120.maquinas.sj.ifsc.edu.br
# tasks:
# - name: Run Windows Update
# win_updates:
# category_names:
# - CriticalUpdates
# - SecurityUpdates
# - UpdateRollups
# - FeaturePacks
# - ServicePacks
# state: installed
# reboot: yes
# - hosts: laboratorios_lin
# tasks:
# - name: Copia um arquivo para as maquinas - Linux
# ansible.builtin.copy:
# src: /dados/backup/{{ item }}
# dest: /usr/share/applications/
# owner: root
# group: root
# mode: 0644
# loop:
# - google-chrome.desktop
# - firefox-esr.desktop
# - name: Executa alguma coisa
# hosts: laboratorios_win
# tasks:
# - name: Desativa o início rápido para o WOL funcionar
# ansible.windows.win_regedit:
# path: HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power
# name: HiberbootEnabled
# data: 0
# type: dword
## Executar no final do semestre
# - hosts: laboratorios_lin
# roles:
# - chaves_ssh
# - firewall_labs
# - final_semestre
# - gradle
# - hosts: all
# tasks:
# - name: enable TLSv1.2 support
# win_regedit:
# path: HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\{{ item.type }}
# name: '{{ item.property }}'
# data: '{{ item.value }}'
# type: dword
# state: present
# register: enable_tls12
# loop:
# - type: Server
# property: Enabled
# value: 1
# - type: Server
# property: DisabledByDefault
# value: 0
# - type: Client
# property: Enabled
# value: 1
# - type: Client
# property: DisabledByDefault
# value: 0
# when: (ansible_os_family == 'Windows' and ansible_os_name == 'Microsoft Windows 7 Professional')
# - name: reboot if TLS config was applied
# win_reboot:
# when: enable_tls12 is changed
# - hosts: laboratorios_win
# tasks:
# - name: Corrigir problema com senha expirada
# ansible.windows.win_user:
# name: aluno
# password_expired: false
# password_never_expires: true
# user_cannot_change_password: true
# when: ansible_os_family == 'Windows'
# # LIMPA TEMP WINDOWS
# - hosts: laboratorios_win
# roles:
# - role: limpa_temp_windows
# play: 0
# # play: 0 desativa
# # play: 1 ativa
# # ATUALIZA MAC
# # SEMPRE VERIFICAR O HOST QUE QUER ATINGIR
# - hosts: laboratorios_lin
# roles:
# - role: atualiza_mac
# play: 0
# # play: 0 desativa
# # play: 1 ativa
## DESCOMENTAR PARA CORRIGIR O EPOPTES, PEGAR AS CHAVES DO SERVER. COMENTAR NOVAMENTE DEPOIS.
## LEMBRAR DE RODAR COM A OPÇÃO -l GRUPO_DO_LAB
# - hosts: laboratorios_lin
# tasks:
# - name: Pegar as chaves do epoptes server no cliente - Linux
# shell: /usr/sbin/epoptes-client -c
# when: ansible_os_family == 'Debian'
##RESOLVENDO PROBLEMA DAS INTERFACES DE REDE DO OPENVSWITCH NOS LABS
# - hosts: laboratorios_lin
# tasks:
# - name: Apagar as interfaces virtuais de rede
# shell: for x in $(ovs-vsctl list-br); do ovs-vsctl del-br ${x}; done
# when: ansible_os_family == 'Debian'
# - hosts: sidi_win
# tasks:
# - name: Turn off computers Windows
# raw: shutdown /s /hybrid /t 15 /c "We are turning computers off after maintenance"
# - hosts: programacao_lin
# tasks:
# - name: Reboot computer para Windows
# raw: grub-reboot 2
# - name: Turn off computers
# raw: reboot
# - hosts: laboratorios_lin
# roles:
# - role: restaura_vms
# nome_vms:
# - 1-Servidor
# - 2-Servidor
# - 3-Servidor
# - 4-Servidor
# - 5-Servidor
# - 6-Servidor
# - 7-Servidor
# - hosts: laboratorios_lin
# roles:
# - role: restaura_vms_grafico
# nome_vms:
# - 1-Grafico
# - 2-Grafico
# - 3-Grafico
# - 4-Grafico
# - hosts: all
# tasks:
# - name: Get the MAC address
# debug: msg="{{ hostvars[inventory_hostname].ansible_default_ipv4.macaddress }}"
# - name: Salvar na maquina que esta executando o ansible os enderecos macs
# local_action: shell echo "{{ hostvars[inventory_hostname].ansible_default_ipv4.macaddress }}" >> /tmp/output
# - win_shell: netsh interface ip add wins name=LAN addr=172.18.109.10 index=0
################### Limpar home do aluno no windows ###################
# - name: Remove conta do aluno
# win_user:
# name: aluno
# state: absent
# when: ansible_os_family == 'Windows'
# - name: Remove profile do aluno
# win_user_profile:
# name: aluno
# state: absent
# remove_multiple: yes
# when: ansible_os_family == 'Windows'
# - name: Remove a pasta do aluno
# win_file:
# path: C:\Users\aluno
# state: absent
# when: ansible_os_family == 'Windows'
# - name: cria usuário aluno
# win_user:
# name: aluno
# password_expired: no
# state: present
# user_cannot_change_password: yes
# groups:
# - "Usuários"
# when: ansible_os_family == 'Windows'
#######################################################################