role_hugo/templates/hugo.service.j2

25 lines
749 B
Django/Jinja

# {{ 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