fix issue with www ownership

This commit is contained in:
meaz 2023-05-06 16:47:49 +02:00
parent 356870d7f3
commit 4e67d6a6e4
Signed by: meaz
GPG Key ID: CD7A47B2F1ED43B4
3 changed files with 14 additions and 6 deletions

View File

@ -2,7 +2,7 @@
cstate_extra_files_path: '../files' # needed if using a logo from somwhere else than the role 'files' folder.
#Vars to clone custom content repository
# Vars to clone custom content repository
cstate_content_init: 'false'
cstate_content_repo: 'https://example.com'
@ -12,7 +12,7 @@ cstate_apt:
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

@ -4,7 +4,7 @@
git:
repo: "{{ cstate_content_repo }}"
dest: "{{ cstate_dir }}/content"
become: yes
become: true
become_user: "{{ cstate_username }}"
when: cstate_content_init is defined and cstate_content_init == 'true'
@ -12,5 +12,5 @@
shell: hugo
args:
chdir: '{{ cstate_dir }}'
become: yes
become: true
become_user: '{{ cstate_username }}'

View File

@ -1,12 +1,20 @@
---
- 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
become: yes
become: true
become_user: "{{ cstate_username }}"
- name: '[GIT] - Initiate content repo'
@ -19,6 +27,6 @@
git:
repo: "{{ cstate_content_repo }}"
dest: "{{ cstate_dir }}/content"
become: yes
become: true
become_user: "{{ cstate_username }}"
when: cstate_content_init is defined and cstate_content_init == 'true'