From a2b0a538b2998b3a835fc4a168c2a0c036c15bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Su=C3=A1rez=20Fern=C3=A1ndez?= <15276132+vicsufer@users.noreply.github.com> Date: Thu, 3 Dec 2020 09:52:35 +0100 Subject: [PATCH 01/12] Update {% raw %}.travis.yml{% endraw %} --- .../{% raw %}.travis.yml{% endraw %} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.app_name}}_role/{% raw %}.travis.yml{% endraw %} b/{{cookiecutter.app_name}}_role/{% raw %}.travis.yml{% endraw %} index 3330fa5..e14d6b9 100644 --- a/{{cookiecutter.app_name}}_role/{% raw %}.travis.yml{% endraw %} +++ b/{{cookiecutter.app_name}}_role/{% raw %}.travis.yml{% endraw %} @@ -13,7 +13,7 @@ env: {% if cookiecutter.debian_stretch_support == 'True' %}- MOLECULE_DISTRO=debian:stretch-slim{% endif %} {% if cookiecutter.debian_buster_support == 'True' %}- MOLECULE_DISTRO=debian:buster-slim{% endif %} script: - - pipenv run molecule test + - pipenv run molecule test --all notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file + webhooks: https://galaxy.ansible.com/api/v1/notifications/ From 035f88cd211ff813c34a7ccdf4c4409d412da9f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Su=C3=A1rez=20Fern=C3=A1ndez?= <15276132+vicsufer@users.noreply.github.com> Date: Mon, 28 Dec 2020 11:32:26 +0100 Subject: [PATCH 02/12] Bump goss to 0.16 --- {{cookiecutter.app_name}}_role/molecule/default/verify.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.app_name}}_role/molecule/default/verify.yml b/{{cookiecutter.app_name}}_role/molecule/default/verify.yml index b2dc65b..2a35a84 100644 --- a/{{cookiecutter.app_name}}_role/molecule/default/verify.yml +++ b/{{cookiecutter.app_name}}_role/molecule/default/verify.yml @@ -8,10 +8,10 @@ - {{ cookiecutter.app_name }} become: true vars: - goss_version: v0.3.14 + goss_version: v0.3.16 goss_arch: amd64 goss_dst: /usr/local/bin/goss - goss_sha256sum: 26c481073d346028451d56af600a71ec2d6c7bc960c3e207f610e32c5e1f5144 + goss_sha256sum: 827e354b48f93bce933f5efcd1f00dc82569c42a179cf2d384b040d8a80bfbfb goss_url: "https://github.com/aelsabbahy/goss/releases/download/{% raw %}{{{% endraw %} goss_version {% raw %}}}{% endraw %}/goss-linux-{% raw %}{{{% endraw %} goss_arch {% raw %}}}{% endraw %}" goss_test_directory: /tmp goss_format: documentation From 0a9343b5451a0215ea07e548d36556f8eb48521c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Su=C3=A1rez=20Fern=C3=A1ndez?= <15276132+vicsufer@users.noreply.github.com> Date: Mon, 28 Dec 2020 11:34:26 +0100 Subject: [PATCH 03/12] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaadc62..1a38d69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch ### Fixed ### Added ### Changed +- *[#47](https://github.com/idealista/cookiecutter-ansible-role/pull/47) Bump goss version from 0.3.14 to 0.3.16* @vicsufer ### Removed ## [2.3.0](https://github.com/idealista/cookiecutter-ansible-role/tree/2.3.0) From dfedd31efbd77edbda7e03635c52dbb00143e123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Su=C3=A1rez=20Fern=C3=A1ndez?= <15276132+vicsufer@users.noreply.github.com> Date: Mon, 28 Dec 2020 11:41:00 +0100 Subject: [PATCH 04/12] Update README.md --- {{cookiecutter.app_name}}_role/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.app_name}}_role/README.md b/{{cookiecutter.app_name}}_role/README.md index 99b5a85..e19fcc5 100644 --- a/{{cookiecutter.app_name}}_role/README.md +++ b/{{cookiecutter.app_name}}_role/README.md @@ -84,7 +84,7 @@ $ pipenv run molecule test ![Ansible](https://img.shields.io/badge/ansible-{{ cookiecutter.ansible_version }}-green.svg) ![Molecule](https://img.shields.io/badge/molecule-{{ cookiecutter.molecule_version }}-green.svg) -![Goss](https://img.shields.io/badge/goss-0.3.14-green.svg) +![Goss](https://img.shields.io/badge/goss-0.3.16-green.svg) ## Versioning From cceaac7b862156ec0e5b3191edf0d87911e6c3f0 Mon Sep 17 00:00:00 2001 From: Christian Ardiente Eda Date: Tue, 29 Dec 2020 10:20:26 +0100 Subject: [PATCH 05/12] [#46] Static tests instead of parameters --- CHANGELOG.md | 1 + .../molecule/default/tests/test_app.yml | 62 +++++++++---------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a38d69..5455832 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ 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 ### Removed ## [2.3.0](https://github.com/idealista/cookiecutter-ansible-role/tree/2.3.0) diff --git a/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml b/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml index 7b5b857..ed278f2 100644 --- a/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml +++ b/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml @@ -1,36 +1,36 @@ --- - -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 %}: - running: true -user: - {% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %}: - exists: true - groups: - - {% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %} - shell: /usr/sbin/nologin -group: - {% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}: - exists: true -{% endif %} \ No newline at end of file +## Goss Documentation: https://github.com/aelsabbahy/goss/blob/master/docs/manual.md +## Minimum recommended tests to have in every role +# process: +# exec_name: +# running: true +# user: +# example_user: +# exists: true +# groups: +# - example_group +# shell: /usr/sbin/nologin +# group: +# example_group: +# exists: true +# +## Tests to check if the needed directories were created propperly +# file: +# bin_path: +# owner: example_user +# group: % example_group +# exists: true +# filetype: directory +# +## Check if ports are really exposed +# port: +# # Check port at IPv6 +# # https://github.com/aelsabbahy/goss/issues/177 +# tcp6:: +# listening: true +# ip: +# - '::' From 3ea1b47038bc1b7b53c2dd527a3d678afca08949 Mon Sep 17 00:00:00 2001 From: Christian Ardiente Eda Date: Tue, 29 Dec 2020 11:41:27 +0100 Subject: [PATCH 06/12] [#46] Static tests instead of parameters --- CHANGELOG.md | 2 + README.md | 1 + cookiecutter.json | 3 +- test.sh | 2 +- {{cookiecutter.app_name}}_role/README.md | 2 +- .../defaults/main.yml | 2 +- .../molecule/default/tests/test_app.yml | 63 +++++++++++-------- 7 files changed, 44 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a38d69..639abd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index d2d88ad..14f94a9 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/cookiecutter.json b/cookiecutter.json index d82c50d..c5e397e 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -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":"" } diff --git a/test.sh b/test.sh index ca19a0c..7dd7e65 100755 --- a/test.sh +++ b/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 diff --git a/{{cookiecutter.app_name}}_role/README.md b/{{cookiecutter.app_name}}_role/README.md index e19fcc5..af2d679 100644 --- a/{{cookiecutter.app_name}}_role/README.md +++ b/{{cookiecutter.app_name}}_role/README.md @@ -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 %} diff --git a/{{cookiecutter.app_name}}_role/defaults/main.yml b/{{cookiecutter.app_name}}_role/defaults/main.yml index b483174..13f9995 100644 --- a/{{cookiecutter.app_name}}_role/defaults/main.yml +++ b/{{cookiecutter.app_name}}_role/defaults/main.yml @@ -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 diff --git a/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml b/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml index 7b5b857..1cb00ec 100644 --- a/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml +++ b/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml @@ -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 %}: running: true +process: + {{ 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 %}: - exists: true - groups: - - {% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %} - shell: /usr/sbin/nologin + exampleuser: + exists: true + groups: + - examplegroup + shell: /usr/sbin/nologin group: - {% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}: + examplegroup: exists: true -{% endif %} \ No newline at end of file +{% endif %} + +## Check if ports are really exposed +# port: +# # Check port at IPv6 +# # https://github.com/aelsabbahy/goss/issues/177 +# tcp6:: +# listening: true +# ip: +# - '::' From 747c7f30de11319a96242cb0de6d06e55a2cd246 Mon Sep 17 00:00:00 2001 From: Christian Ardiente Eda Date: Tue, 29 Dec 2020 11:45:32 +0100 Subject: [PATCH 07/12] Changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 639abd3..e67cf63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,10 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch ## Unreleased ### Fixed ### Added +- *[#45](https://github.com/idealista/cookiecutter-ansible-role/issues/45) Documentation link provided on role generation* @xtianae7 ### 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) From 52fc713404ef53697f17ea2800f913a04bd1fb80 Mon Sep 17 00:00:00 2001 From: Christian Ardiente Eda Date: Tue, 29 Dec 2020 11:54:54 +0100 Subject: [PATCH 08/12] [#46] refactoring --- .../molecule/default/tests/test_app.yml | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml b/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml index 1cb00ec..48fe58d 100644 --- a/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml +++ b/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml @@ -4,9 +4,20 @@ service: {{ cookiecutter.app_name }}: enabled: true running: true + process: {{ cookiecutter.exec_name }}: running: true + +user: + exampleuser: + exists: true + groups: + - examplegroup + shell: /usr/sbin/nologin +group: + examplegroup: + exists: true {% endif %} file: /opt/{{ cookiecutter.app_name }}: @@ -23,17 +34,6 @@ file: {% endif %} exists: true filetype: directory -{% if cookiecutter.has_service == 'True' %} -user: - exampleuser: - exists: true - groups: - - examplegroup - shell: /usr/sbin/nologin -group: - examplegroup: - exists: true -{% endif %} ## Check if ports are really exposed # port: From f2e385868d69d85e3204a0c23d730df8cab0339c Mon Sep 17 00:00:00 2001 From: Christian Ardiente Eda Date: Tue, 29 Dec 2020 15:36:13 +0100 Subject: [PATCH 09/12] Remainder to adapt goss tests --- .../molecule/default/tests/test_app.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml b/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml index 48fe58d..9f5dde4 100644 --- a/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml +++ b/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml @@ -1,4 +1,5 @@ --- +## TODO: Remember to adapt goss tests to your convinence {% if cookiecutter.has_service == 'True' %} service: {{ cookiecutter.app_name }}: From 87355636514d8cb90744a5f519be37f3491fd33a Mon Sep 17 00:00:00 2001 From: Christian Ardiente Eda Date: Tue, 29 Dec 2020 15:38:02 +0100 Subject: [PATCH 10/12] Update travis link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 14f94a9..8086ff9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Cookiecutter Ansible Role ![Logo](https://raw.githubusercontent.com/idealista/cookiecutter-ansible-role/master/logo.gif) -[![Build Status](https://travis-ci.org/idealista/cookiecutter-ansible-role.png)](https://travis-ci.org/idealista/cookiecutter-ansible-role) +[![Build Status](https://travis-ci.com/idealista/cookiecutter-ansible-role.png)](https://travis-ci.com/idealista/cookiecutter-ansible-role) From 41f5790f9aa0b6e70865d7f1bed850047214db69 Mon Sep 17 00:00:00 2001 From: Christian Ardiente Eda Date: Wed, 30 Dec 2020 11:14:13 +0100 Subject: [PATCH 11/12] typo --- .../molecule/default/tests/test_app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml b/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml index 9f5dde4..60cbadd 100644 --- a/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml +++ b/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml @@ -1,5 +1,5 @@ --- -## TODO: Remember to adapt goss tests to your convinence +## TODO: Remember to adapt goss tests to your convenience {% if cookiecutter.has_service == 'True' %} service: {{ cookiecutter.app_name }}: From 34f4edf4c93f601055d368fcb0c2c71b4a8e0c09 Mon Sep 17 00:00:00 2001 From: Christian Ardiente Date: Wed, 30 Dec 2020 11:57:47 +0100 Subject: [PATCH 12/12] Update CHANGELOG.md --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e67cf63..63a1217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,16 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch ## Unreleased ### Fixed ### Added +### Changed +### Removed + +## [2.4.0](https://github.com/idealista/cookiecutter-ansible-role/tree/2.4.0) +### [Full Changelog](https://github.com/idealista/cookiecutter-ansible-role/compare/2.3.0...2.4.0) +### Added - *[#45](https://github.com/idealista/cookiecutter-ansible-role/issues/45) Documentation link provided on role generation* @xtianae7 ### 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 -### Removed ## [2.3.0](https://github.com/idealista/cookiecutter-ansible-role/tree/2.3.0) ### [Full Changelog](https://github.com/idealista/cookiecutter-ansible-role/compare/2.2.0...2.3.0)