Better README.

This commit is contained in:
Robert de Bock 2023-01-14 10:08:42 +01:00
parent e2a95426a0
commit 25ab020dbb
2 changed files with 20 additions and 7 deletions

View File

@ -4,17 +4,17 @@
|GitHub|GitLab|Quality|Downloads|Version| |GitHub|GitLab|Quality|Downloads|Version|
|------|------|-------|---------|-------| |------|------|-------|---------|-------|
|[![github](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/workflows/Ansible%20Molecule/badge.svg)](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/actions)|[![gitlab](https://gitlab.com/{{ github_namespace }}/ansible-role-{{ role_name }}/badges/master/pipeline.svg)](https://gitlab.com/{{ github_namespace }}/ansible-role-{{ role_name }})|[![quality](https://img.shields.io/ansible/quality/{{ galaxy_id.stdout | default('unset') }})](https://galaxy.ansible.com/{{ github_namespace }}/{{ role_name }})|[![downloads](https://img.shields.io/ansible/role/d/{{ galaxy_id.stdout |default('unset') }})](https://galaxy.ansible.com/{{ github_namespace }}/{{ role_name }})|[![Version](https://img.shields.io/github/release/{{ github_namespace }}/ansible-role-{{ role_name }}.svg)](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/releases/)| |[![github](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/workflows/Ansible%20Molecule/badge.svg)](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/actions)|[![gitlab](https://gitlab.com/{{ gitlab_namespace }}/ansible-role-{{ role_name }}/badges/master/pipeline.svg)](https://gitlab.com/{{ gitlab_namespace }}/ansible-role-{{ role_name }})|[![quality](https://img.shields.io/ansible/quality/{{ galaxy_id.stdout | default('unset') }})](https://galaxy.ansible.com/{{ github_namespace }}/{{ role_name }})|[![downloads](https://img.shields.io/ansible/role/d/{{ galaxy_id.stdout |default('unset') }})](https://galaxy.ansible.com/{{ github_namespace }}/{{ role_name }})|[![Version](https://img.shields.io/github/release/{{ github_namespace }}/ansible-role-{{ role_name }}.svg)](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/releases/)|
## [Example Playbook](#example-playbook) ## [Example Playbook](#example-playbook)
This example is taken from `molecule/default/converge.yml` and is tested on each push, pull request and release. This example is taken from [`molecule/default/converge.yml`](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/blob/master/molecule/default/converge.yml) and is tested on each push, pull request and release.
```yaml ```yaml
{{ example.content | b64decode | regex_replace('ansible-role-', galaxy_namespace ~ '.') }}``` {{ example.content | b64decode | regex_replace('ansible-role-', galaxy_namespace ~ '.') }}```
{% if prepare.content is defined %} {% if prepare.content is defined %}
The machine needs to be prepared. In CI this is done using `molecule/default/prepare.yml`: The machine needs to be prepared. In CI this is done using [`molecule/default/prepare.yml`](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/blob/master/molecule/default/prepare.yml):
```yaml ```yaml
{{ prepare.content | b64decode | regex_replace('ansible-role-', galaxy_namespace ~ '.') }}``` {{ prepare.content | b64decode | regex_replace('ansible-role-', galaxy_namespace ~ '.') }}```
@ -25,7 +25,7 @@ Also see a [full explanation and example](https://robertdebock.nl/how-to-use-the
{% if variables.content is defined %} {% if variables.content is defined %}
## [Role Variables](#role-variables) ## [Role Variables](#role-variables)
The default values for the variables are set in `defaults/main.yml`: The default values for the variables are set in [`defaults/main.yml`](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/blob/master/defaults/main.yml):
```yaml ```yaml
{{ variables.content | b64decode }}``` {{ variables.content | b64decode }}```
@ -43,7 +43,7 @@ The following roles are used to prepare a system. You can prepare your system in
| Requirement | GitHub | GitLab | | Requirement | GitHub | GitLab |
|-------------|--------|--------| |-------------|--------|--------|
{% for requirement in requirements.roles %} {% for requirement in requirements.roles %}
|[{{ requirement.name }}](https://galaxy.ansible.com/{{ github_namespace }}/{{ requirement.name | regex_replace(github_namespace + '\.') }})|[![Build Status GitHub](https://github.com/{{ github_namespace }}/{{ requirement.name | regex_replace(github_namespace + '\.', 'ansible-role-') }}/workflows/Ansible%20Molecule/badge.svg)](https://github.com/{{ github_namespace }}/{{ requirement.name | regex_replace(github_namespace + '\.', 'ansible-role-') }}/actions)|[![Build Status GitLab](https://gitlab.com/{{ github_namespace }}/{{ requirement.name | regex_replace(github_namespace + '\.', 'ansible-role-') }}/badges/master/pipeline.svg)](https://gitlab.com/{{ github_namespace }}/{{ requirement.name | regex_replace(github_namespace + '\.', 'ansible-role-') }})| |[{{ requirement.name }}](https://galaxy.ansible.com/{{ github_namespace }}/{{ requirement.name | regex_replace(github_namespace + '\.') }})|[![Build Status GitHub](https://github.com/{{ github_namespace }}/{{ requirement.name | regex_replace(github_namespace + '\.', 'ansible-role-') }}/workflows/Ansible%20Molecule/badge.svg)](https://github.com/{{ github_namespace }}/{{ requirement.name | regex_replace(github_namespace + '\.', 'ansible-role-') }}/actions)|[![Build Status GitLab](https://gitlab.com/{{ gitlab_namespace }}/{{ requirement.name | regex_replace(galaxy_namespace + '\.', 'ansible-role-') }}/badges/master/pipeline.svg)](https://gitlab.com/{{ gitlab_namespace }}/{{ requirement.name | regex_replace(galaxy_namespace + '\.', 'ansible-role-') }})|
{% endfor %} {% endfor %}
{% endif %} {% endif %}
@ -71,7 +71,7 @@ This role has been tested on these [container images](https://hub.docker.com/u/r
|container|tags| |container|tags|
|---------|----| |---------|----|
{% for platform in meta.galaxy_info.platforms %} {% for platform in meta.galaxy_info.platforms %}
|{{ platform.name | lower }}|{% for version in platform.versions %}{{ version }}{% if not loop.last %}, {% endif %}{% endfor %}| |[{{ platform.name }}]({{ image_docker_hub_url_mapping[platform.name | lower] }})|{% for version in platform.versions %}{{ version }}{% if not loop.last %}, {% endif %}{% endfor %}|
{% endfor %} {% endfor %}
The minimum version of Ansible required is {{ meta.galaxy_info.min_ansible_version }}, tests have been done to: The minimum version of Ansible required is {{ meta.galaxy_info.min_ansible_version }}, tests have been done to:
@ -84,7 +84,7 @@ If you find issues, please register them in [GitHub](https://github.com/{{ githu
## [License](#license) ## [License](#license)
{{ meta.galaxy_info.license }} [{{ meta.galaxy_info.license }}](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/blob/master/LICENSE).
## [Author Information](#author-information) ## [Author Information](#author-information)

View File

@ -15,6 +15,9 @@ galaxy_namespace: robertdebock
# Your username/organization name on GitHub. # Your username/organization name on GitHub.
github_namespace: robertdebock github_namespace: robertdebock
# Your username/group on GitLab.
gitlab_namespace: robertdebock-iac
# Your name and optionally email-address. # Your name and optionally email-address.
author: Robert de Bock (robert@meinit.nl) author: Robert de Bock (robert@meinit.nl)
@ -31,6 +34,16 @@ platform_image_mapping:
opensuse: opensuse opensuse: opensuse
Ubuntu: ubuntu Ubuntu: ubuntu
image_docker_hub_url_mapping:
alpine: "https://hub.docker.com/repository/docker/robertdebock/alpine/general"
amazon: "https://hub.docker.com/repository/docker/robertdebock/amazonlinux/general"
archlinux: "https://hub.docker.com/repository/docker/robertdebock/archlinux/general"
debian: "https://hub.docker.com/repository/docker/robertdebock/debian/general"
el: "https://hub.docker.com/repository/docker/robertdebock/enterpriselinux/general"
fedora: "https://hub.docker.com/repository/docker/robertdebock/fedora/general"
opensuse: "https://hub.docker.com/repository/docker/robertdebock/opensuse/general"
ubuntu: "https://hub.docker.com/repository/docker/robertdebock/ubuntu/general"
# This maps the Galaxy distribution and version to Docker images. # This maps the Galaxy distribution and version to Docker images.
distribution_version_mapping: distribution_version_mapping:
Alpine: Alpine: