Create Role

This commit is contained in:
nono
2022-04-20 17:14:35 +02:00
parent 27caf9156c
commit a08f49a53a
16 changed files with 294 additions and 2 deletions

31
tasks/build.yml Normal file
View File

@@ -0,0 +1,31 @@
- name: Verify the webroot exists
file:
path: "{{ hugo_deploy_dest_webroot }}"
state: directory
owner: www-data
group: www-data
mode: 0755
- block:
- name: Build Openring
shell:
cmd: go build
chdir: "{{ hugo_deploy_download_path}}/tools/openring"
- name: Generate Openring
shell:
cmd: ./openring -s https://www.laquadrature.net/feed -s https://blog.mondediplo.net/rss/ -s https://solar.lowtechmagazine.com/feeds/all-en.rss.xml < {{hugo_deploy_download_path}}/themes/blogotheme/layouts/partials/openring-in.html > {{hugo_deploy_download_path}}/themes/blogotheme/layouts/partials/openring-out.html
chdir: "{{hugo_deploy_download_path}}/tools/openring/"
when: hugo_deploy_build_openring
- name: Building the website with Hugo
shell:
cmd: hugo --themesDir themes --theme blogotheme --baseURL="http://{{ hugo_deploy_site_url }}" --enableGitInfo --minify --templateMetrics
chdir: "{{ hugo_deploy_download_path }}"
- name: Copy the website to it's webroot
copy:
remote_src: yes
src: "{{ hugo_deploy_download_path }}/public/"
dest: "{{ hugo_deploy_dest_webroot }}"

22
tasks/dependecies.yml Normal file
View File

@@ -0,0 +1,22 @@
- name: Update the APT cache
apt:
update_cache: yes
- name: Make sure Hugo is installed
package:
name: hugo
state: present
- name: Make sure git is installed
package:
name: git
state: present
- block:
- name: Make sure Golang is installed
package:
name: golang
state: present
when: hugo_deploy_build_openring

13
tasks/import-website.yml Normal file
View File

@@ -0,0 +1,13 @@
- name: Verify that the path to download the website exists
file:
path: "{{ hugo_deploy_download_path }}"
state: directory
mode: '0755'
- name: Clone the git repo for the website
git:
repo: "{{ hugo_deploy_website_git_url }}"
dest: "{{ hugo_deploy_download_path }}"
accept_hostkey: yes
force: yes

11
tasks/main.yml Normal file
View File

@@ -0,0 +1,11 @@
---
# tasks file for ansible-role-hugo-deploy
- name: Verify dependecies
import_tasks: dependecies.yml
- name: Import the website
import_tasks: import-website.yml
- name: Build the website
import_tasks: build.yml