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

Clarification on requirements from Ansible Galaxy Collection community.general #140

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

FreddyFunk
Copy link

I am trying to run your ntp role version 2.7.0 in a simple ansible playbook:

---
- hosts: proxmox_nodes
  become: True
  roles:
    - role: geerlingguy.ntp
      vars:
        ntp_manage_config: true
        ntp_timezone: Europe/Berlin
        ntp_servers:
          - clock.sjc.he.net,
          - clock.fmt.he.net,
          - clock.nyc.he.net

But I receive the following error. I also tried removing my override of the ntp_timezone variable, so it uses the default, but still receive the same error message.

Error message:

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

The error appears to be in '/tmp/.ansible/roles/geerlingguy.ntp/tasks/main.yml': line 40, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Set timezone.
  ^ here

I am using the default Ansible community Execution Environment image and start my container like this in my git directory with all my ansible files:

podman run -it -v "$(pwd)":/runner:Z -v "$HOME/.ssh:/tmp/.ssh:Z" ghcr.io/ansible-community/community-ee-base:latest

After going trough all tasks in main.yml, I found that 'timezone' is not part of 'ansible.builtin' but rather 'community.general', which requires the ansible galaxy collection 'community.general' to be installed locally. This was a surprise, since the roles stated Dependencies: None.

Therefore I open this pull request to define the clear origin of each task and update the dependency section in the readme file. I also added an ansible lint GitHub workflow and applied fixes for all findings:

WARNING  Listing 19 violation(s) that are fatal
Error: Use FQCN for builtin module actions (service).
Error: All names should start with an uppercase letter.
Error: Use FQCN for builtin module actions (service).
Error: All names should start with an uppercase letter.
Error: $.galaxy_info.min_ansible_version 2.1 is not of type 'string'. See https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html#using-role-dependencies
Error: Use FQCN for builtin module actions (apt).
Error: Use FQCN for builtin module actions (include_vars).
Error: Use FQCN for builtin module actions (set_fact).
Error: Use FQCN for builtin module actions (set_fact).
Error: Use FQCN for builtin module actions (set_fact).
Error: Use FQCN for builtin module actions (set_fact).
Error: Use FQCN for builtin module actions (package).
Error: Use FQCN for builtin module actions (package).
Error: Use FQCN for module actions, such `community.general.timezone`.
Error: Use FQCN for builtin module actions (service_facts).
Error: Use FQCN for builtin module actions (service).
Error: Use FQCN for builtin module actions (service).
Error: Use FQCN for builtin module actions (service).
Error: Use FQCN for builtin module actions (template).

I can revert the GitHub Workflow changes, if you do not feel comfortable with it. Also, please let me know if you would like to see changes made to the requirements.yml and the listed version requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant