Install Docker in Windows-like systems - Ansible module win_chocolatey
By Luca Berton · Published 2024-01-01 · Category: installation
How to automate the installation of the latest version of Docker Desktop in your Windows-like system with Ansible Playbook and Chocolatey.

How to Install Docker in Windows-like systems with Ansible?
Today I'm going to reveal how to install the software in a Windows-managed host using Chocolatey Package Manager.
See also: Install Docker in Debian-like systems - Ansible module apt_key, apt_repository and apt
Ansible module win_chocolatey
chocolatey.chocolatey.win_chocolatey- Manage packages using chocolatey
win_chocolatey to automate the software installation process.
The full name is chocolatey.chocolatey.win_chocolatey, which means that is part of the collection distributed by "chocolatey".
It manages packages in Windows using chocolatey. It's the windows correspondent of the ansible package module.
Parameters
- name list-string - the name of the package
- state string - present/latest/absent/downgrade/reinstalled
- version string - specific version
See also: Ansible Playbook for Installing Docker on Linux Systems
Links
## Playbook
Install Docker in Windows-like systems with Ansible Playbook.
code
---
- name: install Docker
hosts: all
become: false
gather_facts: false
tasks:
- name: Install Docker
chocolatey.chocolatey.win_chocolatey:
name: "docker-desktop"
state: present
execution
ansible-pilot $ ansible-playbook -i virtualmachines/win/inventory install\ Docker/windows.yml
PLAY [install Docker] *****************************************************************************
TASK [Install Docker] *****************************************************************************
changed: [WindowsServer]
PLAY RECAP ****************************************************************************************
WindowsServer : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
ansible-pilot $
idempotency
ansible-pilot $ ansible-playbook -i virtualmachines/win/inventory install\ Docker/windows.yml
PLAY [install Docker] *****************************************************************************
TASK [Install Docker] *****************************************************************************
ok: [WindowsServer]
PLAY RECAP ****************************************************************************************
WindowsServer : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
ansible-pilot $
Conclusion
Now you know how to install Docker in Windows-like systems with Ansible.
See also: Install Google Chrome in Windows-like systems - Ansible module win_chocolatey
Related Articles
Category: installation
Watch the video: Install Docker in Windows-like systems - Ansible module win_chocolatey — Video Tutorial