From 25ab020dbb34b742172b6fd6a992abbbc5cebf22 Mon Sep 17 00:00:00 2001 From: Robert de Bock Date: Sat, 14 Jan 2023 10:08:42 +0100 Subject: [PATCH] Better README. --- templates/README.md.j2 | 14 +++++++------- vars/main.yml | 13 +++++++++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/templates/README.md.j2 b/templates/README.md.j2 index b946996..3274c4a 100644 --- a/templates/README.md.j2 +++ b/templates/README.md.j2 @@ -4,17 +4,17 @@ |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) -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 {{ example.content | b64decode | regex_replace('ansible-role-', galaxy_namespace ~ '.') }}``` {% 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 {{ 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 %} ## [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 {{ 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 | |-------------|--------|--------| {% 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 %} {% endif %} @@ -71,7 +71,7 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| {% 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 %} 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) -{{ meta.galaxy_info.license }} +[{{ meta.galaxy_info.license }}](https://github.com/{{ github_namespace }}/ansible-role-{{ role_name }}/blob/master/LICENSE). ## [Author Information](#author-information) diff --git a/vars/main.yml b/vars/main.yml index 7e7fc13..355b029 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -15,6 +15,9 @@ galaxy_namespace: robertdebock # Your username/organization name on GitHub. github_namespace: robertdebock +# Your username/group on GitLab. +gitlab_namespace: robertdebock-iac + # Your name and optionally email-address. author: Robert de Bock (robert@meinit.nl) @@ -31,6 +34,16 @@ platform_image_mapping: opensuse: opensuse 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. distribution_version_mapping: Alpine: