Add deploy script
This commit is contained in:
parent
eaff1a9239
commit
5035a5e90d
6 changed files with 110 additions and 16 deletions
93
ansible/deploy.yml
Normal file
93
ansible/deploy.yml
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
---
|
||||
- name: Deploy sepiatones_xyz project
|
||||
hosts: all
|
||||
become: yes
|
||||
vars:
|
||||
app_user: "sepiatones_xyz"
|
||||
app_home: "/home/{{ app_user }}"
|
||||
|
||||
tasks:
|
||||
- name: Ensure user exists
|
||||
user:
|
||||
name: "{{ app_user }}"
|
||||
shell: /bin/bash
|
||||
create_home: yes
|
||||
home: "{{ app_home }}"
|
||||
|
||||
- name: Create data directory
|
||||
file:
|
||||
path: "{{ app_home }}/data"
|
||||
state: directory
|
||||
owner: "{{ app_user }}"
|
||||
group: "{{ app_user }}"
|
||||
|
||||
- name: Create templates directory
|
||||
file:
|
||||
path: "{{ app_home }}/templates"
|
||||
state: directory
|
||||
owner: "{{ app_user }}"
|
||||
group: "{{ app_user }}"
|
||||
|
||||
- name: Copy binary to target location
|
||||
copy:
|
||||
src: /mnt/big/code/sepiatones_xyz/target/sepiatones_xyz
|
||||
dest: "{{ app_home }}/sepiatones_xyz"
|
||||
owner: "{{ app_user }}"
|
||||
group: "{{ app_user }}"
|
||||
mode: "0755"
|
||||
|
||||
- name: Copy data directory
|
||||
synchronize:
|
||||
src: /mnt/big/code/sepiatones_xyz/data/
|
||||
dest: "{{ app_home }}/data/"
|
||||
recursive: yes
|
||||
owner: no
|
||||
group: no
|
||||
archive: yes
|
||||
delete: yes
|
||||
|
||||
- name: Copy templates directory
|
||||
synchronize:
|
||||
src: /mnt/big/code/sepiatones_xyz/templates/
|
||||
dest: "{{ app_home }}/templates/"
|
||||
recursive: yes
|
||||
owner: no
|
||||
group: no
|
||||
archive: yes
|
||||
delete: yes
|
||||
|
||||
- name: Ensure Caddy directory exists
|
||||
file:
|
||||
path: /etc/caddy/sites
|
||||
state: directory
|
||||
|
||||
- name: Copy Caddy configuration
|
||||
copy:
|
||||
src: /mnt/big/code/sepiatones_xyz/ansible/sepiatones_xyz.caddy
|
||||
dest: /etc/caddy/sites/sepiatones_xyz.caddy
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Ensure Supervisor directory exists
|
||||
file:
|
||||
path: /etc/supervisor/conf.d
|
||||
state: directory
|
||||
|
||||
- name: Copy Supervisor configuration
|
||||
copy:
|
||||
src: /mnt/big/code/sepiatones_xyz/ansible/sepiatones_xyz.supervisor
|
||||
dest: /etc/supervisor/conf.d/sepiatones_xyz.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Reload Supervisor
|
||||
supervisorctl:
|
||||
name: sepiatones_xyz
|
||||
state: present
|
||||
|
||||
- name: Restart the service
|
||||
supervisorctl:
|
||||
name: sepiatones_xyz
|
||||
state: restarted
|
||||
Loading…
Add table
Add a link
Reference in a new issue