# {{rolename}}

{% if repoowner != '' or reponame != "" %}[![Maintainer](https://img.shields.io/badge/maintained%20by-{{ repoowner }}-e00000?style=flat-square)](https://www.{{ repoowner }}.fr/)
[![License](https://img.shields.io/github/license/{{ repoowner }}/{{ reponame }}?style=flat-square)](https://github.com/{{ repoowner }}/{{ reponame }}/blob/main/LICENSE)
[![Release](https://img.shields.io/github/v/release/{{ repoowner }}/{{ reponame }}?style=flat-square)](https://github.com/{{ repoowner }}/{{ reponame }}/releases)
[![Status](https://img.shields.io/github/workflow/status/{{ repoowner }}/{{ reponame }}/Ansible%20Molecule?style=flat-square&label=tests)](https://github.com/{{ repoowner }}/{{ reponame }}/actions?query=workflow%3A%22Ansible+Molecule%22)
[![Ansible Galaxy](https://img.shields.io/badge/ansible-galaxy-black.svg?style=flat-square&logo=ansible)](https://galaxy.ansible.com/{{ repoowner }}/{{ role_meta_vars['galaxy_info']['role_name'] }}){% endif %}
[![Ansible version](https://img.shields.io/badge/ansible-%3E%3D2.10-black.svg?style=flat-square&logo=ansible)](https://github.com/ansible/ansible)

⭐ Star us on GitHub — it motivates us a lot!

{{role_meta_vars['galaxy_info']['description']}}

**Platforms Supported**:

{% if role_meta_vars['galaxy_info']['platforms'] is defined and role_meta_vars['galaxy_info']['platforms']|length() %}
| Platform | Versions   |
|----------|------------|
{% for platform in role_meta_vars['galaxy_info']['platforms'] %}
| {{ platform['name'] }} | {{  platform['versions']|join(', ') }} |
{% endfor %}
{% else %}
None.
{% endif %}

## ⚠️ Requirements

Ansible >= {{role_meta_vars['galaxy_info']['min_ansible_version']}}.

### Ansible role dependencies

{% if role_meta_vars['dependencies'] is defined and role_meta_vars['dependencies']|length() %}
{% for dependencie in role_meta_vars['dependencies'] %}
  * {{dependencie}}
{% endfor %}
{% else %}
None.
{% endif %}

## ⚡ Installation

### Install with Ansible Galaxy

```shell
ansible-galaxy install {{rolename}}
```
### Install with git

If you do not want a global installation, clone it into your `roles_path`.

```bash
git clone {{ repourl }}  {{ rolename }}
```

But I often add it as a submodule in a given `playbook_dir` repository.

```bash
git submodule add {{ repourl }} roles/{{rolename}}
```

As the role is not managed by Ansible Galaxy, you do not have to specify the
github user account.

### ✏️ Example Playbook

Basic usage is:

```yaml
- hosts: all
  roles:
    - role: {{rolename}}
{% if role_defaults_files |length > 0 and role_defaults_files[0]['content'] is not none %}
      vars:
{% for string_role_defaults_file in string_role_defaults_files %}
        {{ string_role_defaults_file['content'] | replace ('\n', '\n        ') }}
{% endfor %}
{% endif %}
```

{# role vars #}
{% if role_vars_files is not none or role_defaults_files is not none %}
## ⚙️ Role Variables

Variables are divided in three types.

The **default vars** section shows you which variables you may
override in your ansible inventory. As a matter of fact, all variables should
be defined there for explicitness, ease of documentation as well as overall
role manageability.

The **context variables** are shown in section below hint you
on how runtime context may affects role execution.

{% if role_defaults_files is not none %}
### Default variables

{% for role_defaults_file in role_defaults_files %}
Role default variables from `defaults/{{role_defaults_file['filename']}}`.

{% if role_defaults_file['content'] != None %}
| Variable Name | Value |
|---------------|-------|
{% for key,value in role_defaults_file['content'].items() %}
| {{ key }} | {{ value|safe|replace('|',' \|')|replace('\n','<br>') }} |
{% endfor %}
{% endif %}
{% endfor %}
{% else %}
None.
{% endif %}

### Context variables

{% if role_vars_files != [] %}
Those variables from `vars/*.{yml,json}` are loaded dynamically during task
runtime using the `include_vars` module.
{% for role_vars_file in role_vars_files %}

Variables loaded from `vars/{{role_vars_file['filename']}}`.

{% if role_vars_file['content'] != None %}
| Variable Name | Value |
|---------------|-------|
{% for key,value in role_vars_file['content'].items() %}
| {{ key }} | {{ value|safe | replace('|',' \|')|replace('\n','<br>') }} |
{% endfor %}
{% endif %}
{% endfor %}
{% else %}
None.

{% endif %}
{% endif %}

{% if role_meta_vars['galaxy_info']['license'] is defined %}

{# usage guide // doc from md files #}
{% if role_docs_md_files is not none %}
{% for role_docs_md_file in role_docs_md_files %}
{% if 'README' not in role_docs_md_file['filename'] %}
{{role_docs_md_file['content']}}
{% endif %}
{% if loop.length > 1 %}
{% endif %}
{% endfor %}
{% endif %}

{% endif %}
## Author Information

{{ role_meta_vars['galaxy_info']['company'] }}
