Add hexo playbooks for install and backups
This commit is contained in:
parent
ea6a43b8b0
commit
ad91b3b892
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
- hosts: hexo
|
||||||
|
become: yes
|
||||||
|
tasks:
|
||||||
|
- name: Backup Hexo files
|
||||||
|
archive:
|
||||||
|
path: /home/hexouser/site
|
||||||
|
dest: /home/hexouser/site.tgz
|
||||||
|
- name: Fetching backup files
|
||||||
|
fetch:
|
||||||
|
src: /home/hexo/site.tgz
|
||||||
|
dest: /home/someuser/backups/
|
||||||
|
flat: yes
|
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
- name: Install Hexo static site generator
|
||||||
|
hosts: hexo
|
||||||
|
become: yes
|
||||||
|
tasks:
|
||||||
|
- name: Update apt sources and install npm
|
||||||
|
apt:
|
||||||
|
name: npm
|
||||||
|
state: present
|
||||||
|
update_cache: yes
|
||||||
|
- name: Install hexo-cli
|
||||||
|
npm:
|
||||||
|
name: hexo-cli
|
||||||
|
global: yes
|
||||||
|
- name: Adding hexo user / administrator
|
||||||
|
user:
|
||||||
|
name: hexo
|
||||||
|
shell: /bin/bash
|
||||||
|
groups: sudo
|
||||||
|
uid: 1001
|
||||||
|
- name: Initialize site files
|
||||||
|
command:
|
||||||
|
chdir: /home/hexo/
|
||||||
|
cmd: hexo init site
|
||||||
|
- name: Install site packages
|
||||||
|
npm:
|
||||||
|
path: /home/hexo/site/
|
||||||
|
- name: Start server
|
||||||
|
command:
|
||||||
|
chdir: /home/hexo/site/
|
||||||
|
cmd: nohup hexo server &
|
||||||
|
async: 45
|
||||||
|
poll: 0
|
||||||
|
|
Loading…
Reference in New Issue