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

Create role documentation with Automated-Ansible-Role-Documentation #694

Closed
rndmh3ro opened this issue Aug 28, 2023 · 0 comments · Fixed by #705
Closed

Create role documentation with Automated-Ansible-Role-Documentation #694

rndmh3ro opened this issue Aug 28, 2023 · 0 comments · Fixed by #705

Comments

@rndmh3ro
Copy link
Member

rndmh3ro commented Aug 28, 2023

Description

The role's README should be automatically created. Currently we use https://github.com/telekom-mms/Automated-Ansible-Role-Documentation to create the README.

Solution

The configuration looks like this:

.aar-doc.yml

output_template: |
  <!-- BEGIN_ANSIBLE_DOCS -->
  ## Supported Operating Systems

  {%- for platform in metadata.galaxy_info.platforms %}
  - {{ platform.name }}
    {%- if "versions" in platform %}
    - {{ platform.versions | default([]) | join(', ') }}
    {%- endif %}
  {%- endfor %}

  ## Role Variables
  {% for entrypoint in argument_specs.keys() %}
  {%- set path, options=entrypoint_options[entrypoint][0] -%}
  {%- for name, details in options.items() |sort() %}
  - `{{ name }}`
    - Default: `{{ details.display_default }}`
    - Description: {{ details.display_description }}
    - Type: {{ details.display_type }}
    - Required: {{ details.display_required }}
  {%- endfor %}
  {%- endfor %}

  ## Dependencies

  {%- if ("dependencies" in metadata) and (metadata.dependencies | length > 0) %}
  {%- for dependency in metadata.dependencies %}
  - {{ dependency }}
  {%- endfor %}
  {%- else %}

  None.
  {%- endif %}

  ## Example Playbook


  - hosts: all
    roles:
      - name: {{ role }}


  <!-- END_ANSIBLE_DOCS -->

We need some Github Actions to automatically create the READMEs.
For the creation, it is important to know that the Role Variables are created from the contents of meta/argument_specs.yml. So if anyone wants to add new defaults, these have to get into the argument_spec, too (Maybe add this to the CONTRIBUTING guide).

Alternatives

No response

Additional information

...

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

Successfully merging a pull request may close this issue.

1 participant