Debian Codegraph @

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

raw
1 # win_shell invocations can eventually be replaced with win_eventlog
2 - name: Remove potentially leftover test logs and sources
3 ansible.windows.win_shell: Remove-EventLog -LogName "{{ item.log }}" -ErrorAction SilentlyContinue
4 with_items:
5 - "{{ win_test_log_source }}"
6 - "{{ win_test_log_source_extra }}"
7 failed_when: no
8
9 - name: Add new test logs and sources
10 ansible.windows.win_shell: New-EventLog -LogName "{{ item.log }}" -Source "{{ item.source }}"
11 with_items:
12 - "{{ win_test_log_source }}"
13 - "{{ win_test_log_source_extra }}"
14
15 - name: Run tests for win_eventlog_entry
16 block:
17
18 - name: Test in normal mode
19 import_tasks: tests.yml
20 vars:
21 in_check_mode: no
22
23 - name: Test in check-mode
24 import_tasks: tests.yml
25 vars:
26 in_check_mode: yes
27 check_mode: yes
28
29 - name: Remove test logs and sources
30 ansible.windows.win_shell: Remove-EventLog -LogName "{{ item.log }}"
31 with_items:
32 - "{{ win_test_log_source }}"
33 - "{{ win_test_log_source_extra }}"