Run a playbook on AWX that uses the win_chocolatey module to install packages on a Windows host via WinRM

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.
---
- 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.

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.

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!

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.

1 Like