Install chocolatey

This commit is contained in:
L3D 2024-01-18 17:03:06 +01:00
parent 6fee48aa48
commit 5322f83dfb
No known key found for this signature in database
GPG key ID: F3949BA55195BC7B

19
tasks/main.yml Normal file
View file

@ -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'))