Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lozsta opened this issue Feb 13, 2024 · 6 comments
Open

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

lozsta opened this issue Feb 13, 2024 · 6 comments
Labels

Comments

@lozsta
Copy link

lozsta commented Feb 13, 2024

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.

@geerlingguy
Copy link
Owner

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: #575

@lozsta
Copy link
Author

lozsta commented Feb 13, 2024

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.

@matheus0312
Copy link

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 :)

Copy link

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 github-actions bot added the stale label Jul 15, 2024
@geerlingguy
Copy link
Owner

@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!

@github-actions github-actions bot removed the stale label Aug 19, 2024
Copy link

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 github-actions bot added the stale label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants