Ansible zola
How to install latest version of zola on linux with ansible
The following ansible code relies on having a zola environment setup in a repository on Github already.
.gitignore
to exclude themes folder will be cloned seperately:
**/themes/
---
- hosts: web
tasks:
- name: get lates zola url
shell: curl -L -s https://api.github.com/repos/getzola/zola/releases/latest | grep -o -E "https://.*zola.*linux.*.tar.gz"
register: zola_url
- debug:
msg: "{{ zola_url.stdout }}"
- name: download and unarchive lastest zola release
unarchive:
src: "{{ zola_url.stdout }}"
dest: ~/bin
remote_src: yes
- name: git clone a existing private zola repository with ignored themes folder into ~/git/
git:
repo: git@github.com:<githubid>/zola.git
dest: ~/git/zola
- name: themes folder will be filled from source by git clone a zola theme
git:
repo: https://github.com/RatanShreshtha/DeepThought.git
dest: ~/git/zola/themes/DeepThought
- hosts: web
become: yes
tasks:
- name: build zola
shell: /home/$SUDO_USER/bin/zola --root /home/$SUDO_USER/git/zola build --output-dir /var/www/html/$SUDO_USER
- name: restart nginx
service:
name: nginx
state: restarted