geerlingguy / internet-pi

Raspberry Pi config for all things Internet.
MIT License
4.15k stars 440 forks source link

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

Open lozsta opened 4 months ago

lozsta commented 4 months ago

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 commented 4 months ago

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

lozsta commented 4 months ago

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 commented 3 months ago

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