[#46] Static tests instead of parameters
This commit is contained in:
parent
21de58a20b
commit
3ea1b47038
@ -7,6 +7,8 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch
|
||||
### Added
|
||||
### Changed
|
||||
- *[#47](https://github.com/idealista/cookiecutter-ansible-role/pull/47) Bump goss version from 0.3.14 to 0.3.16* @vicsufer
|
||||
- *[#46](https://github.com/idealista/cookiecutter-ansible-role/issues/46) Static tests instead of parameters* @xtianae7
|
||||
- *[#45](https://github.com/idealista/cookiecutter-ansible-role/issues/45) Documentation link provided on role generation* @xtianae7
|
||||
### Removed
|
||||
|
||||
## [2.3.0](https://github.com/idealista/cookiecutter-ansible-role/tree/2.3.0)
|
||||
|
@ -79,6 +79,7 @@ Select has_templates:
|
||||
1 - True
|
||||
2 - False
|
||||
Choose from 1, 2 [1]:
|
||||
documentation_URL: https://cli.github.com/manual/
|
||||
```
|
||||
|
||||
It will create the following file structure:
|
||||
|
@ -21,5 +21,6 @@
|
||||
"has_files":["True", "False"],
|
||||
"comment_2":"If there is service the following options will not have any effect",
|
||||
"has_handlers":["True", "False"],
|
||||
"has_templates":["True", "False"]
|
||||
"has_templates":["True", "False"],
|
||||
"documentation_URL":""
|
||||
}
|
||||
|
2
test.sh
2
test.sh
@ -3,7 +3,7 @@
|
||||
set -e
|
||||
|
||||
# Generate role
|
||||
printf "cookiecutter==1.7.2\nJinja2==2.11.2" > requirements.txt && pipenv install -r requirements.txt && pipenv run cookiecutter . --no-input app_name="github_cli" exec_name="gh" author="John Doe" min_ansible_version="2.2" ansible_version="2.8.6" molecule_version="3.0.1" python_docker_version="4.1.0" ansible_lint_version="4.2.0" has_service="False" has_files="False" has_handlers="False" has_templates="False" && rm Pipfile* requirements.txt
|
||||
printf "cookiecutter==1.7.2\nJinja2==2.11.2" > requirements.txt && pipenv install -r requirements.txt && pipenv run cookiecutter . --no-input app_name="github_cli" exec_name="gh" author="John Doe" min_ansible_version="2.2" ansible_version="2.8.6" molecule_version="3.0.1" python_docker_version="4.1.0" ansible_lint_version="4.2.0" has_service="False" has_files="False" has_handlers="False" has_templates="False" documentation_URL="https://cli.github.com/manual/" && rm Pipfile* requirements.txt
|
||||
(
|
||||
# Adjust the role to test
|
||||
cd github_cli_role
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
|
||||
This ansible role installs [{{ cookiecutter.app_name | replace('_',' ') | title }}](APP_URL_HERE) in a Debian environment. It has been tested for the following Debian versions:
|
||||
This ansible role installs {% if cookiecutter.documentation_URL != "" %}[{% endif %}{{ cookiecutter.app_name | replace('_',' ') | title }}{% if cookiecutter.documentation_URL != "" %}]({{ cookiecutter.documentation_URL }}){% endif %} in a Debian environment. It has been tested for the following Debian versions:
|
||||
{% if cookiecutter.debian_stretch_support == 'True' %}* Stretch{% endif %}
|
||||
{% if cookiecutter.debian_buster_support == 'True' %}* Buster{% endif %}
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
{% if cookiecutter.has_service == 'True' %}
|
||||
## Service options
|
||||
# Documentation
|
||||
{{ cookiecutter.app_name }}_documentation_link: https://www.example.documentation.com
|
||||
{{ cookiecutter.app_name }}_documentation_link: "{{ cookiecutter.documentation_URL }}"
|
||||
|
||||
# Owner
|
||||
{{ cookiecutter.app_name }}_user: exampleuser
|
||||
|
@ -1,36 +1,45 @@
|
||||
---
|
||||
|
||||
file:
|
||||
{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_bin_path {% raw %}}}{% endraw %}:
|
||||
{% if cookiecutter.has_service == 'True' %}
|
||||
owner: {% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %}
|
||||
group: {% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}
|
||||
{% endif %}
|
||||
exists: true
|
||||
filetype: directory
|
||||
{% if cookiecutter.has_service == 'True' %}
|
||||
# port:
|
||||
# # Check port at IPv6
|
||||
# # https://github.com/aelsabbahy/goss/issues/177
|
||||
# tcp6:{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_port {% raw %}}}{% endraw %}:
|
||||
# listening: true
|
||||
# ip:
|
||||
# - '::'
|
||||
|
||||
service:
|
||||
{{ cookiecutter.app_name }}:
|
||||
enabled: true
|
||||
running: true
|
||||
process:
|
||||
{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %}:
|
||||
{{ cookiecutter.exec_name }}:
|
||||
running: true
|
||||
{% endif %}
|
||||
file:
|
||||
/opt/{{ cookiecutter.app_name }}:
|
||||
{% if cookiecutter.has_service == 'True' %}
|
||||
owner: exampleuser
|
||||
group: examplegroup
|
||||
{% endif %}
|
||||
exists: true
|
||||
filetype: directory
|
||||
/opt/{{ cookiecutter.app_name }}/bin:
|
||||
{% if cookiecutter.has_service == 'True' %}
|
||||
owner: exampleuser
|
||||
group: examplegroup
|
||||
{% endif %}
|
||||
exists: true
|
||||
filetype: directory
|
||||
{% if cookiecutter.has_service == 'True' %}
|
||||
user:
|
||||
{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %}:
|
||||
exampleuser:
|
||||
exists: true
|
||||
groups:
|
||||
- {% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}
|
||||
- examplegroup
|
||||
shell: /usr/sbin/nologin
|
||||
group:
|
||||
{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}:
|
||||
examplegroup:
|
||||
exists: true
|
||||
{% endif %}
|
||||
|
||||
## Check if ports are really exposed
|
||||
# port:
|
||||
# # Check port at IPv6
|
||||
# # https://github.com/aelsabbahy/goss/issues/177
|
||||
# tcp6:<port>:
|
||||
# listening: true
|
||||
# ip:
|
||||
# - '::'
|
||||
|
Loading…
Reference in New Issue
Block a user