This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
homeserver-ansible/roles/services/website/tasks/main.yml
2022-05-10 22:11:16 -04:00

46 lines
1.1 KiB
YAML

- name: Install required packages
community.general.pacman:
name:
- cpio
- lowdown
state: present
- name: Create site source folder
file:
owner: http
group: http
path: "/srv/web_source"
state: directory
recurse: yes
register: site_perm
- name: Fetch site source
git:
dest: "/srv/web_source"
repo: "{{ site_repo }}"
register: site_source
become_user: http
- name: Make site directory in web root
file:
group: http
owner: http
path: "{{ webroot }}/site/"
state: directory
register: site_folder
- name: Deploy source to web root
shell:
cmd: "./ssg6 src {{ webroot }}/site/ 'dogeystamp' 'https://{{ domain }}/site'"
chdir: /srv/web_source
when: site_source.changed or site_folder.changed or site_perm.changed
become_user: http
- name: Cronjob to deploy source
cron:
user: http
name: "Update and deploy website source"
minute: 0
hour: "*/12"
job: "git -C /srv/web_source/ pull && /srv/web_source/ssg6 /srv/web_source/src {{ webroot }}/site/ '{{ web_name }}' 'https://{{ domain }}/site'"