Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions tasks/uninstall_runner_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
register: runner_service_file_path

- name: Read service name from file
ansible.windows.win_command: "cat {{ runner_dir }}\\.service"
ansible.windows.win_shell: "type {{ runner_dir }}\\.service"
register: runner_service
changed_when: false
when: runner_service_file_path.stat.exists

- name: Uninstall service runner
ansible.windows.win_shell: |
if(Get-Service {{ runner_service.stdout }} -ErrorAction SilentlyContinue) {
Write-Host "Stopping and removing service: {{ runner_service.stdout }}"
sc.exe stop "{{ runner_service.stdout }}"
sc.exe delete "{{ runner_service.stdout }}"
if(Get-Service {{ runner_service.stdout | trim }} -ErrorAction SilentlyContinue) {
Write-Host "Stopping and removing service: {{ runner_service.stdout | trim }}"
sc.exe stop "{{ runner_service.stdout | trim }}"
sc.exe delete "{{ runner_service.stdout | trim }}"
}
args:
chdir: "{{ runner_dir }}"
Expand Down