google-cloud-ops-agents-ansible icon indicating copy to clipboard operation
google-cloud-ops-agents-ansible copied to clipboard

Playbook fails due to run with Ansible 2.10

Open douglas-vaz opened this issue 2 years ago • 1 comments

Ansible version: 2.10 OS: Ubuntu 20.04 Ansible role using Galaxy

Playbook:

---
- hosts: all
  become: true
  roles:
    - role: googlecloudplatform.google_cloud_ops_agents
      vars:
        agent_type: ops-agent

Error:

ERROR! couldn't resolve module/action 'win_shell'. This often indicates a misspelling, missing collection, or incorrect module path.
The error appears to be in '/root/.ansible/roles/googlecloudplatform.google_cloud_ops_agents/handlers/main.yml': line 8, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: "restart windows {{ agent_type }} agent"
  ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
    with_items:
      - {{ foo }}
Should be written as:
    with_items:
      - "{{ foo }}"

douglas-vaz avatar May 30 '22 02:05 douglas-vaz

I just ran into this - seems like there should be a check to see if the target is even running Windows, as I'm also targeting Ubuntu, but anyways...looks like the windows collection needs to be installed first via ansible-galaxy collection install ansible.windows and then the issue should go away!

I think the proper solution would be for this collection to add the windows collection as a dependency.

runofthemill avatar Jun 27 '23 15:06 runofthemill