Add hugo
parent
ad4fd14ab2
commit
8085f41cda
4
all.yml
4
all.yml
|
@ -43,3 +43,7 @@
|
|||
- funwkhale
|
||||
- music
|
||||
- docker
|
||||
- role: hugo
|
||||
tags:
|
||||
- docker
|
||||
- hugo
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
- name: Create Hugo directory
|
||||
file:
|
||||
path: "{{ hugo_folder_name }}"
|
||||
state: directory
|
||||
owner: "{{ base_user_name }}"
|
||||
group: "{{ base_user_name }}"
|
||||
mode: 0755
|
||||
|
||||
- name: Copy Hugo Compose file
|
||||
template:
|
||||
src: docker-compose.yml.j2
|
||||
# Remove .j2 extension
|
||||
dest: "{{ hugo_folder_name }}/docker-compose.yml"
|
||||
owner: "{{ base_user_name }}"
|
||||
group: "{{ base_user_name }}"
|
||||
mode: 0644
|
||||
|
||||
- name: Clone blog
|
||||
ansible.builtin.git:
|
||||
repo: "{{ repository_url }}"
|
||||
dest: "{{ hugo_website }}"
|
||||
force: yes
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Pull new stuff
|
||||
shell:
|
||||
cmd: git pull
|
||||
chdir: "{{ hugo_website }}"
|
||||
|
||||
- name: Ensure container is up to date
|
||||
community.docker.docker_compose:
|
||||
project_src: "{{ hugo_folder_name }}"
|
||||
remove_orphans: yes
|
||||
pull: yes
|
||||
recreate: smart
|
||||
state: present
|
|
@ -0,0 +1,48 @@
|
|||
version: "{{ compose_version }}"
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
name: "{{ traefik_network }}"
|
||||
|
||||
# Use a bind mount for Hugo data, easier to pull new versions of blog
|
||||
volumes:
|
||||
website_files:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: none
|
||||
device: "{{ hugo_website }}"
|
||||
o: bind
|
||||
website_public:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: none
|
||||
device: "{{ hugo_website }}/public"
|
||||
o: bind
|
||||
|
||||
services:
|
||||
builder:
|
||||
container_name: hugo_builder
|
||||
image: "klakegg/hugo:{{ hugo_version }}"
|
||||
volumes:
|
||||
- website_files:/src
|
||||
# Hugo will build only
|
||||
# when triggered
|
||||
restart: on-failure
|
||||
|
||||
front:
|
||||
container_name: hugo_front
|
||||
image: nginx:alpine
|
||||
volumes:
|
||||
- website_public:/usr/share/nginx/html:ro
|
||||
labels:
|
||||
traefik.http.routers.hugo.entrypoints: websecure
|
||||
traefik.http.routers.hugo.rule: "Host(`blog.{{ domain_name }}`)"
|
||||
traefik.http.services.hugo.loadbalancer.server.port: 80
|
||||
traefik.enable: true
|
||||
networks:
|
||||
- proxy
|
||||
read_only: true
|
||||
tmpfs:
|
||||
- /var/cache/nginx
|
||||
- /run
|
||||
restart: unless-stopped
|
|
@ -0,0 +1,6 @@
|
|||
hugo_folder_name: "{{ docker_files }}/hugo"
|
||||
hugo_website: "{{ hugo_folder_name }}/website"
|
||||
# Use extended edition with Git inside
|
||||
# to read git info (useful for lastmod)
|
||||
hugo_version: 0.83.1-ext-alpine
|
||||
repository_url: https://git.chosto.me/Chosto/blog.git
|
Loading…
Reference in New Issue