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

Add publishing to Ansible Galaxy as collection #152

Open
skokhanovskiy opened this issue Mar 28, 2023 · 6 comments
Open

Add publishing to Ansible Galaxy as collection #152

skokhanovskiy opened this issue Mar 28, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@skokhanovskiy
Copy link

Installing kafka-admin from Ansible Galaxy as collection doesn't work properly.

I've tried to install kafka-admin with following requirements file.

# requirements.yaml
collections:
  - name: stephensorriaux.kafka-admin
    version: '0.17.1'
    source: https://galaxy.ansible.com

But got error after running ansible-galaxy.

ansible-galaxy collection install -r requirements.yaml
ERROR! Unexpected Exception, this is probably a bug: stat: path should be string, bytes, os.PathLike or integer, not GalaxyAPI

Version of Ansible

$ ansible-galaxy --version
ansible-galaxy [core 2.12.10]
  config file = None
  configured module search path = ['/opt/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/ansible/venv/lib/python3.10/site-packages/ansible
  ansible collection location = /opt/ansible/.ansible/collections
  executable location = /opt/ansible/venv/bin/ansible-galaxy
  python version = 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]
  jinja version = 3.1.2
  libyaml = True

As I understand, only kafka-admin role available in Galaxy right now, collection wasn't published. Also this links in README follows to non existing page: https://github.com/StephenSorriaux/ansible-kafka-admin/blob/master/README.md?plain=1#L51.

I still could install kafka-admin as role.

# requirements.yaml
roles:
  - name: stephensorriaux.kafka-admin
    version: '0.17.1'
    source: https://galaxy.ansible.com

But in this case:

  • I have to run role directly before using modules.
  • There are no FQCN names for modules that triggers warnings in ansible-lint.
    WARNING  Unable to resolve FQCN for module kafka_topics
    WARNING  Unable to resolve FQCN for module kafka_topic
    WARNING  Unable to resolve FQCN for module kafka_acls
    ...
    
@StephenSorriaux
Copy link
Owner

Hello,

Thank you for the issue and sorry for the time I took to see it.

I will look into that.

@StephenSorriaux StephenSorriaux added the bug Something isn't working label Oct 19, 2023
@arenard
Copy link

arenard commented Nov 27, 2023

Hello, thanks for all of this.

Just to be sure this is in the scope but on previous posts of this issue I assume it is.
There may be a problem with the current naming of the collection namespace. ansible galaxy doc (https://docs.ansible.com/ansible/latest/dev_guide/collections_galaxy_meta.html#collections-galaxy-meta) indicates that namespaces have to be lowercased and it is not currently.

The namespace of the collection.
This can be a company/brand/organization or product namespace under which all content lives.
May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with underscores or numbers and cannot contain consecutive underscores.

@StephenSorriaux
Copy link
Owner

StephenSorriaux commented Nov 28, 2023

Hello,

Thank you for the information.

Yes those rules are true now, but did not exist when I first released the lib to Ansible Galaxy (5 years ago... already?!). In the meantime, Ansible Galaxy got updated, added this rule, but did not bother handle or even migrate those already published lib like this one that does not meet the rule...
I need to take some time to check this again, as I think @skokhanovskiy raised a good point with the collection vs role stuff.

@arenard
Copy link

arenard commented Nov 29, 2023

Thank you Stephen for this explanations about current state of ansible galaxy publication.
Changing rules are difficult to handle especially when there is no help with necessary changes related to those new rules.
I hope you will be able to find a not too hard way to et a path through this.

@allig4t0r
Copy link

I need to take some time to check this again, as I think @skokhanovskiy raised a good point with the collection vs role stuff.

Is there any chance that you did take a look into this? I'm wondering what is the best way to install this module as of right now :)

@skokhanovskiy
Copy link
Author

@allig4t0r you can use direct link to the archive file as temporary workaround.

# requirements.yaml

collections:
  - name: "https://github.com/StephenSorriaux/ansible-kafka-admin/releases/\
      download/0.13.1/StephenSorriaux-ansible_kafka_admin-0.13.1.tar.gz"
# playbook.yaml

- name: kafka admin
  hosts: kafka
  tasks:
    - name: ensure topics are configured
      StephenSorriaux.ansible_kafka_admin.kafka_topics:
      # ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants