Checkmk / ansible-collection-checkmk.general

The official Checkmk Ansible collection - brought to you by the Checkmk company.
https://galaxy.ansible.com/checkmk/general
GNU General Public License v3.0
121 stars 56 forks source link

[FEED] Include argument_specs.yml in roles #693

Open skutter-de opened 5 days ago

skutter-de commented 5 days ago

Please verify first that your feedback is not already reported here. If possible and useful provide additional information below. This is optional however.

Provide your feedback

The roles should include arguments_specs so Ansible can do analysis to check if required parameters are set and within spec (eg. the choice between Checkmk edition)

Component Name

Component Name: roles

Ansible Version

$ ansible --version
ansible [core 2.17.5]
  config file = None
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.local/lib/python3.12/site-packages/ansible
  ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/user/.local/bin/ansible
  python version = 3.12.6 (main, Sep  9 2024, 00:00:00) [GCC 14.2.1 20240801 (Red Hat 14.2.1-1)] (/usr/bin/python3)
  jinja version = 3.1.4
  libyaml = True

Collection Version

$ ansible-galaxy collection list | grep checkmk
checkmk.general                          5.3.1
robin-checkmk commented 3 days ago

Hi @skutter-de and thanks for raising this! I have been using Ansible for a number of years now, and I have never heard of a argument_specs.yml. As this ignorance could both mean, that I missed something important or that it is something very peculiar or exotic, can you please shed some light on this for me?

I could guess from the brief description, what you mean, but I would much rather learn properly, what you are trying to achieve. So if you could elaborate on your request and maybe provide sources and or references, that would be much appreciated. Thanks!

skutter-de commented 3 days ago

I also haven't heard about argument specs until about a month ago.

Ansible will automatically validate the vars set by the user against the argument spec, this can be useful for role development, since you can skip a lot of input validation because the arugment spec can handle it for you.

Another nice feature is that you can have the arugments from the spec rendered to a docs site (see here).

robin-checkmk commented 3 days ago

Thanks for the background information and bringing this to our attention! :pray: I am also kinda glad I did not miss anything for years. :wink:

While this sounds pretty neat, I will be up-front and tell you, that I will have to put it at the bottom of my agenda. It will be there, but I cannot promise, when I will get to it. If that is alright, I will keep this issue open and report back, when I made progress.

Alternatively: We do gladly accept pull requests! So if you want to give the implementation a try yourself, feel free to do so and we will help you land the PR. :slightly_smiling_face: