forked from Mirrors/cookiecutter-ansible-role
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bfb05f9f7e | ||
|
|
2a4c935222 | ||
|
|
fc1c881864 | ||
|
|
29fef2078c | ||
|
|
3cb19fc4d9 | ||
|
|
a3fb7e6a37 | ||
|
|
602f6e5953 | ||
|
|
34f4edf4c9 | ||
|
|
0b139944f6 | ||
|
|
41f5790f9a | ||
|
|
8735563651 | ||
|
|
f2e385868d | ||
|
|
52fc713404 | ||
|
|
747c7f30de | ||
|
|
e5782c903a | ||
|
|
3ea1b47038 | ||
|
|
cceaac7b86 | ||
|
|
21de58a20b | ||
|
|
376996d273 | ||
|
|
dfedd31efb | ||
|
|
0a9343b545 | ||
|
|
035f88cd21 | ||
|
|
8e687b3d68 | ||
|
|
a2b0a538b2 |
15
CHANGELOG.md
15
CHANGELOG.md
@@ -3,11 +3,24 @@ 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).
|
This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog).
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
### Fixed
|
|
||||||
### Added
|
### Added
|
||||||
### Changed
|
### Changed
|
||||||
|
### Fixed
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
## [2.4.1](https://github.com/idealista/cookiecutter-ansible-role/tree/2.4.1)
|
||||||
|
### [Full Changelog](https://github.com/idealista/cookiecutter-ansible-role/compare/2.4.0...2.4.1)
|
||||||
|
### Fixed
|
||||||
|
- *[#50](https://github.com/idealista/cookiecutter-ansible-role/issues/50) Tags not applied properly from playbook* @vicsufer
|
||||||
|
|
||||||
|
## [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
|
||||||
|
|
||||||
## [2.3.0](https://github.com/idealista/cookiecutter-ansible-role/tree/2.3.0)
|
## [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)
|
### [Full Changelog](https://github.com/idealista/cookiecutter-ansible-role/compare/2.2.0...2.3.0)
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Cookiecutter Ansible Role
|
# Cookiecutter Ansible Role
|
||||||

|

|
||||||
|
|
||||||
[](https://travis-ci.org/idealista/cookiecutter-ansible-role)
|
[](https://travis-ci.com/idealista/cookiecutter-ansible-role)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -79,6 +79,7 @@ Select has_templates:
|
|||||||
1 - True
|
1 - True
|
||||||
2 - False
|
2 - False
|
||||||
Choose from 1, 2 [1]:
|
Choose from 1, 2 [1]:
|
||||||
|
documentation_URL: https://cli.github.com/manual/
|
||||||
```
|
```
|
||||||
|
|
||||||
It will create the following file structure:
|
It will create the following file structure:
|
||||||
|
|||||||
@@ -21,5 +21,6 @@
|
|||||||
"has_files":["True", "False"],
|
"has_files":["True", "False"],
|
||||||
"comment_2":"If there is service the following options will not have any effect",
|
"comment_2":"If there is service the following options will not have any effect",
|
||||||
"has_handlers":["True", "False"],
|
"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
|
set -e
|
||||||
|
|
||||||
# Generate role
|
# 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
|
# Adjust the role to test
|
||||||
cd github_cli_role
|
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_stretch_support == 'True' %}* Stretch{% endif %}
|
||||||
{% if cookiecutter.debian_buster_support == 'True' %}* Buster{% endif %}
|
{% if cookiecutter.debian_buster_support == 'True' %}* Buster{% endif %}
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ $ pipenv run molecule test
|
|||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
{% if cookiecutter.has_service == 'True' %}
|
{% if cookiecutter.has_service == 'True' %}
|
||||||
## Service options
|
## Service options
|
||||||
# Documentation
|
# Documentation
|
||||||
{{ cookiecutter.app_name }}_documentation_link: https://www.example.documentation.com
|
{{ cookiecutter.app_name }}_documentation_link: "{{ cookiecutter.documentation_URL }}"
|
||||||
|
|
||||||
# Owner
|
# Owner
|
||||||
{{ cookiecutter.app_name }}_user: exampleuser
|
{{ cookiecutter.app_name }}_user: exampleuser
|
||||||
|
|||||||
@@ -1,36 +1,46 @@
|
|||||||
---
|
---
|
||||||
|
## TODO: Remember to adapt goss tests to your convenience
|
||||||
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' %}
|
{% 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:
|
service:
|
||||||
{{ cookiecutter.app_name }}:
|
{{ cookiecutter.app_name }}:
|
||||||
enabled: true
|
enabled: true
|
||||||
running: true
|
|
||||||
process:
|
|
||||||
{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %}:
|
|
||||||
running: true
|
running: true
|
||||||
|
|
||||||
|
process:
|
||||||
|
{{ cookiecutter.exec_name }}:
|
||||||
|
running: true
|
||||||
|
|
||||||
user:
|
user:
|
||||||
{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %}:
|
exampleuser:
|
||||||
exists: true
|
exists: true
|
||||||
groups:
|
groups:
|
||||||
- {% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}
|
- examplegroup
|
||||||
shell: /usr/sbin/nologin
|
shell: /usr/sbin/nologin
|
||||||
group:
|
group:
|
||||||
{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}:
|
examplegroup:
|
||||||
exists: true
|
exists: true
|
||||||
{% endif %}
|
{% 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
|
||||||
|
|
||||||
|
## Check if ports are really exposed
|
||||||
|
# port:
|
||||||
|
# # Check port at IPv6
|
||||||
|
# # https://github.com/aelsabbahy/goss/issues/177
|
||||||
|
# tcp6:<port>:
|
||||||
|
# listening: true
|
||||||
|
# ip:
|
||||||
|
# - '::'
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
- {{ cookiecutter.app_name }}
|
- {{ cookiecutter.app_name }}
|
||||||
become: true
|
become: true
|
||||||
vars:
|
vars:
|
||||||
goss_version: v0.3.14
|
goss_version: v0.3.16
|
||||||
goss_arch: amd64
|
goss_arch: amd64
|
||||||
goss_dst: /usr/local/bin/goss
|
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_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_test_directory: /tmp
|
||||||
goss_format: documentation
|
goss_format: documentation
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
name: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}"
|
name: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}"
|
||||||
system: yes
|
system: yes
|
||||||
state: present
|
state: present
|
||||||
|
tags:
|
||||||
|
- {{ cookiecutter.app_name }}_install
|
||||||
|
|
||||||
- name: {{ cookiecutter.app_name | upper }} | Ensure {{ cookiecutter.app_name }} user
|
- name: {{ cookiecutter.app_name | upper }} | Ensure {{ cookiecutter.app_name }} user
|
||||||
user:
|
user:
|
||||||
@@ -13,6 +15,8 @@
|
|||||||
system: yes
|
system: yes
|
||||||
shell: /usr/sbin/nologin
|
shell: /usr/sbin/nologin
|
||||||
createhome: no
|
createhome: no
|
||||||
|
tags:
|
||||||
|
- {{ cookiecutter.app_name }}_install
|
||||||
{% endif %}
|
{% endif %}
|
||||||
- name: {{ cookiecutter.app_name | upper }} | Ensure skeleton paths
|
- name: {{ cookiecutter.app_name | upper }} | Ensure skeleton paths
|
||||||
file:
|
file:
|
||||||
@@ -24,6 +28,8 @@
|
|||||||
state: directory
|
state: directory
|
||||||
with_items:
|
with_items:
|
||||||
- "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_skeleton_paths {% raw %}}}{% endraw %}"
|
- "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_skeleton_paths {% raw %}}}{% endraw %}"
|
||||||
|
tags:
|
||||||
|
- {{ cookiecutter.app_name }}_install
|
||||||
|
|
||||||
- name: {{ cookiecutter.app_name | upper }} | Ensure skeleton log paths
|
- name: {{ cookiecutter.app_name | upper }} | Ensure skeleton log paths
|
||||||
file:
|
file:
|
||||||
@@ -34,18 +40,24 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
state: file
|
state: file
|
||||||
when: {{ cookiecutter.app_name }}_log_file is defined
|
when: {{ cookiecutter.app_name }}_log_file is defined
|
||||||
|
tags:
|
||||||
|
- {{ cookiecutter.app_name }}_install
|
||||||
|
|
||||||
- name: {{ cookiecutter.app_name | upper }} | Check {{ cookiecutter.app_name }} version
|
- name: {{ cookiecutter.app_name | upper }} | Check {{ cookiecutter.app_name }} version
|
||||||
command: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %} --version"
|
command: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %} --version"
|
||||||
register: {{ cookiecutter.app_name }}_check
|
register: {{ cookiecutter.app_name }}_check
|
||||||
changed_when: false
|
changed_when: false
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
tags:
|
||||||
|
- {{ cookiecutter.app_name }}_install
|
||||||
|
|
||||||
- name: {{ cookiecutter.app_name | upper }} | Download package
|
- name: {{ cookiecutter.app_name | upper }} | Download package
|
||||||
get_url:
|
get_url:
|
||||||
url: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_url {% raw %}}}{% endraw %}"
|
url: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_url {% raw %}}}{% endraw %}"
|
||||||
dest: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_package_path {% raw %}}}{% endraw %}"
|
dest: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_package_path {% raw %}}}{% endraw %}"
|
||||||
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
|
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
|
||||||
|
tags:
|
||||||
|
- {{ cookiecutter.app_name }}_install
|
||||||
|
|
||||||
- name: {{ cookiecutter.app_name | upper }} | Extract downloaded package
|
- name: {{ cookiecutter.app_name | upper }} | Extract downloaded package
|
||||||
unarchive:
|
unarchive:
|
||||||
@@ -53,6 +65,8 @@
|
|||||||
dest: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_download_path {% raw %}}}{% endraw %}"
|
dest: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_download_path {% raw %}}}{% endraw %}"
|
||||||
remote_src: True
|
remote_src: True
|
||||||
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
|
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
|
||||||
|
tags:
|
||||||
|
- {{ cookiecutter.app_name }}_install
|
||||||
|
|
||||||
- name: {{ cookiecutter.app_name | upper }} | Copy binary
|
- name: {{ cookiecutter.app_name | upper }} | Copy binary
|
||||||
copy:
|
copy:
|
||||||
@@ -65,6 +79,8 @@
|
|||||||
remote_src: True
|
remote_src: True
|
||||||
mode: 0755
|
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
|
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
|
||||||
|
tags:
|
||||||
|
- {{ cookiecutter.app_name }}_install
|
||||||
|
|
||||||
- name: {{ cookiecutter.app_name | upper }} | Link binary
|
- name: {{ cookiecutter.app_name | upper }} | Link binary
|
||||||
file:
|
file:
|
||||||
@@ -72,3 +88,5 @@
|
|||||||
dest: "/usr/bin/{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %}"
|
dest: "/usr/bin/{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %}"
|
||||||
state: link
|
state: link
|
||||||
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
|
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
|
||||||
|
tags:
|
||||||
|
- {{ cookiecutter.app_name }}_install
|
||||||
|
|||||||
@@ -8,10 +8,14 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
notify: restart {{ cookiecutter.app_name }}
|
notify: restart {{ cookiecutter.app_name }}
|
||||||
|
tags:
|
||||||
|
- {{ cookiecutter.app_name }}_service
|
||||||
|
|
||||||
- name: {{ cookiecutter.app_name | upper }} | Configuring service
|
- name: {{ cookiecutter.app_name | upper }} | Configuring service
|
||||||
systemd:
|
systemd:
|
||||||
name: {{ cookiecutter.app_name }}
|
name: {{ cookiecutter.app_name }}
|
||||||
state: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_service_state {% raw %}}}{% endraw %}"
|
state: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_service_state {% raw %}}}{% endraw %}"
|
||||||
enabled: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_service_enabled {% raw %}}}{% endraw %}"
|
enabled: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_service_enabled {% raw %}}}{% endraw %}"
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
|
tags:
|
||||||
|
- {{ cookiecutter.app_name }}_service
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ env:
|
|||||||
{% if cookiecutter.debian_stretch_support == 'True' %}- MOLECULE_DISTRO=debian:stretch-slim{% endif %}
|
{% if cookiecutter.debian_stretch_support == 'True' %}- MOLECULE_DISTRO=debian:stretch-slim{% endif %}
|
||||||
{% if cookiecutter.debian_buster_support == 'True' %}- MOLECULE_DISTRO=debian:buster-slim{% endif %}
|
{% if cookiecutter.debian_buster_support == 'True' %}- MOLECULE_DISTRO=debian:buster-slim{% endif %}
|
||||||
script:
|
script:
|
||||||
- pipenv run molecule test
|
- pipenv run molecule test --all
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||||
|
|||||||
Reference in New Issue
Block a user