diff --git a/ansible-role-{{cookiecutter.app_name}}/README.md b/ansible-role-{{cookiecutter.app_name}}/README.md index 015ec15..5aa5c0f 100644 --- a/ansible-role-{{cookiecutter.app_name}}/README.md +++ b/ansible-role-{{cookiecutter.app_name}}/README.md @@ -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 diff --git a/ansible-role-{{cookiecutter.app_name}}/defaults/main.yml b/ansible-role-{{cookiecutter.app_name}}/defaults/main.yml index 71f1471..f7c10c9 100644 --- a/ansible-role-{{cookiecutter.app_name}}/defaults/main.yml +++ b/ansible-role-{{cookiecutter.app_name}}/defaults/main.yml @@ -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 }}" diff --git a/ansible-role-{{cookiecutter.app_name}}/meta/main.yml b/ansible-role-{{cookiecutter.app_name}}/meta/main.yml index 3333871..1956ef9 100644 --- a/ansible-role-{{cookiecutter.app_name}}/meta/main.yml +++ b/ansible-role-{{cookiecutter.app_name}}/meta/main.yml @@ -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 }}" diff --git a/ansible-role-{{cookiecutter.app_name}}/tasks/config.yml b/ansible-role-{{cookiecutter.app_name}}/tasks/config.yml index 2253e17..4419edb 100644 --- a/ansible-role-{{cookiecutter.app_name}}/tasks/config.yml +++ b/ansible-role-{{cookiecutter.app_name}}/tasks/config.yml @@ -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 \ No newline at end of file diff --git a/ansible-role-{{cookiecutter.app_name}}/templates/docker-compose.yml.j2 b/ansible-role-{{cookiecutter.app_name}}/templates/docker-compose.yml.j2 index 2522b59..a0cd401 100644 --- a/ansible-role-{{cookiecutter.app_name}}/templates/docker-compose.yml.j2 +++ b/ansible-role-{{cookiecutter.app_name}}/templates/docker-compose.yml.j2 @@ -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 \ No newline at end of file diff --git a/ansible-role-{{cookiecutter.app_name}}/templates/env.{{ cookiecutter.app_name }}.conf.j2 b/ansible-role-{{cookiecutter.app_name}}/templates/env.{{ cookiecutter.app_name }}.conf.j2 new file mode 100644 index 0000000..71c5371 --- /dev/null +++ b/ansible-role-{{cookiecutter.app_name}}/templates/env.{{ cookiecutter.app_name }}.conf.j2 @@ -0,0 +1,2 @@ +# Add environment variables for {{ cookiecutter.app_name }} here +# Note: This is a .ini file format diff --git a/cookiecutter.json b/cookiecutter.json index 6d3a13d..d3315d8 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -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",