Merge pull request #87 from corvus-migratorius/role-win_chocolatey_install

Role win chocolatey install
This commit is contained in:
Fogucoco
2026-04-09 12:16:38 +03:00
committed by GitHub
12 changed files with 134 additions and 1 deletions

View File

@@ -39,4 +39,5 @@
- [users](roles/users/README.md)
- [wg_hub](roles/wg_hub/README.md)
- [wg_spoke](roles/wg_spoke/README.md)
- [win_chocolatey_install](roles/win_chocolatey_install/README.md)
- [xfs_project_quotas](roles/xfs_project_quotas/README.md)

View File

@@ -1,7 +1,7 @@
---
namespace: genlab
name: common
version: 0.35.0
version: 0.36.0
readme: README.md
authors:
- Alexander Gorelyshev (corvus-migratorius@proton.me)

View File

@@ -8,3 +8,4 @@ collections:
- name: community.postgresql
- name: lucasheld.uptime_kuma
- name: maxhoesel.borgbackup
- name: ansible.windows

View File

@@ -0,0 +1,36 @@
win_chocolatey_install
=========
Install chocolatey on windows hosts
Requirements
------------
None
Role Variables
--------------
None
Dependencies
------------
ansible.windows
Example Playbook
----------------
```yaml
- role: genlab.common.win_chocolatey_install
```
License
-------
BSD
Author Information
------------------
malyuk.ss@genlab.llc

View File

@@ -0,0 +1 @@
---

View File

@@ -0,0 +1 @@
---

View File

@@ -0,0 +1,16 @@
---
galaxy_info:
role_name: "win_chocolatey_install"
namespace: genlab
author: "Sergey Malyuk"
company: "Genlab, LLC"
description: "Install chocolatey"
license: "MIT"
min_ansible_version: "2.16"
platforms:
- name: "Windows"
galaxy_tags: []
dependencies: []

View File

@@ -0,0 +1,9 @@
---
- name: Converge
hosts: all
pre_tasks:
# Blank task for ignoring CI testing
# This role was tested manually
- name: Blank
ansible.builtin.command: echo
changed_when: false

View File

@@ -0,0 +1,22 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: ubuntu
image: geerlingguy/docker-ubuntu2204-ansible:latest
pre_build_image: true
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
provisioner:
name: ansible
verifier:
name: ansible
lint: |
set -e
yamllint .
ansible-lint .

View File

@@ -0,0 +1,11 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
# Blank task for ignoring CI testing
# This role was tested manually
- name: Blank
ansible.builtin.command: echo
changed_when: false

View File

@@ -0,0 +1,34 @@
---
- name: Check chocolatey existance
block:
- name: Get chocolatey status
ansible.windows.win_stat:
path: C:\ProgramData\chocolatey\bin\choco.exe
register: win_chocolatey_install_status
- name: Assert that choco binary exists
ansible.builtin.assert:
that: win_chocolatey_install_status.stat.exists
success_msg: Chocolatey IS installed
fail_msg: Chocolatey IS NOT installed
rescue:
- name: Create temp folder
ansible.windows.win_file:
path: C:\tmp
state: directory
- name: Download Chocolatey install script
ansible.windows.win_get_url:
url: https://community.chocolatey.org/install.ps1
dest: C:\tmp\install_choco.ps1
- name: Run Chocolatey install script
ansible.windows.win_shell: |
Set-ExecutionPolicy Bypass -Scope Process -Force
C:\tmp\install_choco.ps1
- name: Delete tmp directory
ansible.windows.win_file:
path: C:\tmp
state: absent

View File

@@ -0,0 +1 @@
---