+ Ansible script for sending up server fiesl to a vps

This commit is contained in:
shockrah 2021-10-22 20:18:31 -07:00
parent bb69c37a5a
commit a0bf263014

View File

@ -0,0 +1,49 @@
# This playbooks basically takes a build/ directory similar to what the Gitlab
# pipelines generate and uploads those files to the desired directory
---
- hosts: mainhost
remote_user: admin
vars:
app_dir: /opt/app
tasks:
- name: Build skeleton root directory
file:
path: '{{app_dir}}'
state: directory
- name: Build skeleton css directory
file:
path: '{{app_dir}}/css'
state: directory
- name: Build skeleton js directory
file:
path: '{{app_dir}}/js'
state: directory
- name: Build skeleton templates directory
file:
path: '{{app_dir}}/templates'
state: directory
- name: Update Binary installation
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- { src: ../../build/static/css/style.css, dest: '{{app_dir}}/'}
- { src: ../../build/static/js/index.js, dest: '{{app_dir}}/js/'}
- { src: ../../build/static/js/category.js, dest: '{{app_dir}}/js/'}
- { src: ../../build/static/cantfindshit.jpg, dest: '{{app_dir}}/'}
- { src: ../../build/static/favicon.png, dest: '{{app_dir}}/'}
- { src: ../../build/templates/list.html.tera, dest: '{{app_dir}}/templates/list.html.tera'}
- { src: ../../build/templates/video.html.tera, dest: '{{app_dir}}/templates/video.html.tera'}
- { src: ../../build/Rocket.toml, dest: '{{app_dir}}/'}
- { src: ../../build/server, dest: '{{app_dir}}/'}
- name: Restart web service
become: yes
become_method: sudo
service:
name: app
state: restarted