diff --git a/Resources/Ansible_Windows/install_runner.yml b/Resources/Ansible_Windows/install_runner.yml index fbda1bc..c3bd627 100644 --- a/Resources/Ansible_Windows/install_runner.yml +++ b/Resources/Ansible_Windows/install_runner.yml @@ -21,7 +21,7 @@ - name: Check right version installed ansible.windows.win_shell: Select-String -Path "{{ drive }}:\{{ install_dir }}\{{ runner_folder }}\version.txt" -Pattern "{{ runner_version }}" - when: stat_version.stat.exists + when: not stat_version.stat.exists changed_when: false register: installed_packages @@ -29,7 +29,7 @@ ansible.windows.win_get_url: dest: "{{ drive }}:\\{{ install_dir }}\\runner.zip" url: https://github.com/actions/runner/releases/download/v{{ runner_version }}/actions-runner-win-x64-{{ runner_version }}.zip - when: (stat_version.stat.exists) or (installed_packages.stdout is defined and installed_packages.stdout == "") + when: (not stat_version.stat.exists) or (installed_packages.stdout is defined and installed_packages.stdout == "") register: runner_download_result - name: Unzip Runner @@ -50,7 +50,7 @@ become_user: "{{ user }}" become_method: ansible.builtin.runas register: register_output - when: (stat_version.stat.exists) and (runner_download_result.msg is defined and runner_download_result.msg == "OK") + when: (not stat_version.stat.exists) and (runner_download_result.msg is defined and runner_download_result.msg == "OK") - name: Set version, only if registration went through, so this script can be called multiple times community.windows.win_lineinfile: @@ -59,4 +59,4 @@ line: "{{ runner_version }}" state: present create: true - when: (stat_version.stat.exists) or (register_output.rc is defined and register_output.rc == 0) + when: (not stat_version.stat.exists) or (register_output.rc is defined and register_output.rc == 0)