Many small fixes.

This commit is contained in:
Robert de Bock 2020-11-03 15:49:20 +01:00
parent f0358c18aa
commit 472e5d3cfb
3 changed files with 21 additions and 27 deletions

View File

@ -73,19 +73,12 @@
register: check_requirements register: check_requirements
- name: load requirements.yml - name: load requirements.yml
slurp: include_vars:
src: "{{ role_path }}/requirements.yml" file: "{{ role_path }}/requirements.yml"
register: requirements name: requirements
when: when:
- check_requirements.stat.exists | bool - check_requirements.stat.exists | bool
- name: set no requirements when none exist
set_fact:
requirements:
content: "{{ '- none' | b64encode }}"
when:
- not check_requirements.stat.exists
- name: load molecule/default/converge.yml - name: load molecule/default/converge.yml
slurp: slurp:
src: "{{ role_path }}/molecule/default/converge.yml" src: "{{ role_path }}/molecule/default/converge.yml"
@ -210,3 +203,8 @@
dest: .github/workflows/galaxy.yml dest: .github/workflows/galaxy.yml
loop_control: loop_control:
label: "{{ item.source }}" label: "{{ item.source }}"
- name: pre-commit install
command: pre-commit install
args:
creates: .git/hooks/pre-commit

View File

@ -12,21 +12,12 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea
```yaml ```yaml
{{ example.content | b64decode | regex_replace('ansible-role-', galaxy_namespace ~ '.') }}``` {{ example.content | b64decode | regex_replace('ansible-role-', galaxy_namespace ~ '.') }}```
The machine may need to be prepared using `molecule/resources/prepare.yml`:
```yaml
{% if prepare.content is defined %} {% if prepare.content is defined %}
{{ prepare.content | b64decode | regex_replace('ansible-role-', galaxy_namespace ~ '.') }}``` The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`:
{% else %}
No preparation required.
```
{% endif %}
{% if verifyyml.content is defined %}
For verification `molecule/resources/verify.yml` runs after the role has been applied.
```yaml ```yaml
{{ verifyyml.content | b64decode | regex_replace('ansible-role-', galaxy_namespace ~ '.') }}``` {{ prepare.content | b64decode | regex_replace('ansible-role-', galaxy_namespace ~ '.') }}```
{% endif %}
{% endif %}
Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles.
{% if variables.content is defined %} {% if variables.content is defined %}
@ -42,11 +33,15 @@ These variables are set in `defaults/main.yml`:
- Access to a repository containing packages, likely on the internet. - Access to a repository containing packages, likely on the internet.
- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) - A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.)
The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: {% if requirements is defined %}
## [Status of requirements](#status-of-requirements)
```yaml | Requirement | Travis | GitHub |
{{ requirements.content | b64decode }} |-------------|--------|--------|
``` {% for requirement in requirements.roles %}
| [{{ requirement.name }}](https://galaxy.ansible.com/{{ github_namespace }}/{{ requirement.name | regex_replace(github_namespace + '\.') }}) | [![Build Status Travis](https://travis-ci.com/{{ github_namespace }}/{{ requirement.name | regex_replace(github_namespace + '\.', 'ansible-role-') }}.svg?branch=master)](https://travis-ci.com/{{ github_namespace }}/{{ requirement.name | regex_replace(github_namespace + '\.', 'ansible-role-') }}) | [![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) |
{% endfor %}
{% endif %}
{% if meta.dependencies %} {% if meta.dependencies %}
## [Dependencies](#dependencies) ## [Dependencies](#dependencies)
@ -138,6 +133,7 @@ image="debian" tag="stable" tox
{{ meta.galaxy_info.license }} {{ meta.galaxy_info.license }}
{% if github_contributors is defined %}
{% if github_contributors.json | length > 1 %} {% if github_contributors.json | length > 1 %}
## [Contributors](#contributors) ## [Contributors](#contributors)
@ -148,6 +144,7 @@ I'd like to thank everybody that made contributions to this repository. It motiv
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %}
## [Author Information](#author-information) ## [Author Information](#author-information)

View File

@ -36,7 +36,6 @@ distribution_version_mapping:
Alpine: Alpine:
all: all:
- latest - latest
- edge
Amazon: Amazon:
all: all:
- 1 - 1