From bb4f3dd87694d8749df3c03d515927122ad8102f Mon Sep 17 00:00:00 2001 From: DogeyStamp Date: Tue, 5 Apr 2022 20:43:18 -0400 Subject: [PATCH] Switch website configuration over to ssg --- group_vars/all/vars.yml | 5 ++++- roles/services/website/tasks/main.yml | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index 98c60f5..a710dbe 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -28,12 +28,15 @@ sftp_ro_username: dogeystamp-mobile # Git repos (could be localhost if Gitea is installed) dots_repo: http://localhost:3000/dogeystamp/dots.git -site_repo: http://localhost:3000/dogeystamp/website.git +site_repo: http://localhost:3000/dogeystamp/wb4.git # Drive with all the data stored on it (should be separate from OS drive) # This is the raw partition, and not the mapped crypt device secondary_disk: /dev/sdb +# Title used for the static website generator +web_name: dogeystamp + # Web root for nginx and other applications webroot: /srv/http diff --git a/roles/services/website/tasks/main.yml b/roles/services/website/tasks/main.yml index fcf2d7c..36b977f 100644 --- a/roles/services/website/tasks/main.yml +++ b/roles/services/website/tasks/main.yml @@ -1,4 +1,27 @@ - name: Fetch site source git: - dest: "{{ webroot }}/site" + dest: "/srv/web_source" repo: "{{ site_repo }}" + register: site_source + +- name: Make site directory in web root + file: + group: gitea + owner: gitea + 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 + +- name: Cronjob to deploy source + cron: + user: http + name: "Update and deploy website source" + minute: 0 + hour: "*/12" + job: "/srv/web_source/ssg6 /srv/web_source/src {{ webroot }}/site/ '{{ web_name }}' 'https://{{ domain }}/site'"