3 Commits

Author SHA1 Message Date
a412940e75 chore(release): 1.1.0 2023-04-27 22:05:51 +02:00
bda1f187c5 feat: Better default configuration.
Add multiple files copy via variables.
Add service skeleton.
Add image and port versions.
2023-04-27 22:05:41 +02:00
8adf037392 chore: Updates and cleanups
- Update ansible lint version
- Add default doc link
- Support for 4.x molecule version
2023-04-11 22:16:41 +02:00
9 changed files with 58 additions and 17 deletions

View File

@@ -2,6 +2,13 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [1.1.0](https://git.laurivan.com/Dev/cookiecutter-ansible-role-docker/compare/v1.0.3...v1.1.0) (2023-04-27)
### Features
* Better default configuration. ([bda1f18](https://git.laurivan.com/Dev/cookiecutter-ansible-role-docker/commit/bda1f187c5b2c02042c8d34ddde5bec5b77a13f9))
### [1.0.3](https://git.laurivan.com/Dev/cookiecutter-ansible-role-docker/compare/v1.0.2...v1.0.3) (2023-02-16)

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,11 +3,11 @@
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 }}
min_ansible_container_version: {{ cookiecutter.min_ansible_container_version }}
min_ansible_version: "{{ cookiecutter.min_ansible_version }}"
min_ansible_container_version: "{{ cookiecutter.min_ansible_container_version }}"
license: {{ cookiecutter.license }}
galaxy_tags:
- {{ cookiecutter.galaxy_tag_1 }}
@@ -19,6 +19,6 @@ galaxy_info:
- {{ ver }}{% endfor %}
{% endif %}{% if cookiecutter.platforms.ubuntu_list %}
- name: Ubuntu
versions: {% for ver in cookiecutter.platforms.ubuntu_list %}
versions:{% for ver in cookiecutter.platforms.ubuntu_list %}
- {{ ver }}{% endfor %}
{% endif %}

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": "",
@@ -13,8 +14,8 @@
"molecule_version": "4.0.4",
"python_docker_version": "6.0.1",
"molecule_docker_version": "2.1.0",
"ansible_lint_version":"6.12.2",
"yamllint_version": "1.29.0",
"ansible_lint_version":"6.14.4",
"yamllint_version": "1.30.0",
"license":"MIT",
"galaxy_tag_1":"tag1",
"galaxy_tag_2":"tag2",
@@ -26,5 +27,5 @@
"has_files":["True", "False"],
"has_handlers":["True", "False"],
"has_templates":["True", "False"],
"documentation_URL":""
"documentation_URL":"https://www.laurivan.com"
}

View File

@@ -12,8 +12,8 @@ def checkInput():
print("Error: app_name should not have _role or -role at the end, try again without it")
print(" The name of the role will the value you introduce in app_name plus _role appended")
sys.exit(1)
if not moleculeVersion.startswith("3"):
print("Error: Only supported molecule version 3.x.x, please change it and try again")
if not (moleculeVersion.startswith("3") or moleculeVersion.startswith("4")):
print("Error: Only supported molecule version 3.x.x or 4.x.x, please change it and try again")
sys.exit(1)
def configureRole():