diff --git a/{{cookiecutter.app_name}}_role/.ansible-lint b/ansible-role-{{cookiecutter.app_name}}/.ansible-lint similarity index 100% rename from {{cookiecutter.app_name}}_role/.ansible-lint rename to ansible-role-{{cookiecutter.app_name}}/.ansible-lint diff --git a/ansible-role-{{cookiecutter.app_name}}/.github/FUNDING.yml b/ansible-role-{{cookiecutter.app_name}}/.github/FUNDING.yml new file mode 100644 index 0000000..9f6af16 --- /dev/null +++ b/ansible-role-{{cookiecutter.app_name}}/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: {{ cookiecutter.github_user }} +patreon: {{ cookiecutter.patreon_user }} \ No newline at end of file diff --git a/{{cookiecutter.app_name}}_role/.github/ISSUE_TEMPLATE/bug_report.md b/ansible-role-{{cookiecutter.app_name}}/.github/ISSUE_TEMPLATE/bug_report.md similarity index 100% rename from {{cookiecutter.app_name}}_role/.github/ISSUE_TEMPLATE/bug_report.md rename to ansible-role-{{cookiecutter.app_name}}/.github/ISSUE_TEMPLATE/bug_report.md diff --git a/{{cookiecutter.app_name}}_role/.github/ISSUE_TEMPLATE/config.yml b/ansible-role-{{cookiecutter.app_name}}/.github/ISSUE_TEMPLATE/config.yml similarity index 100% rename from {{cookiecutter.app_name}}_role/.github/ISSUE_TEMPLATE/config.yml rename to ansible-role-{{cookiecutter.app_name}}/.github/ISSUE_TEMPLATE/config.yml diff --git a/{{cookiecutter.app_name}}_role/.github/ISSUE_TEMPLATE/feature_request.md b/ansible-role-{{cookiecutter.app_name}}/.github/ISSUE_TEMPLATE/feature_request.md similarity index 100% rename from {{cookiecutter.app_name}}_role/.github/ISSUE_TEMPLATE/feature_request.md rename to ansible-role-{{cookiecutter.app_name}}/.github/ISSUE_TEMPLATE/feature_request.md diff --git a/{{cookiecutter.app_name}}_role/.github/ISSUE_TEMPLATE/refactor.md b/ansible-role-{{cookiecutter.app_name}}/.github/ISSUE_TEMPLATE/refactor.md similarity index 100% rename from {{cookiecutter.app_name}}_role/.github/ISSUE_TEMPLATE/refactor.md rename to ansible-role-{{cookiecutter.app_name}}/.github/ISSUE_TEMPLATE/refactor.md diff --git a/{{cookiecutter.app_name}}_role/.github/ISSUE_TEMPLATE/support_request.md b/ansible-role-{{cookiecutter.app_name}}/.github/ISSUE_TEMPLATE/support_request.md similarity index 100% rename from {{cookiecutter.app_name}}_role/.github/ISSUE_TEMPLATE/support_request.md rename to ansible-role-{{cookiecutter.app_name}}/.github/ISSUE_TEMPLATE/support_request.md diff --git a/{{cookiecutter.app_name}}_role/.github/stale.yml b/ansible-role-{{cookiecutter.app_name}}/.github/stale.yml similarity index 100% rename from {{cookiecutter.app_name}}_role/.github/stale.yml rename to ansible-role-{{cookiecutter.app_name}}/.github/stale.yml diff --git a/{{cookiecutter.app_name}}_role/.yamllint b/ansible-role-{{cookiecutter.app_name}}/.yamllint similarity index 100% rename from {{cookiecutter.app_name}}_role/.yamllint rename to ansible-role-{{cookiecutter.app_name}}/.yamllint diff --git a/{{cookiecutter.app_name}}_role/CHANGELOG.md b/ansible-role-{{cookiecutter.app_name}}/CHANGELOG.md similarity index 51% rename from {{cookiecutter.app_name}}_role/CHANGELOG.md rename to ansible-role-{{cookiecutter.app_name}}/CHANGELOG.md index 4a8cc20..c53dbf0 100644 --- a/{{cookiecutter.app_name}}_role/CHANGELOG.md +++ b/ansible-role-{{cookiecutter.app_name}}/CHANGELOG.md @@ -3,16 +3,16 @@ 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](https://github.com/{{ cookiecutter.github_user }}/{{ cookiecutter.app_name }}_role/tree/develop) +## [Unreleased](https://github.com/{{ cookiecutter.github_user }}/ansible-role-{{ cookiecutter.app_name }}/tree/develop) ### Changed ### Added ### Removed ### Fixed -## [X.Y.Z](https://github.com/{{ cookiecutter.github_user }}/{{ cookiecutter.app_name }}_role/tree/X.Y.Z) -### [Full Changelog](https://github.com/{{ cookiecutter.github_user }}/{{ cookiecutter.app_name }}_role/compare/1.0.0...X.Y.Z) +## [X.Y.Z](https://github.com/{{ cookiecutter.github_user }}/ansible-role-{{ cookiecutter.app_name }}/tree/X.Y.Z) +### [Full Changelog](https://github.com/{{ cookiecutter.github_user }}/ansible-role-{{ cookiecutter.app_name }}/compare/1.0.0...X.Y.Z) ### Changed - *[#](https://github.com/{{ cookiecutter.github_user }}/{{ cookiecutter.app_name }}_role/issues/) \* @\ + *[#](https://github.com/{{ cookiecutter.github_user }}/ansible-role-{{ cookiecutter.app_name }}/issues/) \* @\ -## [1.0.0](https://github.com/{{ cookiecutter.github_user }}/{{ cookiecutter.app_name }}_role/tree/1.0.0) +## [1.0.0](https://github.com/{{ cookiecutter.github_user }}/ansible-role-{{ cookiecutter.app_name }}/tree/1.0.0) - Initial release diff --git a/{{cookiecutter.app_name}}_role/LICENSE b/ansible-role-{{cookiecutter.app_name}}/LICENSE similarity index 100% rename from {{cookiecutter.app_name}}_role/LICENSE rename to ansible-role-{{cookiecutter.app_name}}/LICENSE diff --git a/{{cookiecutter.app_name}}_role/README.md b/ansible-role-{{cookiecutter.app_name}}/README.md similarity index 61% rename from {{cookiecutter.app_name}}_role/README.md rename to ansible-role-{{cookiecutter.app_name}}/README.md index 8a9e67c..04059a9 100644 --- a/{{cookiecutter.app_name}}_role/README.md +++ b/ansible-role-{{cookiecutter.app_name}}/README.md @@ -1,20 +1,12 @@ # {{ cookiecutter.app_name | replace('_',' ') | title }} Ansible role + ![Logo](logo.gif) -[![Build Status](https://app.travis-ci.com/idealista/{{ cookiecutter.app_name }}_role.svg)](https://app.travis-ci.com/github/idealista/{{ cookiecutter.app_name }}_role) -[![Ansible Galaxy](https://img.shields.io/badge/galaxy-idealista.{{ cookiecutter.app_name }}_role-B62682.svg)](https://galaxy.ansible.com/idealista/{{ cookiecutter.app_name }}_role) - - - -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_bullseye_support == 'True' %}* Bulleye{% endif %} -{% if cookiecutter.debian_buster_support == 'True' %}* Buster{% endif %} - This role has been generated using the [cookiecutter](https://github.com/cookiecutter/cookiecutter) tool, you can generate a similar role that fits your needs using the this [cookiecutter template](https://github.com/idealista/cookiecutter-ansible-role). - [Getting Started](#getting-started) - - [Prerequisities](#prerequisities) - - [Installing](#installing) + - [Prerequisities](#prerequisities) + - [Installing](#installing) - [Usage](#usage) - [Testing](#testing) - [Built With](#built-with) @@ -24,6 +16,7 @@ This role has been generated using the [cookiecutter](https://github.com/cookiec - [Contributing](#contributing) ## Getting Started + These instructions will get you a copy of the role for your Ansible playbook. Once launched, it will install {{ cookiecutter.app_name | replace('_',' ') | title }} in a Debian system. ### Prerequisities @@ -38,46 +31,45 @@ For testing purposes, [Molecule](https://molecule.readthedocs.io/) with [Docker] Create or add to your roles dependency file (e.g requirements.yml): -``` -- src: idealista.{{ cookiecutter.app_name }}_role +```yml +- src: ansible-role-{{ cookiecutter.app_name }} version: 1.0.0 - name: {{ cookiecutter.app_name }}_role + name: {{cookiecutter.namespace}}.{{ cookiecutter.app_name }} ``` Install the role with ansible-galaxy command: -``` +```sh ansible-galaxy install -p roles -r requirements.yml -f ``` Use in a playbook: -``` +```yml --- - hosts: someserver roles: - - role: {{ cookiecutter.app_name }}_role + - role: {{cookiecutter.namespace}}.{{ cookiecutter.app_name }} ``` ## Usage Look to the [defaults](defaults/main.yml) properties file to see the possible configuration properties, it is very likely that you will not need to override any variables. - ## Testing ### Install dependencies ```sh -$ pipenv sync +pipenv sync ``` -For more information read the [pipenv docs](ipenv-fork.readthedocs.io/en/latest/). +For more information read the [pipenv docs](https://pipenv-fork.readthedocs.io/en/latest/). -### Testing +### Run test ```sh -$ pipenv run molecule test +pipenv run molecule test ``` ## Built With @@ -88,15 +80,14 @@ $ pipenv run molecule test ## Versioning -For the versions available, see the [tags on this repository](https://github.com/{{ cookiecutter.github_user }}/{{ cookiecutter.app_name }}_role/tags). +For the versions available, see the [tags on this repository](https://github.com/{{ cookiecutter.github_user }}/ansible-role-{{ cookiecutter.app_name }}/tags). Additionaly you can see what change in each version in the [CHANGELOG.md](CHANGELOG.md) file. ## Authors -* **Idealista** - *Work with* - [idealista](https://github.com/idealista) - -See also the list of [contributors](https://github.com/{{ cookiecutter.github_user }}/{{ cookiecutter.app_name }}_role/contributors) who participated in this project. +- **Idealista** +- **Laur IVAN** ## License diff --git a/ansible-role-{{cookiecutter.app_name}}/defaults/main.yml b/ansible-role-{{cookiecutter.app_name}}/defaults/main.yml new file mode 100644 index 0000000..71f1471 --- /dev/null +++ b/ansible-role-{{cookiecutter.app_name}}/defaults/main.yml @@ -0,0 +1,16 @@ +--- + +## General +# Version +{{ cookiecutter.app_name }}_version: 1.0.0 + +# {{ cookiecutter.app_name }} paths +{{ cookiecutter.app_name }}_root_path: /opt/{{ cookiecutter.app_name }} +{{ cookiecutter.app_name }}_config_path: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_root_path {% raw %}}}{% endraw %}/conf" +{{ cookiecutter.app_name }}_skeleton_paths: + - "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_config_path {% raw %}}}{% endraw %}" + +# Documentation +{{ cookiecutter.app_name }}_documentation_link: "{{ cookiecutter.documentation_URL }}" + + diff --git a/{{cookiecutter.app_name}}_role/files/.empty b/ansible-role-{{cookiecutter.app_name}}/files/.empty similarity index 100% rename from {{cookiecutter.app_name}}_role/files/.empty rename to ansible-role-{{cookiecutter.app_name}}/files/.empty diff --git a/ansible-role-{{cookiecutter.app_name}}/handlers/main.yml b/ansible-role-{{cookiecutter.app_name}}/handlers/main.yml new file mode 100644 index 0000000..1015741 --- /dev/null +++ b/ansible-role-{{cookiecutter.app_name}}/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# Handlers for {{ cookiecutter.app_name }} diff --git a/{{cookiecutter.app_name}}_role/logo.gif b/ansible-role-{{cookiecutter.app_name}}/logo.gif similarity index 100% rename from {{cookiecutter.app_name}}_role/logo.gif rename to ansible-role-{{cookiecutter.app_name}}/logo.gif diff --git a/ansible-role-{{cookiecutter.app_name}}/meta/main.yml b/ansible-role-{{cookiecutter.app_name}}/meta/main.yml new file mode 100644 index 0000000..05c8cf3 --- /dev/null +++ b/ansible-role-{{cookiecutter.app_name}}/meta/main.yml @@ -0,0 +1,26 @@ +--- + +galaxy_info: + author: {{ cookiecutter.author }} + namespace: {{ cookiecutter.namespace }} + {% if cookiecutter.company != "" %}company: {{ cookiecutter.company }}{% endif %} + role_name: {{ cookiecutter.app_name }} + description: {{ cookiecutter.app_name | replace('_',' ') | title }} Role + min_ansible_version: {{ cookiecutter.min_ansible_version }} + min_ansible_version: {{ cookiecutter.min_ansible_container_version }} + license: {{ cookiecutter.license }} + galaxy_tags: + - {{ cookiecutter.galaxy_tag_1 }} + - {{ cookiecutter.galaxy_tag_2 }} + - {{ cookiecutter.galaxy_tag_3 }} + platforms: + {% if cookiecutter.platforms.debian_list %} + - name: Debian + versions: {% for ver in cookiecutter.platforms.debian_list %} + - {{ ver }}{% endfor %} + {% endif %} + {% if cookiecutter.platforms.ubuntu_list %} + - name: Ubuntu + versions: {% for ver in cookiecutter.platforms.ubuntu_list %} + - {{ ver }}{% endfor %} + {% endif %} diff --git a/ansible-role-{{cookiecutter.app_name}}/molecule/default/cleanup.yml b/ansible-role-{{cookiecutter.app_name}}/molecule/default/cleanup.yml new file mode 100644 index 0000000..be340d3 --- /dev/null +++ b/ansible-role-{{cookiecutter.app_name}}/molecule/default/cleanup.yml @@ -0,0 +1,23 @@ +--- +- name: Clean up + hosts: all + gather_facts: true + tasks: + - name: Check if the docker-compose file exists. + ansible.builtin.stat: + path: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_config_path | expanduser | realpath {% raw %}}}{% endraw %}/docker-compose.yml" + register: docker_compose_file + + - name: Remove docker-compose. + community.docker.docker_compose: + project_src: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_config_path | expanduser | realpath {% raw %}}}{% endraw %}/" + build: false + state: absent + when: docker_compose_file.stat.exists + become: false + + - name: Remove the docker-compose file + ansible.builtin.file: + path: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_config_path | expanduser | realpath {% raw %}}}{% endraw %}/docker-compose.yml" + state: absent + when: docker_compose_file.stat.exists \ No newline at end of file diff --git a/{{cookiecutter.app_name}}_role/molecule/default/converge.yml b/ansible-role-{{cookiecutter.app_name}}/molecule/default/converge.yml similarity index 51% rename from {{cookiecutter.app_name}}_role/molecule/default/converge.yml rename to ansible-role-{{cookiecutter.app_name}}/molecule/default/converge.yml index ee54492..f9efd70 100644 --- a/{{cookiecutter.app_name}}_role/molecule/default/converge.yml +++ b/ansible-role-{{cookiecutter.app_name}}/molecule/default/converge.yml @@ -2,4 +2,4 @@ - name: Converge hosts: {{ cookiecutter.app_name }}_group roles: - - role: {{ cookiecutter.app_name }}_role + - role: "{{cookiecutter.namespace}}.{{ cookiecutter.app_name }}" diff --git a/ansible-role-{{cookiecutter.app_name}}/molecule/default/destroy.yml b/ansible-role-{{cookiecutter.app_name}}/molecule/default/destroy.yml new file mode 100644 index 0000000..3f4de01 --- /dev/null +++ b/ansible-role-{{cookiecutter.app_name}}/molecule/default/destroy.yml @@ -0,0 +1,27 @@ +--- +- name: Destroy + hosts: localhost + connection: local + gather_facts: false + no_log: "{% raw %}{{ molecule_no_log }}{% endraw %}" + tasks: + # Developer must implement. + - name: Remove the docker image + community.docker.docker_container: + name: {{ cookiecutter.app_name }} + state: absent + + # Mandatory configuration for Molecule to function. + + - name: Populate instance config + ansible.builtin.set_fact: + instance_conf: {} + + - name: Dump instance config + ansible.builtin.copy: + content: | + # Molecule managed + {% raw %}{{ instance_conf | to_json | from_json | to_yaml }}{% endraw %} + dest: "{% raw %}{{ molecule_instance_config }}{% endraw %}" + mode: 0600 + when: server.changed | default(false) | bool diff --git a/{{cookiecutter.app_name}}_role/molecule/default/group_vars/all.yml b/ansible-role-{{cookiecutter.app_name}}/molecule/default/group_vars/all.yml similarity index 100% rename from {{cookiecutter.app_name}}_role/molecule/default/group_vars/all.yml rename to ansible-role-{{cookiecutter.app_name}}/molecule/default/group_vars/all.yml diff --git a/{{cookiecutter.app_name}}_role/molecule/default/molecule.yml b/ansible-role-{{cookiecutter.app_name}}/molecule/default/molecule.yml similarity index 54% rename from {{cookiecutter.app_name}}_role/molecule/default/molecule.yml rename to ansible-role-{{cookiecutter.app_name}}/molecule/default/molecule.yml index 83c6550..bf44e69 100644 --- a/{{cookiecutter.app_name}}_role/molecule/default/molecule.yml +++ b/ansible-role-{{cookiecutter.app_name}}/molecule/default/molecule.yml @@ -1,6 +1,11 @@ --- dependency: name: galaxy + options: + ignore-certs: true + ignore-errors: true + role-file: molecule/requirements.yml + requirements-file: molecule/requirements.yml driver: name: docker lint: | @@ -10,8 +15,9 @@ platforms: - name: {{ cookiecutter.app_name }} groups: - {{ cookiecutter.app_name }}_group - image: ${MOLECULE_DISTRO:-debian:bullseye-slim} - privileged: false + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" + privileged: true + pre_build_image: true capabilities: - SYS_ADMIN tmpfs: @@ -20,9 +26,13 @@ platforms: - /run/lock volumes: - '/sys/fs/cgroup:/sys/fs/cgroup:ro' + - '/var/run/docker.sock:/tmp/docker_mounted.sock' command: '/lib/systemd/systemd' stop_signal: 'RTMIN+3' provisioner: name: ansible + playbooks: + converge: ${MOLECULE_PLAYBOOK:-converge.yml} verifier: name: ansible + diff --git a/ansible-role-{{cookiecutter.app_name}}/molecule/default/prepare.yml b/ansible-role-{{cookiecutter.app_name}}/molecule/default/prepare.yml new file mode 100644 index 0000000..e2bd23b --- /dev/null +++ b/ansible-role-{{cookiecutter.app_name}}/molecule/default/prepare.yml @@ -0,0 +1,38 @@ +--- +- name: Setup the test machine + hosts: {{ cookiecutter.app_name }} + tasks: + - name: Check if /var/run/docker.sock already exists + ansible.builtin.stat: + path: "/var/run/docker.sock" + register: docker_sock_stat + + - name: Create docker.sock + ansible.builtin.raw: touch /var/run/docker.sock + become: true + changed_when: false + when: not docker_sock_stat.stat.exists + + - name: Move docker.sock from tmp + ansible.builtin.raw: > + mount --move /tmp/docker_mounted.sock /var/run/docker.sock + become: true + changed_when: false + when: not docker_sock_stat.stat.exists + + - name: Update apt cache. + ansible.builtin.apt: update_cache=yes cache_valid_time=600 + when: ansible_os_family == 'Debian' + + - name: Install python requests + ansible.builtin.pip: + name: + - requests + - docker + - docker-compose + + - name: Install docker + vars: + docker_service_manage: false + ansible.builtin.include_role: + name: geerlingguy.docker diff --git a/ansible-role-{{cookiecutter.app_name}}/molecule/default/requirements.yml b/ansible-role-{{cookiecutter.app_name}}/molecule/default/requirements.yml new file mode 100644 index 0000000..a6284de --- /dev/null +++ b/ansible-role-{{cookiecutter.app_name}}/molecule/default/requirements.yml @@ -0,0 +1,4 @@ +--- +roles: + - geerlingguy.docker +collections: [] diff --git a/ansible-role-{{cookiecutter.app_name}}/molecule/default/tests/test_app.yml b/ansible-role-{{cookiecutter.app_name}}/molecule/default/tests/test_app.yml new file mode 100644 index 0000000..38a1eea --- /dev/null +++ b/ansible-role-{{cookiecutter.app_name}}/molecule/default/tests/test_app.yml @@ -0,0 +1,12 @@ +--- +## TODO: Remember to adapt goss tests to your convenience + + +## Check if ports are really exposed +# port: +# # Check port at IPv6 +# # https://github.com/aelsabbahy/goss/issues/177 +# tcp6:: +# listening: true +# ip: +# - '::' diff --git a/{{cookiecutter.app_name}}_role/molecule/default/verify.yml b/ansible-role-{{cookiecutter.app_name}}/molecule/default/verify.yml similarity index 100% rename from {{cookiecutter.app_name}}_role/molecule/default/verify.yml rename to ansible-role-{{cookiecutter.app_name}}/molecule/default/verify.yml diff --git a/ansible-role-{{cookiecutter.app_name}}/tasks/config.yml b/ansible-role-{{cookiecutter.app_name}}/tasks/config.yml new file mode 100644 index 0000000..0b8f61a --- /dev/null +++ b/ansible-role-{{cookiecutter.app_name}}/tasks/config.yml @@ -0,0 +1,23 @@ +--- +- name: "{{ cookiecutter.app_name | upper }} | Set up directories" + ansible.builtin.file: + state: directory + path: "{%raw%}{{{%endraw%} item }}" + owner: "{%raw%}{{{%endraw%} ansible_effective_user_id {%raw%}}}{%endraw%}" + group: "{%raw%}{{{%endraw%} ansible_effective_group_id {%raw%}}}{%endraw%}" + mode: "0750" + with_items: + - "{%raw%}}}{%endraw%} {{ cookiecutter.app_name }}_skeleton_paths {%raw%}}}{%endraw%}" + tags: + - {{ cookiecutter.app_name }}_configure + become: true + +- name: "{{ cookiecutter.app_name | upper }} | Write configuration files" + ansible.builtin.template: + src: "{%raw%}}}{%endraw%} item {%raw%}}}{%endraw%}.j2" + dest: "{%raw%}}}{%endraw%} cookiecutter.app_name }}_config_path | expanduser | realpath {%raw%}}}{%endraw%}/{%raw%}}}{%endraw%} item {%raw%}}}{%endraw%}" + mode: '0640' + loop: + - "docker-compose.yml" + tags: + - {{ cookiecutter.app_name }}_configure \ No newline at end of file diff --git a/ansible-role-{{cookiecutter.app_name}}/tasks/install.yml b/ansible-role-{{cookiecutter.app_name}}/tasks/install.yml new file mode 100644 index 0000000..12dd262 --- /dev/null +++ b/ansible-role-{{cookiecutter.app_name}}/tasks/install.yml @@ -0,0 +1,7 @@ +--- +- name: "{{ cookiecutter.app_name | upper }} | Ensure {{ cookiecutter.app_name }} is running" + community.docker.docker_compose: + project_src: "{%raw%}{{{%endraw%} {{ cookiecutter.app_name }}_config_path | expanduser | realpath {%raw%}}}{%endraw%}" + build: false + tags: + - {{ cookiecutter.app_name }}_install diff --git a/ansible-role-{{cookiecutter.app_name}}/tasks/main.yml b/ansible-role-{{cookiecutter.app_name}}/tasks/main.yml new file mode 100644 index 0000000..4551e24 --- /dev/null +++ b/ansible-role-{{cookiecutter.app_name}}/tasks/main.yml @@ -0,0 +1,12 @@ +--- + +- name: "{{ cookiecutter.app_name | upper }} | Configure" + import_tasks: config.yml + tags: + - {{ cookiecutter.app_name }}_configure + +- name:" {{ cookiecutter.app_name | upper }} | Install" + import_tasks: install.yml + tags: + - {{ cookiecutter.app_name }}_install + diff --git a/ansible-role-{{cookiecutter.app_name}}/templates/docker-compose.yml.j2 b/ansible-role-{{cookiecutter.app_name}}/templates/docker-compose.yml.j2 new file mode 100644 index 0000000..2522b59 --- /dev/null +++ b/ansible-role-{{cookiecutter.app_name}}/templates/docker-compose.yml.j2 @@ -0,0 +1,3 @@ +# {{ cookiecutter.app_name }} docker compose +version: '3.9' +services: diff --git a/{{cookiecutter.app_name}}_role/test-requirements.txt b/ansible-role-{{cookiecutter.app_name}}/test-requirements.txt similarity index 100% rename from {{cookiecutter.app_name}}_role/test-requirements.txt rename to ansible-role-{{cookiecutter.app_name}}/test-requirements.txt diff --git a/{{cookiecutter.app_name}}_role/{% raw %}.gitattributes{% endraw %} b/ansible-role-{{cookiecutter.app_name}}/{% raw %}.gitattributes{% endraw %} similarity index 100% rename from {{cookiecutter.app_name}}_role/{% raw %}.gitattributes{% endraw %} rename to ansible-role-{{cookiecutter.app_name}}/{% raw %}.gitattributes{% endraw %} diff --git a/{{cookiecutter.app_name}}_role/{% raw %}.gitignore{% endraw %} b/ansible-role-{{cookiecutter.app_name}}/{% raw %}.gitignore{% endraw %} similarity index 100% rename from {{cookiecutter.app_name}}_role/{% raw %}.gitignore{% endraw %} rename to ansible-role-{{cookiecutter.app_name}}/{% raw %}.gitignore{% endraw %} diff --git a/{{cookiecutter.app_name}}_role/{% raw %}.travis.yml{% endraw %} b/ansible-role-{{cookiecutter.app_name}}/{% raw %}.travis.yml{% endraw %} similarity index 58% rename from {{cookiecutter.app_name}}_role/{% raw %}.travis.yml{% endraw %} rename to ansible-role-{{cookiecutter.app_name}}/{% raw %}.travis.yml{% endraw %} index 8633d50..40b1432 100644 --- a/{{cookiecutter.app_name}}_role/{% raw %}.travis.yml{% endraw %} +++ b/ansible-role-{{cookiecutter.app_name}}/{% raw %}.travis.yml{% endraw %} @@ -10,8 +10,8 @@ install: - pipenv sync env: jobs: - {% if cookiecutter.debian_buster_support == 'True' %}- MOLECULE_DISTRO=debian:buster-slim{% endif %} - {% if cookiecutter.debian_bullseye_support == 'True' %}- MOLECULE_DISTRO=debian:bullseye-slim{% endif %} + {% if "buster" in cookiecutter.platforms.debian_list %}- MOLECULE_DISTRO=debian:buster-slim{% endif %} + {% if "bullseye" in cookiecutter.platforms.debian_list %}- MOLECULE_DISTRO=debian:bullseye-slim{% endif %} script: - pipenv run molecule test --all @@ -22,4 +22,4 @@ notifications: on_success: change on_failure: always recipients: - - desarrollo.benders@idealista.com + - laur.ivan@gmail.com diff --git a/cookiecutter.json b/cookiecutter.json index 6013775..a9a3ebf 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -2,11 +2,13 @@ "comment_0":"The role name will be the value you assign to app_name with _role appended", "comment_1":"Introduce in exec_name the executable file name, you can change it later in the defaults/main.yml if you don't know it", "app_name": "", - "exec_name":"", - "github_user": "idealista", - "company": "Idealista S.A.U.", - "author": "", - "min_ansible_version": "", + "github_user": "equinoxel", + "patreon_user": "laurivan", + "company": "", + "author": "Laur Ivan (laur.ivan@gmail.com)", + "namespace": "laurivan", + "min_ansible_version": "2.4", + "min_ansible_container_version": "2.4", "ansible_version": "5.2.0", "molecule_version": "3.4.0", "python_docker_version": "5.0.0", @@ -17,11 +19,11 @@ "galaxy_tag_1":"tag1", "galaxy_tag_2":"tag2", "galaxy_tag_3":"tag3", - "debian_bullseye_support":["True", "False"], - "debian_buster_support":["True", "False"], - "has_service":["True", "False"], + "platforms": { + "debian_list": ["bullseye", "buster"], + "ubuntu_list": ["bionic", "focal", "jammy"] + }, "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"], "documentation_URL":"" diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index f0e20c4..4f272eb 100755 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -18,17 +18,15 @@ def checkInput(): def configureRole(): # Remove or not the service - if not {{ cookiecutter.has_service }}: - # Delete the service and things that reference the service - os.remove("tasks/service.yml") - os.remove("templates/{{ cookiecutter.app_name }}.service.j2") - shutil.rmtree("molecule/default/group_vars") - # Remove or not the handlers folder - if not {{ cookiecutter.has_handlers }}: - shutil.rmtree("handlers") - # Remove or not the templates folder - if not {{ cookiecutter.has_templates }}: - shutil.rmtree("templates") + + shutil.rmtree("molecule/default/group_vars") + # Remove or not the handlers folder + if not {{ cookiecutter.has_handlers }}: + shutil.rmtree("handlers") + # Remove or not the templates folder + if not {{ cookiecutter.has_templates }}: + shutil.rmtree("templates") + # Remove or not the files folder if not {{ cookiecutter.has_files }}: shutil.rmtree("files") diff --git a/test.sh b/test.sh index 5e31fe5..67324d5 100755 --- a/test.sh +++ b/test.sh @@ -14,7 +14,6 @@ printf "cookiecutter==1.7.2\nJinja2==2.11.2" > requirements.txt && pipenv instal molecule_docker_version="0.2.4" \ ansible_lint_version="5.3.2" \ yamllint_version="1.28.0" \ - has_service="False" \ has_files="False" \ has_handlers="False" \ has_templates="False" \ diff --git a/{{cookiecutter.app_name}}_role/defaults/main.yml b/{{cookiecutter.app_name}}_role/defaults/main.yml deleted file mode 100644 index 1d029c6..0000000 --- a/{{cookiecutter.app_name}}_role/defaults/main.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- - -## General -# Version -{{ cookiecutter.app_name }}_version: 1.0.0 -{{ cookiecutter.app_name }}_release_system: linux_amd64 - -# Package URL -{{ cookiecutter.app_name }}_release_name: "exampleapplication_{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_version {% raw %}}}{% endraw %}_{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_release_system {% raw %}}}{% endraw %}" -{{ cookiecutter.app_name }}_package: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_release_name {% raw %}}}{% endraw %}.tar.gz" -{{ cookiecutter.app_name }}_url: "https://github.com/someuser/somerepo/releases/download/v{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_version {% raw %}}}{% endraw %}/{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_package {% raw %}}}{% endraw %}" - -# Package paths -{{ cookiecutter.app_name }}_download_path: /usr/src -{{ cookiecutter.app_name }}_package_path: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_download_path {% raw %}}}{% endraw %}/{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_package {% raw %}}}{% endraw %}" -{{ cookiecutter.app_name }}_src_bin: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_download_path {% raw %}}}{% endraw %}/{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_release_name {% raw %}}}{% endraw %}/bin/{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %}" - -# Set true to force the download and installation of the binary -{{ cookiecutter.app_name }}_force_reinstall: false - -# Installation path -{{ cookiecutter.app_name }}_root_path: /opt/{{ cookiecutter.app_name }} -{{ cookiecutter.app_name }}_bin_path: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_root_path {% raw %}}}{% endraw %}/bin" -{{ cookiecutter.app_name }}_skeleton_paths: - - "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_bin_path {% raw %}}}{% endraw %}" -{{ cookiecutter.app_name }}_exec_name: {{ cookiecutter.exec_name }} -{% if cookiecutter.has_service == 'True' %} -## Service options -# Documentation -{{ cookiecutter.app_name }}_documentation_link: "{{ cookiecutter.documentation_URL }}" - -# Owner -{{ cookiecutter.app_name }}_user: exampleuser -{{ cookiecutter.app_name }}_group: examplegroup -{{ cookiecutter.app_name }}_user_shell: /usr/sbin/nologin - -# Maximum number of files limit -{{ cookiecutter.app_name }}_max_files: 32768 - -# Start on boot -{{ cookiecutter.app_name }}_service_enabled: True -# Current state: started, stopped -{{ cookiecutter.app_name }}_service_state: started - -# 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_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 -{{ cookiecutter.app_name }}_port: # the port exposed by the service goes here -{{ cookiecutter.app_name }}_flag1_value: example_value_1 -{{ cookiecutter.app_name }}_flag2_value: example_value_2 -{{ cookiecutter.app_name }}_options: - - "port {% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_port {% raw %}}}{% endraw %}" - - "flag1 {% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_flag1_value {% raw %}}}{% endraw %}" - - "flag2 {% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_flag2_value {% raw %}}}{% endraw %}" - -{{ cookiecutter.app_name }}_private_tmp: true -{% endif %} \ No newline at end of file diff --git a/{{cookiecutter.app_name}}_role/handlers/main.yml b/{{cookiecutter.app_name}}_role/handlers/main.yml deleted file mode 100644 index 89e1298..0000000 --- a/{{cookiecutter.app_name}}_role/handlers/main.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -{% if cookiecutter.has_service == 'True' %} -- name: restart {{ cookiecutter.app_name }} - systemd: - name: {{ cookiecutter.app_name }} - state: restarted - when: {{ cookiecutter.app_name }}_service_state != 'stopped' -{% endif %} \ No newline at end of file diff --git a/{{cookiecutter.app_name}}_role/meta/main.yml b/{{cookiecutter.app_name}}_role/meta/main.yml deleted file mode 100644 index 03785df..0000000 --- a/{{cookiecutter.app_name}}_role/meta/main.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- - -galaxy_info: - author: {{ cookiecutter.author }} - company: {{ cookiecutter.company }} - description: {{ cookiecutter.app_name | replace('_',' ') | title }} Role - min_ansible_version: {{ cookiecutter.min_ansible_version }} - license: {{ cookiecutter.license }} - galaxy_tags: - - {{ cookiecutter.galaxy_tag_1 }} - - {{ cookiecutter.galaxy_tag_2 }} - - {{ cookiecutter.galaxy_tag_3 }} - platforms: - - name: Debian - versions: - {% if cookiecutter.debian_bullseye_support == 'True' %}- bullseye{% endif %} - {% if cookiecutter.debian_buster_support == 'True' %}- buster{% endif %} diff --git a/{{cookiecutter.app_name}}_role/molecule/default/Dockerfile.j2 b/{{cookiecutter.app_name}}_role/molecule/default/Dockerfile.j2 deleted file mode 100644 index 0b1c413..0000000 --- a/{{cookiecutter.app_name}}_role/molecule/default/Dockerfile.j2 +++ /dev/null @@ -1,12 +0,0 @@ -# Molecule managed - -{% raw %}{% if item.registry is defined %} -FROM {{ item.registry.url }}/{{ item.image }} -{% else %} -FROM {{ item.image }} -{% endif %} - -# install minimal packages for debian slim images -RUN apt-get update && \ - apt-get install -y python3 sudo bash ca-certificates iproute2 systemd systemd-sysv python3-pip && \ - apt-get clean{% endraw %} diff --git a/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml b/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml deleted file mode 100644 index f2bd937..0000000 --- a/{{cookiecutter.app_name}}_role/molecule/default/tests/test_app.yml +++ /dev/null @@ -1,46 +0,0 @@ ---- -## TODO: Remember to adapt goss tests to your convenience -{% if cookiecutter.has_service == 'True' %} -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 }}: - {%- 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:: -# listening: true -# ip: -# - '::' diff --git a/{{cookiecutter.app_name}}_role/tasks/config.yml b/{{cookiecutter.app_name}}_role/tasks/config.yml deleted file mode 100644 index ed97d53..0000000 --- a/{{cookiecutter.app_name}}_role/tasks/config.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/{{cookiecutter.app_name}}_role/tasks/install.yml b/{{cookiecutter.app_name}}_role/tasks/install.yml deleted file mode 100644 index 34025a9..0000000 --- a/{{cookiecutter.app_name}}_role/tasks/install.yml +++ /dev/null @@ -1,95 +0,0 @@ ---- -{% if cookiecutter.has_service == 'True' %} -- name: {{ cookiecutter.app_name | upper }} | Ensure {{ cookiecutter.app_name }} group - group: - name: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}" - system: yes - state: present - tags: - - {{ cookiecutter.app_name }}_install - -- name: {{ cookiecutter.app_name | upper }} | Ensure {{ cookiecutter.app_name }} user - user: - name: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %}" - group: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}" - system: yes - shell: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user_shell {% raw %}}}{% endraw %}" - createhome: no - tags: - - {{ cookiecutter.app_name }}_install -{% endif %} -- name: {{ cookiecutter.app_name | upper }} | Ensure skeleton paths - file: - dest: "{% raw %}{{{% endraw %} item {% 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 %} - mode: 0755 - state: directory - with_items: - - "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_skeleton_paths {% raw %}}}{% endraw %}" - tags: - - {{ cookiecutter.app_name }}_install - -- 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' %} - owner: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %}" - group: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}" -{%- endif %} - mode: 0755 - state: directory - when: {{ cookiecutter.app_name }}_log_file is defined - tags: - - {{ cookiecutter.app_name }}_install - -- name: {{ cookiecutter.app_name | upper }} | Check {{ cookiecutter.app_name }} version - command: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %} --version" - register: {{ cookiecutter.app_name }}_check - changed_when: false - ignore_errors: true - check_mode: no - tags: - - {{ cookiecutter.app_name }}_install - -- name: {{ cookiecutter.app_name | upper }} | Download package - get_url: - url: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_url {% 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 - tags: - - {{ cookiecutter.app_name }}_install - -- name: {{ cookiecutter.app_name | upper }} | Extract downloaded package - unarchive: - src: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_package_path {% raw %}}}{% endraw %}" - dest: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_download_path {% raw %}}}{% endraw %}" - 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 - tags: - - {{ cookiecutter.app_name }}_install - -- name: {{ cookiecutter.app_name | upper }} | Copy binary - 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' %} - owner: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %}" - group: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}" -{%- 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 - tags: - - {{ cookiecutter.app_name }}_install - -- name: {{ cookiecutter.app_name | upper }} | Link binary - file: - src: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_bin_path {% raw %}}}{% endraw %}/{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %}" - dest: "/usr/bin/{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %}" - 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 - tags: - - {{ cookiecutter.app_name }}_install diff --git a/{{cookiecutter.app_name}}_role/tasks/main.yml b/{{cookiecutter.app_name}}_role/tasks/main.yml deleted file mode 100644 index 25be2e8..0000000 --- a/{{cookiecutter.app_name}}_role/tasks/main.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- - -- name: {{ cookiecutter.app_name | upper }} | Install - import_tasks: install.yml - tags: - - {{ cookiecutter.app_name }}_install - -- name: {{ cookiecutter.app_name | upper }} | Configure - import_tasks: config.yml - tags: - - {{ cookiecutter.app_name }}_configure -{% if cookiecutter.has_service == 'True' %} -- name: {{ cookiecutter.app_name | upper }} | Service - import_tasks: service.yml - tags: - - {{ cookiecutter.app_name }}_service -{% endif %} \ No newline at end of file diff --git a/{{cookiecutter.app_name}}_role/tasks/service.yml b/{{cookiecutter.app_name}}_role/tasks/service.yml deleted file mode 100644 index a20310c..0000000 --- a/{{cookiecutter.app_name}}_role/tasks/service.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- - -- name: {{ cookiecutter.app_name | upper }} | Copy Daemon script - template: - src: {{ cookiecutter.app_name }}.service.j2 - dest: /etc/systemd/system/{{ cookiecutter.app_name }}.service - mode: 0644 - owner: root - group: root - notify: restart {{ cookiecutter.app_name }} - tags: - - {{ cookiecutter.app_name }}_service - -- name: {{ cookiecutter.app_name | upper }} | Configuring service - systemd: - name: {{ cookiecutter.app_name }} - state: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_service_state {% raw %}}}{% endraw %}" - enabled: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_service_enabled {% raw %}}}{% endraw %}" - daemon_reload: yes - tags: - - {{ cookiecutter.app_name }}_service diff --git a/{{cookiecutter.app_name}}_role/templates/{{ cookiecutter.app_name }}.service.j2 b/{{cookiecutter.app_name}}_role/templates/{{ cookiecutter.app_name }}.service.j2 deleted file mode 100644 index 79cad12..0000000 --- a/{{cookiecutter.app_name}}_role/templates/{{ cookiecutter.app_name }}.service.j2 +++ /dev/null @@ -1,24 +0,0 @@ -{% raw %}{{ ansible_managed | comment }}{% endraw %} -[Unit] -Description={{ cookiecutter.app_name | replace('_',' ') }} -Documentation={% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_documentation_link {% raw %}}}{% endraw %} -Requires=network-online.target -After=network-online.target - -[Service] -PrivateTmp={% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_private_tmp {% raw %}}}{% endraw %} -User={% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %} -Group={% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %} -RuntimeDirectory={{ cookiecutter.app_name }} -LimitNOFILE={% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_max_files {% raw %}}}{% endraw %} - -ExecStart={% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_bin_path {% raw %}}}{% endraw %}/{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %} {% raw %}{%{% endraw %} for option in {{ cookiecutter.app_name }}_options {% raw %}%}{% endraw %}{% raw %}{%{% endraw %} if option {% raw %}%}{% endraw %}-{% raw %}{{{% endraw %} option {% raw %}}}{% endraw %} {% raw %}{%{% endraw %} endif {% raw %}%}{% endraw %}{% raw %}{%{% endraw %} endfor {% raw %}%}{% endraw %} - -StandardOutput={% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_log_output {% raw %}}}{% endraw %} -StandardError={% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_log_output {% raw %}}}{% endraw %} -ExecReload=/bin/kill -HUP $MAINPID -KillSignal=SIGTERM -Restart=always - -[Install] -WantedBy=multi-user.target