[INFO] Création du rôle (#1)

This commit is contained in:
2022-11-09 14:54:18 +00:00
parent a0a3d6f1d9
commit 74f9b1b429
9 changed files with 304 additions and 1 deletions

24
templates/hugo.service.j2 Normal file
View File

@@ -0,0 +1,24 @@
# {{ ansible_managed }}
[Unit]
Description=HuGO project {{ hugo_base_url }}
After=syslog.target
After=network.target
ConditionFileNotEmpty={{ hugo_data_path }}/config.yaml
[Service]
User=root
WorkingDirectory={{ hugo_data_path }}
{% if hugo_nginx_enabled %}
Type=oneshot
ExecStart=/usr/local/bin/hugo --cleanDestinationDir --baseURL {{ hugo_base_url }}
ExecStartPost=/usr/bin/rsync --delete-after --recursive --partial {{ hugo_data_path }}/public/ {{ hugo_nginx_docroot }}/
{% else %}
Type=simple
ExecStart=/usr/local/bin/hugo server --cleanDestinationDir --appendPort=false --bind={{ hugo_server_listen }} --port={{ hugo_server_port }} --baseURL={{ hugo_base_url }}
Restart=always
RestartSec=2s
{% endif %}
[Install]
WantedBy=multi-user.target

12
templates/hugo.timer.j2 Normal file
View File

@@ -0,0 +1,12 @@
# {{ ansible_managed }}
[Unit]
Description=HuGO to reload {{ hugo_base_url }}
ConditionFileNotEmpty={{ hugo_data_path }}/config.yaml
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.target