internet-pi icon indicating copy to clipboard operation
internet-pi copied to clipboard

Syntax issue with "- name" when running main.yml

Open lozsta opened this issue 1 year ago • 5 comments

I am getting the following issue when I run the ansible-playbook main.yml file.

ERROR! couldn't resolve module/action 'community.docker.docker_compose_v2'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/home/user/internet-pi/tasks/handlers.yml': line 9, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Restart internet-monitoring
  ^ here

Seems to think there is an issue with the syntax. I have commented out the bits I don't need from the handlers.yml file but it doesn't work even with it all left as standard.

lozsta avatar Feb 13 '24 16:02 lozsta

Have you installed ansible with pip3 install ansible? It sounds like a module is missing from the installation, or your Ansible installation is a little outdated. Try running this command to get the latest versions of the right modules: https://github.com/geerlingguy/internet-pi/issues/575

geerlingguy avatar Feb 13 '24 18:02 geerlingguy

Hi. thanks for coming back to me. Yes I have installed them per the instructions. I have also tried to --force the reijnstallation but it takes an age to come back from the ansible-galaxy requests. I'll try it again tomorrow.

Checked ansible install again:

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: ansible in ./.local/lib/python3.9/site-packages (8.7.0)
Requirement already satisfied: ansible-core~=2.15.7 in ./.local/lib/python3.9/site-packages (from ansible) (2.15.9)
Requirement already satisfied: cryptography in /usr/lib/python3/dist-packages (from ansible-core~=2.15.7->ansible) (3.3.2)
Requirement already satisfied: PyYAML>=5.1 in ./.local/lib/python3.9/site-packages (from ansible-core~=2.15.7->ansible) (6.0.1)
Requirement already satisfied: importlib-resources<5.1,>=5.0 in ./.local/lib/python3.9/site-packages (from ansible-core~=2.15.7->ansible) (5.0.7)
Requirement already satisfied: jinja2>=3.0.0 in ./.local/lib/python3.9/site-packages (from ansible-core~=2.15.7->ansible) (3.1.3)
Requirement already satisfied: packaging in ./.local/lib/python3.9/site-packages (from ansible-core~=2.15.7->ansible) (23.2)
Requirement already satisfied: resolvelib<1.1.0,>=0.5.3 in ./.local/lib/python3.9/site-packages (from ansible-core~=2.15.7->ansible) (1.0.1)
Requirement already satisfied: MarkupSafe>=2.0 in ./.local/lib/python3.9/site-packages (from jinja2>=3.0.0->ansible-core~=2.15.7->ansible) (2.1.5)

When doing the

ansible-galaxy collection install -r requirements.yml --force

I get the following which just doesn't move for hours

Process install dependency map
Initial connection to galaxy_server: https://galaxy.ansible.com
Found API version 'v3, pulp-v3, v1' with Galaxy server default (https://galaxy.ansible.com/api/)
Opened /home/user/.ansible/galaxy_token
Calling Galaxy at https://galaxy.ansible.com/api/v3/collections/ansible/posix/

I am going to let it sit and see what happens.

lozsta avatar Feb 13 '24 20:02 lozsta

I ran pip3 install ansible and got the same result as @lozsta. Then I tried ansible-galaxy collection install -r requirements.yml --force and it ran correctly and now the issue is fixed :)

matheus0312 avatar Mar 11 '24 16:03 matheus0312

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

github-actions[bot] avatar Jul 15 '24 21:07 github-actions[bot]

@matheus0312 - Interestingly, I ran into this same issue on my home Mac recently, and the same fix fixed it; looks like it was just a matter of running an older Ansible install there!

geerlingguy avatar Aug 18 '24 21:08 geerlingguy