StephenSorriaux / ansible-kafka-admin

Manage your topic's configuration (partitions, replication factor, parameters), ACLs, quotas, users and get stats, without any effort with this library. It does not use the Kafka scripts and does not require ssh connection to the remote broker.
Apache License 2.0
150 stars 46 forks source link

Add publishing to Ansible Galaxy as collection #152

Open skokhanovskiy opened 1 year ago

skokhanovskiy commented 1 year ago

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:

StephenSorriaux commented 1 year ago

Hello,

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

I will look into that.

arenard commented 11 months ago

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

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

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 commented 1 week ago

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 commented 1 week ago

@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:
      # ...