-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconnect_windows.yml
50 lines (44 loc) · 1.25 KB
/
connect_windows.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
---
- name: Windows connectivity test
hosts: all
become: false
gather_facts: false
vars:
#
# Ansible WinRM configuration
#
ansible_connection: winrm
ansible_pipelining: true
ansible_winrm_port: 5985
ansible_winrm_scheme: http
ansible_winrm_transport: ntlm
ansible_winrm_message_encryption: always
ansible_winrm_server_cert_validation: ignore
ansible_winrm_user: Administrator
ansible_winrm_password: Foobar_12
ansible_become_method: runas
#ansible_become_user: Administrator
#
# Ansible Windows/SSH configuration
#
#ansible_user: Administrator
#ansible_password: Foobar_12
#ansible_shell_type: powershell
#ansible_become_method: runas
#ansible_become_user: Administrator
tasks:
- name: Check host reachable
vars:
ansible_connection: local
wait_for:
host: "{{ inventory_hostname }}"
port: "{{ ansible_winrm_port }}"
timeout: 10
delegate_to: localhost
- name: Check host access
ansible.windows.win_ping:
- name: Check user privileges
ansible.windows.win_whoami:
register: whoami_output
failed_when: whoami_output.privileges.SeDebugPrivilege is not search('enabled')
changed_when: false