ansible_role_win_chocolatey/tasks/main.yml
2024-01-18 17:03:06 +01:00

19 lines
714 B
YAML

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