Skip to content

Commit

Permalink
feat(chocolatey): improved choco packages installation task
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexNabokikh committed Aug 10, 2022
1 parent 51237b1 commit 086473c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ ansible-playbook main.yml --tags "choco,wsl"

## Overriding Defaults

You can override any of the defaults configured in `default.config.yml` by creating a `config.yml` file and setting the overrides in that file. For example, you can customize the installed packages and enable/disable specific tasks with something like:
**NOTE:** You can override any of the defaults configured in `default.config.yml` by creating a `config.yml` file and setting the overrides in that file. For example, you can customize the installed packages and enable/disable specific tasks with something like:

```yaml
configure_hostname: true
Expand All @@ -108,11 +108,15 @@ install_windows_updates: true
update_categories:
- Critical Updates
- Security Updates
- * # Installs all updates

choco_installed_packages:
- googlechrome
- git
- golang
- name: googlechrome # installs latest version of the Google Chrome while ignoring the package checksum
state: latest
choco_args: --ignorechecksum
- name: git # installs 2.37.1 version of the git
version: "2.37.1"
- golang # installs GO, but won't update it

install_fonts: true
installed_nerdfonts:
Expand Down
9 changes: 6 additions & 3 deletions default.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ change_power_plan: true
power_plan: "high performance"

choco_installed_packages:
- adobereader
- auto-dark-mode
- awscli
- name: adobereader
version: "2022.002.20191" # installs 2019.2.2.20191 version of the adobe reader
- name: auto-dark-mode # installs latest version of the auto-dark-mode while ignoring the package checksum
state: latest
choco_args: --ignorechecksum
- awscli # installs awscli, but won't update it
- Firefox
- git
- golang
Expand Down
10 changes: 3 additions & 7 deletions tasks/chocolatey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@
- name: Ensure configured Chocolatey packages are installed.
chocolatey.chocolatey.win_chocolatey:
name: "{{ item.name | default(item) }}"
ignore_checksums: true
state: present
state: "{{ item.state | default('present') }}"
version: "{{ item.version | default(omit) }}"
choco_args: "{{ item.choco_args | default(omit) }}"
loop: "{{ choco_installed_packages }}"

- name: Upgrade installed Chocolatey packages.
chocolatey.chocolatey.win_chocolatey:
name: all
state: latest

- name: Clean chocolatey and nuget cache.
ansible.windows.win_file:
path: "{{ item }}"
Expand Down

0 comments on commit 086473c

Please sign in to comment.