Debian Codegraph @

ansible_collections/community/windows/tests/integration/targets/psexec/tasks/main.yml

raw
1 ---
2 - name: check whether the host supports encryption
3 ansible.windows.win_shell: |
4 if ([System.Environment]::OSVersion.Version -lt [Version]"6.2") {
5 "false"
6 } else {
7 "true"
8 }
9 register: encryption_supported_raw
10
11 - name: install pypsexec Python library for tests
12 command: '{{ ansible_python_interpreter | default("python") }} -m pip install pypsexec'
13 register: psexec_install
14 changed_when: '"Requirement already satisfied: pypsexec" not in psexec_install.stdout'
15 delegate_to: localhost
16
17 - name: define psexec variables
18 set_fact:
19 psexec_hostname: '{{ansible_host}}'
20 psexec_username: '{{ansible_user}}'
21 psexec_password: '{{ ansible_password | default(ansible_test_connection_password) }}'
22 psexec_encrypt: '{{encryption_supported_raw.stdout_lines[0]|bool}}'
23
24 - name: create test rule to allow SMB traffic inbound
25 win_firewall_rule:
26 name: File and Printer Sharing (SMB-In) Test
27 direction: in
28 action: allow
29 localport: 445
30 enabled: yes
31 protocol: tcp
32 program: System
33 profiles:
34 - domain
35 - private
36 - public
37 state: present
38
39 - name: run tests
40 block:
41 - include_tasks: tests.yml
42
43 always:
44 - name: remove test rule that allows SMB traffic inbound
45 win_firewall_rule:
46 name: File and Printer Sharing (SMB-In) Test
47 direction: in
48 action: allow
49 state: absent