diff --git a/README.MD b/README.MD index eecc07a..ad3bc6d 100644 --- a/README.MD +++ b/README.MD @@ -18,6 +18,8 @@ If you don't provide your own already-built site (with `cstate_repo` in `default 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. +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 shared folder. See [info](https://www.vagrantup.com/docs/synced-folders/virtualbox) diff --git a/Vagrantfile b/Vagrantfile index 7757ca6..a5dd731 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -16,6 +16,6 @@ Vagrant.configure("2") do |config| cstate.vm.network "forwarded_port", guest: 443, host: 4444, host_ip: "192.168.33.20" cstate.vm.network "forwarded_port", guest: 8080, host: 8081, host_ip: "192.168.33.20" cstate.vm.network "private_network", ip: "192.168.33.20" - cstate.vm.synced_folder "share", "/var/www/cstate", owner: "www-data", group: "www-data" +# cstate.vm.synced_folder "share", "/var/www/cstate", owner: "www-data", group: "www-data" end end diff --git a/defaults/main.yml b/defaults/main.yml index eb6be4a..4c7131b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,9 +1,11 @@ --- -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 diff --git a/tasks/generate.yml b/tasks/generate.yml index cc95834..33e8b85 100644 --- a/tasks/generate.yml +++ b/tasks/generate.yml @@ -1,6 +1,16 @@ --- +- name: '[GENERATE] - Update content git repo' + git: + repo: "{{ cstate_content_repo }}" + dest: "{{ cstate_dir }}/content" + become: yes + 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: yes + become_user: '{{ cstate_username }}' diff --git a/tasks/git.yml b/tasks/git.yml index d6a5918..f40320f 100644 --- a/tasks/git.yml +++ b/tasks/git.yml @@ -5,4 +5,20 @@ repo: "{{ cstate_repo }}" dest: "{{ cstate_dir }}" force: yes - update: yes \ No newline at end of file + update: yes + become: yes + 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: yes + become_user: "{{ cstate_username }}" + when: cstate_content_init is defined and cstate_content_init == 'true' diff --git a/tasks/issues.yml b/tasks/issues.yml new file mode 100644 index 0000000..e69de29 diff --git a/tasks/main.yml b/tasks/main.yml index 42e8127..ebd1828 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -15,4 +15,6 @@ - name: Update include: update.yml - when: cstate_update == 'yes' and cstate_public_repo|length > 0 + tags: + - update + - never