ansible-edda/playbooks/roles/services/deploy/www/tasks/main.yml

57 lines
1.7 KiB
YAML

---
- name: "set the user variables"
ansible.builtin.import_role:
name: "services/include"
vars_from: "user"
- name: "check if hugo is installed"
ansible.builtin.stat:
path: "/usr/local/bin/hugo"
register: services_deploy_www_hugo_path
- block:
- name: "install hugo"
ansible.builtin.apt:
deb: "\
https://github.com/gohugoio/hugo/releases/download/\
v{{ services_deploy_www_hugo_version }}/\
hugo_extended_{{ services_deploy_www_hugo_version }}_Linux-64bit.deb"
when:
not services_deploy_www_hugo_path.stat.exists
- name: "pin hugo version"
ansible.builtin.template:
src: "./hugo/apt"
dest: "/etc/apt/preferences.d/hugo"
mode: 0644
vars:
services_deploy_www_hugo_version: "0.56.0"
- block:
- name: "clone website repository"
ansible.builtin.git:
repo: "\
https://{{ services[services_service_name].repo.user }}:\
{{ services[services_service_name].repo.token }}@\
git.thenineworlds.net/wojtek/wojciechkozlowski.eu.git"
dest: "{{ services_service_user_home }}/.config/service/wojciechkozlowski.eu"
recursive: true
ignore_errors: true
register: services_deploy_www_webiste_git
- name: "generate static page using hugo"
ansible.builtin.command:
cmd: "hugo"
chdir: "{{ services_service_user_home }}/.config/service/wojciechkozlowski.eu"
when:
services_deploy_www_webiste_git.changed
become_user: "{{ services_service_user_name }}"
- name: "{{ services_service_name }} : configure systemd service"
ansible.builtin.include_role:
name: "services/deploy/pod"