# Run a playbook on AWX that uses the win\_chocolatey module to install packages on a Windows host via WinRM

**URL:** <https://forum.ansible.com/t/run-a-playbook-on-awx-that-uses-the-win-chocolatey-module-to-install-packages-on-a-windows-host-via-winrm/11077>\
**Category:** Get Help\
**Tags:** windows, awx\
**Created:** [November 22, 2024, 7:51pm UTC](https://forum.ansible.com/t/run-a-playbook-on-awx-that-uses-the-win-chocolatey-module-to-install-packages-on-a-windows-host-via-winrm/11077 "2024-11-22T19:51:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ansible-tst](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@ansible-tst](https://forum.ansible.com/u/ansible-tst)\
**Post date:** [November 22, 2024, 7:51pm UTC](https://forum.ansible.com/t/run-a-playbook-on-awx-that-uses-the-win-chocolatey-module-to-install-packages-on-a-windows-host-via-winrm/11077/1 "2024-11-22T19:51:53Z")

</div>

**I am trying to run a playbook on my AWX server targeting my Windows host via WinRM, but it is failing.**

- I configured the inventory, credentials, hosts, projects, and templates (I am new to AWX, so I might have made a mistake, but I followed a tutorial, so I believe the setup is correct).
- After that, I ran a playbook to ping the Windows host, and it worked. However, when I tried running another playbook using Chocolatey (used for Windows package installations), it failed with the error:  
**“ERROR! unable to resolve module/action ‘community.windows.win\_chocolatey’. This often indicates a misspelling, missing collection, or incorrect module path.”**

- I am using the latest version of AWX.

```auto
---
- name: Example usage of win_chocolatey module on AWX
  hosts: all
  become: false
  gather_facts: false
  vars:
    packages:
      - git
      - notepadplusplus
  tasks:
    - name: Install packages using Chocolatey
      community.windows.win_chocolatey:
        name: "{{ packages }}"
        state: present

```

#### Additional Information:

- I am using GitHub to manage my playbooks and integrating it with AWX.

---

<div class="post-metadata">

**Author:** ![Andres](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/andres/32/5583_2.png) [@Andres](https://forum.ansible.com/u/Andres)\
**Post date:** [November 28, 2024, 8:37am UTC](https://forum.ansible.com/t/run-a-playbook-on-awx-that-uses-the-win-chocolatey-module-to-install-packages-on-a-windows-host-via-winrm/11077/2 "2024-11-28T08:37:02Z")

</div>

I am struggling with same at moment, and looks like that needed modules(collections) are not present Ansibel. If You are using latest AWX on kubernetes the default Execution Environments are just prety bare-bone and contains basic collections.  
Currently trying to build my own custom EE ans see whats comes out.

---

<div class="post-metadata">

**Author:** ![alvaroc20](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/alvaroc20/32/3485_2.png) [@alvaroc20](https://forum.ansible.com/u/alvaroc20)\
**Post date:** [November 28, 2024, 1:30pm UTC](https://forum.ansible.com/t/run-a-playbook-on-awx-that-uses-the-win-chocolatey-module-to-install-packages-on-a-windows-host-via-winrm/11077/3 "2024-11-28T13:30:44Z")

</div>

Hi!

I created my own Execution Environment (EE) by building a Docker image tailored to my environment’s needs and storing it in AWS ECR. Then, I set up an EE in AWX, pointing to that ECR.

My Dockerfile starts with a minimal Ubuntu 20.04 image. It installs Python 3.10 and its required dependencies, configures pip and ansible-runner, and includes Ansible with specific modules like `boto3` and `docker`. It also installs Docker CLI to allow the execution of containerized tasks within the EE. Additionally, it sets up the required Ansible collections based on a `requirements.yaml` file.

Using this approach, I can customize the EE to include exactly what my AWX jobs need without relying on the default Execution Environments.

Let me know if you’d like more details!

---

<div class="post-metadata">

**Author:** ![ansible-tst](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@ansible-tst](https://forum.ansible.com/u/ansible-tst)\
**Post date:** [December 2, 2024, 1:47pm UTC](https://forum.ansible.com/t/run-a-playbook-on-awx-that-uses-the-win-chocolatey-module-to-install-packages-on-a-windows-host-via-winrm/11077/4 "2024-12-02T13:47:34Z")

</div>

Hi, I tried to create my own Execution Environment (EE), but since I needed to quickly deploy Ansible in my workplace to automate services, I had to look for an alternative. That’s when I discovered Ansible Semaphore, and through it, I was able to automate tasks on Windows machines. I find it simpler and easier to use.
