Merge pull request 'release1.0' (#3) from release1.0 into main

Reviewed-on: #3
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
This commit is contained in:
meaz 2023-05-16 19:17:52 +00:00
commit f995a877ca
7 changed files with 55 additions and 8 deletions

View file

@ -29,9 +29,15 @@ If you have uploaded the content of `/var/www/cstate` on your repo, add your rep
You can create issues files inside `/var/www/cstate/content/issues/` folder on your host (or in `/share/content/issues/` if your using Vagrant with the `share` synced folder). Then use `ansible-playbook -b Playbooks/cstate.yml --tags generate` to build those pages in the `public/` directory. The folder public can now be hosted on the production web server.
Once done, you can create issues files inside the `share/content/issues/` folder on your host. Then use `ansible-playbook -b Playbooks/cstate.yml --tags generate` to build those page in the `public/` directory. You can also have a **custom content repository** instead. Set `cstate_content_init` to `true` and `cstate_content_repo` to your content repo.
If you update the config file and want to generate new pages, you can run `ansible-playbook -b Playbooks/cstate.yml --tags configfile`
To update cstate just include `--tags update` to your playbook.
## Issue with vagrant
You may have to add `sendfile off;` to your Nginx config when using the role with Vagrant and a synced folder. See [info](https://www.vagrantup.com/docs/synced-folders/virtualbox)
## CHANGELOG
- **06.05.2023** - Add custom content repository
- **06.06.2022** - Create the role

View file

@ -1,16 +1,18 @@
---
cstate_update: 'no' # 'yes' to update your own built repo with latest cstate
cstate_extra_files_path: '../files' # needed if using a logo from somwhere else than the role 'files' folder.
# Vars to clone custom content repository
# cstate_content_init: 'false'
# cstate_content_repo: 'https://example.com'
cstate_apt:
- hugo
- git
cstate_username: 'www-data'
cstate_group: 'www-data'
cstate_repo: 'https://github.com/cstate/example.git' # Replace by your own cstate repo once built and hosted.
cstate_repo: 'https://github.com/cstate/example.git' # Replace by your own cstate repo once built and hosted. It will be your "theme "repo.
cstate_dir: '/var/www/cstate'
# Config file

View file

@ -8,6 +8,7 @@
group: "{{ cstate_group }}"
mode: 0644
trim_blocks: no # to be able to control indentation in template with {%- if %} (note the dash that removes the empty line among the keys)
tags: configfile
- name: '[CONFIG] - Add your logo'
copy:

View file

@ -1,6 +1,16 @@
---
- name: '[GENERATE] - Update content git repo'
git:
repo: "{{ cstate_content_repo }}"
dest: "{{ cstate_dir }}/content"
become: true
become_user: "{{ cstate_username }}"
when: cstate_content_init is defined and cstate_content_init == 'true'
- name: "[GENERATE] - Generate the public folder and files"
shell: hugo
args:
chdir: '{{ cstate_dir }}'
become: true
become_user: '{{ cstate_username }}'

View file

@ -1,8 +1,32 @@
---
- name: '[GIT] - Give www dir ownership to {{ cstate_username }}'
file:
path: '/var/www/'
state: directory
recurse: true
owner: "{{ cstate_username }}"
group: "{{ cstate_group }}"
- name: '[GIT] - Deploy source'
git:
repo: "{{ cstate_repo }}"
dest: "{{ cstate_dir }}"
force: yes
update: yes
update: yes
become: true
become_user: "{{ cstate_username }}"
- name: '[GIT] - Initiate content repo'
file:
path: '{{ cstate_dir }}/content'
state: 'absent'
when: cstate_content_init is defined and cstate_content_init == 'true'
- name: '[GIT] - Clone content git repo'
git:
repo: "{{ cstate_content_repo }}"
dest: "{{ cstate_dir }}/content"
become: true
become_user: "{{ cstate_username }}"
when: cstate_content_init is defined and cstate_content_init == 'true'

0
tasks/issues.yml Normal file
View file

View file

@ -12,8 +12,12 @@
- name: Build webpages with hugo
include_tasks: generate.yml
tags: generate
tags:
- configfile
- generate
- name: Update
include_tasks: update.yml
when: cstate_update == 'yes'
include_tasks:: update.yml
tags:
- update
- never