Add plays to backup and install a hexo server

This commit is contained in:
Shaun Reed 2020-05-23 03:48:26 +00:00
parent 1a3270d012
commit 7557122774
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,13 @@
---
- hosts: hexo
become: yes
tasks:
- name: Backup Hexo files
archive:
path: /home/hexouser/blogsite
dest: /home/hexouser/blogsite.tgz
- name: Fetching backup files
fetch:
src: /home/hexouser/blogsite.tgz
dest: /home/ansibleuser/backups/
flat: yes

View File

@ -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: hexouser
shell: /bin/bash
groups: sudo
uid: 1003
- name: Initialize site files
command:
chdir: /home/hexouser/
cmd: hexo init blogsite
- name: Install site packages
npm:
path: /home/hexouser/blogsite/
- name: Start server
command:
chdir: /home/hexouser/blogsite/
cmd: nohup hexo server &
async: 45
poll: 0