feat: Better default configuration.

Add multiple files copy via variables.
Add service skeleton.
Add image and port versions.
This commit is contained in:
Laur Ivan 2023-04-27 22:05:41 +02:00
parent 8adf037392
commit bda1f187c5
7 changed files with 44 additions and 10 deletions

View File

@ -1,6 +1,6 @@
# {{ cookiecutter.app_name | replace('_',' ') | title }} Ansible role
This role installs Mealie via Docker compose.
This role installs {{ cookiecutter.app_name | title }} via Docker compose.
## Requirements

View File

@ -1,15 +1,25 @@
---
## General
# Version
{{ cookiecutter.app_name }}_version: 1.0.0
{{ cookiecutter.app_name }}_image: {{ cookiecutter.app_name }}:latest
# {{ 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 }}_http_port: {{ cookiecutter.http_port }}
# {{ cookiecutter.app_name | title }} paths
{{ cookiecutter.app_name }}_root_path: /var/local
{{ cookiecutter.app_name }}_data_base: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_root_path {% raw %}}}{% endraw %}/{{ cookiecutter.app_name }}"
{{ cookiecutter.app_name }}_config_path: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_root_path {% raw %}}}{% endraw %}/conf/{{ cookiecutter.app_name }}"
# Add other paths here to make sure they're created automatically
#
{{ cookiecutter.app_name }}_skeleton_paths:
- "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_config_path {% raw %}}}{% endraw %}"
# Add more templates to be copied into the config
{{ cookiecutter.app_name }}_configuration_files:
- "{% raw %}docker-compose.yml{% endraw %}"
- "env.{{ cookiecutter.app_name }}.conf"
# Documentation
{{ cookiecutter.app_name }}_documentation_link: "{{ cookiecutter.documentation_URL }}"

View File

@ -3,7 +3,7 @@
galaxy_info:
author: {{ cookiecutter.author }}
namespace: {{ cookiecutter.namespace }}
company: {% if cookiecutter.company != "" %}{{ cookiecutter.company }}{% endif %}
{% 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 }}"

View File

@ -17,8 +17,8 @@
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"
with_items:
- "{%raw%}{{{%endraw%} {{ cookiecutter.app_name }}_configuration_files {%raw%}}}{%endraw%}"
tags:
- {{ cookiecutter.app_name }}_configure

View File

@ -1,3 +1,24 @@
# {{ cookiecutter.app_name }} docker compose
version: '3.9'
services:
{{ cookiecutter.app_name}}:
image: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_image {% raw %}}}{% endraw %}"
container_name: {{ cookiecutter.app_name }}-service
restart: always
env_file:
- "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_config_path | expanduser {% raw %}}}{% endraw %}/env.{{ cookiecutter.app_name }}.conf"
ports:
- "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_http_port {% raw %}}}{% endraw %}"
# Add more ports if necessary
networks:
- {{ cookiecutter.app_name }}-net
# optional
volumes:
- "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_http_port {% raw %}}}{% endraw %}"
depends_on:
- other
- services
networks:
{{ cookiecutter.app_name }}-net

View File

@ -0,0 +1,2 @@
# Add environment variables for {{ cookiecutter.app_name }} here
# Note: This is a .ini file format

View File

@ -2,6 +2,7 @@
"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": "",
"http_port": "3000",
"github_user": "equinoxel",
"patreon_user": "laurivan",
"company": "",
@ -14,7 +15,7 @@
"python_docker_version": "6.0.1",
"molecule_docker_version": "2.1.0",
"ansible_lint_version":"6.14.4",
"yamllint_version": "1.29.0",
"yamllint_version": "1.30.0",
"license":"MIT",
"galaxy_tag_1":"tag1",
"galaxy_tag_2":"tag2",