From 92e30ec9ac3828f69410fd6458ef4d62e6b8a860 Mon Sep 17 00:00:00 2001 From: Alejandro Blanco Lopez Date: Fri, 20 Aug 2021 15:21:51 +0200 Subject: [PATCH 1/6] #79 add molecule-docker support --- CHANGELOG.md | 3 +++ cookiecutter.json | 1 + {{cookiecutter.app_name}}_role/test-requirements.txt | 1 + 3 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c260c1c..9c25f06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog). ## Unreleased +### Added +- *[#79](https://github.com/idealista/cookiecutter-ansible-role/issues/79) Add molecule-docker support* @blalop + ## [2.7.0](https://github.com/idealista/cookiecutter-ansible-role/tree/2.7.0) ### [Full Changelog](https://github.com/idealista/cookiecutter-ansible-role/compare/2.6.1...2.7.0) ### Added diff --git a/cookiecutter.json b/cookiecutter.json index c5e397e..1d3ac3b 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -10,6 +10,7 @@ "ansible_version": "", "molecule_version": "", "python_docker_version": "", + "molecule_docker_version": "", "ansible_lint_version":"", "license":"Apache 2.0", "galaxy_tag_1":"example_tag1", diff --git a/{{cookiecutter.app_name}}_role/test-requirements.txt b/{{cookiecutter.app_name}}_role/test-requirements.txt index c30c500..fd772c1 100644 --- a/{{cookiecutter.app_name}}_role/test-requirements.txt +++ b/{{cookiecutter.app_name}}_role/test-requirements.txt @@ -1,4 +1,5 @@ ansible=={{ cookiecutter.ansible_version }} molecule=={{ cookiecutter.molecule_version }} docker=={{ cookiecutter.python_docker_version }} +molecule-docker=={{ cookiecutter.molecule_docker_version }} ansible-lint=={{ cookiecutter.ansible_lint_version }} \ No newline at end of file From ed6eb9ff292149561ac960c9cbf784ee38937e82 Mon Sep 17 00:00:00 2001 From: Alejandro Blanco Lopez Date: Fri, 20 Aug 2021 15:34:03 +0200 Subject: [PATCH 2/6] #79 update testing versions --- test.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 7dd7e65..dfc090a 100755 --- a/test.sh +++ b/test.sh @@ -3,7 +3,22 @@ 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" documentation_URL="https://cli.github.com/manual/" && 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="4.4.0" \ + molecule_version="3.4.0" \ + python_docker_version="5.0.0" \ + molecule_docker_version="0.2.4" \ + ansible_lint_version="5.1.2" \ + 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 From 14ae8d9e1443f27e286cd7561eb027123584e882 Mon Sep 17 00:00:00 2001 From: Alejandro Blanco Lopez Date: Mon, 23 Aug 2021 08:48:43 +0200 Subject: [PATCH 3/6] #79 add default pip versions --- CHANGELOG.md | 1 + cookiecutter.json | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c25f06..9a40865 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch ## Unreleased ### Added - *[#79](https://github.com/idealista/cookiecutter-ansible-role/issues/79) Add molecule-docker support* @blalop +- *[#79](https://github.com/idealista/cookiecutter-ansible-role/issues/79) Add default versions for Python packages* @blalop ## [2.7.0](https://github.com/idealista/cookiecutter-ansible-role/tree/2.7.0) ### [Full Changelog](https://github.com/idealista/cookiecutter-ansible-role/compare/2.6.1...2.7.0) diff --git a/cookiecutter.json b/cookiecutter.json index 1d3ac3b..4ef4152 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -7,11 +7,11 @@ "company": "Idealista S.A.U.", "author": "", "min_ansible_version": "", - "ansible_version": "", - "molecule_version": "", - "python_docker_version": "", - "molecule_docker_version": "", - "ansible_lint_version":"", + "ansible_version": "4.4.0", + "molecule_version": "3.4.0", + "python_docker_version": "5.0.0", + "molecule_docker_version": "0.2.4", + "ansible_lint_version":"5.1.2", "license":"Apache 2.0", "galaxy_tag_1":"example_tag1", "galaxy_tag_2":"example_tag2", From 07f9750241cf54ba9e7295c0057c08d4c14e0a30 Mon Sep 17 00:00:00 2001 From: Alejandro Blanco Lopez Date: Mon, 23 Aug 2021 09:05:51 +0200 Subject: [PATCH 4/6] #81 add log path variable in defaults --- CHANGELOG.md | 2 ++ {{cookiecutter.app_name}}_role/defaults/main.yml | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c260c1c..ccb116f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog). ## Unreleased +- *[#81](https://github.com/idealista/cookiecutter-ansible-role/issues/81) Add log path variable in defaults* @blalop + ## [2.7.0](https://github.com/idealista/cookiecutter-ansible-role/tree/2.7.0) ### [Full Changelog](https://github.com/idealista/cookiecutter-ansible-role/compare/2.6.1...2.7.0) ### Added diff --git a/{{cookiecutter.app_name}}_role/defaults/main.yml b/{{cookiecutter.app_name}}_role/defaults/main.yml index 6b0bf9b..1d029c6 100644 --- a/{{cookiecutter.app_name}}_role/defaults/main.yml +++ b/{{cookiecutter.app_name}}_role/defaults/main.yml @@ -45,7 +45,8 @@ # Logs # If wanted to output the logs to a file define the following variable # More information at https://www.freedesktop.org/software/systemd/man/systemd.exec.html#StandardOutput= -# {{ cookiecutter.app_name }}_log_file: path_of_the_file +# {{ cookiecutter.app_name }}_log_path: /var/log +# {{ cookiecutter.app_name }}_log_file: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_log_path {% raw %}}}{% endraw %}/{{ cookiecutter.app_name }}.log" {{ cookiecutter.app_name }}_log_output: "{% raw %}{%{% endraw %} if {{ cookiecutter.app_name }}_log_file is defined {% raw %}%}{% endraw %} file:{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_log_file {% raw %}}}{% endraw %} {% raw %}{%{% endraw %} else {% raw %}%}{% endraw %} journal {% raw %}{%{% endraw %} endif {% raw %}%}{% endraw %}" # Flags From c9e2a831630755924dfd56808cecdc8189026f6f Mon Sep 17 00:00:00 2001 From: Alejandro Blanco Lopez Date: Tue, 24 Aug 2021 12:12:44 +0200 Subject: [PATCH 5/6] #83 don't leave empty lines when using jinja --- CHANGELOG.md | 1 + .../molecule/default/tests/test_app.yml | 8 ++++---- {{cookiecutter.app_name}}_role/tasks/install.yml | 12 ++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d06df22..bd3f1c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch - *[#81](https://github.com/idealista/cookiecutter-ansible-role/issues/81) Add log path variable in defaults* @blalop - *[#79](https://github.com/idealista/cookiecutter-ansible-role/issues/79) Add molecule-docker support* @blalop - *[#79](https://github.com/idealista/cookiecutter-ansible-role/issues/79) Add default versions for Python packages* @blalop +- *[#83](https://github.com/idealista/cookiecutter-ansible-role/issues/83) Don't leave empty lines when using jinja* @blalop ## [2.7.0](https://github.com/idealista/cookiecutter-ansible-role/tree/2.7.0) ### [Full Changelog](https://github.com/idealista/cookiecutter-ansible-role/compare/2.6.1...2.7.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 60cbadd..f2bd937 100644 --- a/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml +++ b/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml @@ -22,17 +22,17 @@ group: {% endif %} file: /opt/{{ cookiecutter.app_name }}: - {% if cookiecutter.has_service == 'True' %} + {%- if cookiecutter.has_service == 'True' %} owner: exampleuser group: examplegroup - {% endif %} + {%- endif %} exists: true filetype: directory /opt/{{ cookiecutter.app_name }}/bin: - {% if cookiecutter.has_service == 'True' %} + {%- if cookiecutter.has_service == 'True' %} owner: exampleuser group: examplegroup - {% endif %} + {%- endif %} exists: true filetype: directory diff --git a/{{cookiecutter.app_name}}_role/tasks/install.yml b/{{cookiecutter.app_name}}_role/tasks/install.yml index 8a60374..0ffea00 100644 --- a/{{cookiecutter.app_name}}_role/tasks/install.yml +++ b/{{cookiecutter.app_name}}_role/tasks/install.yml @@ -21,10 +21,10 @@ - name: {{ cookiecutter.app_name | upper }} | Ensure skeleton paths file: dest: "{% raw %}{{{% endraw %} item {% raw %}}}{% endraw %}" -{% if cookiecutter.has_service == 'True' %} +{%- if cookiecutter.has_service == 'True' %} owner: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %}" group: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}" -{% endif %} +{%- endif %} state: directory with_items: - "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_skeleton_paths {% raw %}}}{% endraw %}" @@ -34,10 +34,10 @@ - name: {{ cookiecutter.app_name | upper }} | Ensure skeleton log paths file: dest: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_log_path {% raw %}}}{% endraw %}" -{% if cookiecutter.has_service == 'True' %} +{%- if cookiecutter.has_service == 'True' %} owner: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %}" group: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}" -{% endif %} +{%- endif %} state: directory when: {{ cookiecutter.app_name }}_log_file is defined tags: @@ -73,10 +73,10 @@ copy: src: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_src_bin {% raw %}}}{% endraw %}" dest: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_bin_path {% raw %}}}{% endraw %}/{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %}" -{% if cookiecutter.has_service == 'True' %} +{%- if cookiecutter.has_service == 'True' %} owner: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %}" group: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}" -{% endif %} +{%- endif %} remote_src: True mode: 0755 when: {{ cookiecutter.app_name }}_force_reinstall or {{ cookiecutter.app_name }}_check is failed or {{ cookiecutter.app_name }}_version not in {{ cookiecutter.app_name }}_check.stderr From 23d2def9668ef30b9d3827ad0a9bb07794d7d26c Mon Sep 17 00:00:00 2001 From: Alex Blanco Date: Tue, 24 Aug 2021 12:51:41 +0200 Subject: [PATCH 6/6] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd3f1c1..d94e450 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog). ## Unreleased + + +## [2.8.0](https://github.com/idealista/cookiecutter-ansible-role/tree/2.8.0) +### [Full Changelog](https://github.com/idealista/cookiecutter-ansible-role/compare/2.7.0...2.8.0) ### Added - *[#81](https://github.com/idealista/cookiecutter-ansible-role/issues/81) Add log path variable in defaults* @blalop - *[#79](https://github.com/idealista/cookiecutter-ansible-role/issues/79) Add molecule-docker support* @blalop