52 lines
2.7 KiB
Django/Jinja
52 lines
2.7 KiB
Django/Jinja
# Ansible Roles for managing Auengun.net Infrastructure & Testing/Learning.
|
|
# Source available at git.auengun.net/homelab/ansible-collection
|
|
# Copyright (C) 2023 GregoryDosh
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
# License, or (at your option) any later version.
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
# SPDX-FileCopyrightText: 2023 GregoryDosh
|
|
|
|
[Unit]
|
|
Description={{ DCAASS_SERVICE_NAME }} (DCaaSS)
|
|
Requires={{ DCAASS_SERVICE_REQUIRES }}
|
|
After={{ DCAASS_SERVICE_AFTER }}
|
|
ConditionFileNotEmpty={{ DCAASS_CONFIG_PATH }}/{{ DCAASS_ENV_FILE_NAME }}
|
|
ConditionFileNotEmpty={{ DCAASS_CONFIG_PATH }}/docker-compose.yml
|
|
{{ DCAASS_SERVICE_EXTRA_CONFIG_UNIT }}
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
RemainAfterExit=true
|
|
User={{ DCAASS_CONFIG_USER_NAME }}
|
|
Group={{ DCAASS_CONFIG_GROUP_NAME }}
|
|
WorkingDirectory={{ DCAASS_CONFIG_PATH }}
|
|
Restart={{ DCAASS_SERVICE_RESTART_POLICY }}
|
|
RestartSec={{ DCAASS_SERVICE_RESTART_SEC }}
|
|
SyslogIdentifier={{ DCAASS_SERVICE_NAME }}
|
|
|
|
ExecStartPre=-{{ SH_BIN_ABSOLUTE_PATH }} -c '{{ DOCKER_BIN_ABSOLUTE_PATH }}{{ DCAASS_DOCKER_COMPOSE_SEPARATOR }}compose build 2>/dev/null || true'
|
|
ExecStartPre=-{{ SH_BIN_ABSOLUTE_PATH }} -c '{{ DOCKER_BIN_ABSOLUTE_PATH }}{{ DCAASS_DOCKER_COMPOSE_SEPARATOR }}compose pull 2>/dev/null || true'
|
|
ExecStartPre=-{{ SH_BIN_ABSOLUTE_PATH }} -c '{{ DOCKER_BIN_ABSOLUTE_PATH }}{{ DCAASS_DOCKER_COMPOSE_SEPARATOR }}compose kill 2>/dev/null || true'
|
|
ExecStartPre=-{{ SH_BIN_ABSOLUTE_PATH }} -c '{{ DOCKER_BIN_ABSOLUTE_PATH }}{{ DCAASS_DOCKER_COMPOSE_SEPARATOR }}compose rm 2>/dev/null || true'
|
|
ExecStartPre={{ DOCKER_BIN_ABSOLUTE_PATH }}{{ DCAASS_DOCKER_COMPOSE_SEPARATOR }}compose create {{ DCAASS_DOCKER_COMPOSE_CREATE_EXTRA_OPTIONS }}
|
|
ExecStart={{ DOCKER_BIN_ABSOLUTE_PATH }}{{ DCAASS_DOCKER_COMPOSE_SEPARATOR }}compose up {{ DCAASS_DOCKER_COMPOSE_EXTRA_UP_OPTIONS }} -d
|
|
ExecReload={{ DOCKER_BIN_ABSOLUTE_PATH }}{{ DCAASS_DOCKER_COMPOSE_SEPARATOR }}compose up {{ DCAASS_DOCKER_COMPOSE_EXTRA_UP_OPTIONS }} -d
|
|
ExecStop={{ DOCKER_BIN_ABSOLUTE_PATH }}{{ DCAASS_DOCKER_COMPOSE_SEPARATOR }}compose down {{ DCAASS_DOCKER_COMPOSE_EXTRA_DOWN_OPTIONS }}
|
|
|
|
{{ DCAASS_SERVICE_EXTRA_CONFIG_SERVICE }}
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
{{ DCAASS_SERVICE_EXTRA_CONFIG_INSTALL }}
|