diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..51c4a90 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,19 @@ +--- +- name: 'Install chocolatey' + block: + - name: try to install using ansible + chocolatey.chocolatey.win_chocolatey: + name: chocolatey + state: present + register: _choco + until: _choco is succeeded + retries: 4 + delay: 2 + rescue: + - name: Install choco using powershell + ansible.windows.win_powershell: + script: | + rm -rf C:\ProgramData\chocolatey; + Set-ExecutionPolicy Bypass -Scope Process -Force; + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))