feat: add automatic website deployment
This commit is contained in:
parent
f23acb81a8
commit
63f325c616
11
.ansible-website/inventory
Normal file
11
.ansible-website/inventory
Normal file
@ -0,0 +1,11 @@
|
||||
all:
|
||||
children:
|
||||
sptarkov:
|
||||
hosts:
|
||||
sp-tarkov:
|
||||
ansible_host: {{ DEPLOY_HOSTNAME }}
|
||||
ansible_user: {{ DEPLOY_USER }}
|
||||
ansible_connection: paramiko_ssh
|
||||
ansible_ssh_pass: {{ DEPLOY_SSH_KEY_PASSPHRASE }}
|
||||
ansible_ssh_user: {{ DEPLOY_USER }}
|
||||
ansible_ssh_private_key_file: /drone/src/private.key # Hardcoded because created by the Drone plugin
|
11
.ansible-website/playbook.yml
Normal file
11
.ansible-website/playbook.yml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
- name: update the server
|
||||
hosts: sptarkov
|
||||
|
||||
tasks:
|
||||
- name: Update website
|
||||
git:
|
||||
repo: "{{ lookup('env', 'DRONE_REPO_LINK') }}"
|
||||
dest: "{{ lookup('env', 'SPT_WEBSITE_PATH') }}"
|
||||
update: yes
|
||||
version: master
|
2
.ansible-website/requirements.yml
Normal file
2
.ansible-website/requirements.yml
Normal file
@ -0,0 +1,2 @@
|
||||
collections:
|
||||
- name: community.general # For composer
|
@ -2,9 +2,6 @@ kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
concurrency:
|
||||
limit: 1
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
@ -65,18 +62,33 @@ steps:
|
||||
depends_on:
|
||||
- install dependencies and build frontend
|
||||
|
||||
- name: check ansible syntax
|
||||
- name: check db ansible syntax
|
||||
image: plugins/ansible:3
|
||||
settings:
|
||||
playbook: ./.ansible-items/playbook.yml
|
||||
inventory: ./.ansible-items/inventory
|
||||
galaxy: ./.ansible-items/requirements.yml
|
||||
syntax_check: true
|
||||
depends_on:
|
||||
- clone
|
||||
when:
|
||||
branch:
|
||||
- development
|
||||
|
||||
- name: apply ansible playbook
|
||||
- name: check website ansible syntax for items database
|
||||
image: plugins/ansible:3
|
||||
settings:
|
||||
playbook: ./.ansible-items/playbook.yml
|
||||
inventory: ./.ansible-items/inventory
|
||||
galaxy: ./.ansible-items/requirements.yml
|
||||
syntax_check: true
|
||||
depends_on:
|
||||
- clone
|
||||
when:
|
||||
branch:
|
||||
- development
|
||||
|
||||
- name: apply ansible playbook for items database
|
||||
image: plugins/ansible:3
|
||||
settings:
|
||||
playbook: ./.ansible-items/playbook.yml
|
||||
@ -94,10 +106,78 @@ steps:
|
||||
DEPLOY_USER_GROUP:
|
||||
from_secret: deploy_user_group
|
||||
SPT_ITEMS_PATH:
|
||||
from_secret: deploy_path
|
||||
from_secret: items_deploy_path
|
||||
depends_on:
|
||||
- test frontend
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
- main
|
||||
event:
|
||||
- promote
|
||||
target:
|
||||
- db
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- promote
|
||||
branch:
|
||||
- main
|
||||
|
||||
steps:
|
||||
- name: check website ansible syntax
|
||||
image: plugins/ansible:3
|
||||
settings:
|
||||
playbook: ./.ansible-website/playbook.yml
|
||||
inventory: ./.ansible-website/inventory
|
||||
galaxy: ./.ansible-website/requirements.yml
|
||||
syntax_check: true
|
||||
target:
|
||||
- website-check
|
||||
- website
|
||||
|
||||
- name: apply ansible playbook website
|
||||
image: plugins/ansible:3
|
||||
settings:
|
||||
playbook: ./.ansible-website/playbook.yml
|
||||
inventory: ./.ansible-website/inventory
|
||||
galaxy: ./.ansible-website/requirements.yml
|
||||
timeout: 60
|
||||
verbose: 2
|
||||
check: true
|
||||
environment:
|
||||
DEPLOY_HOSTNAME:
|
||||
from_secret: deploy_hostname
|
||||
DEPLOY_USER:
|
||||
from_secret: deploy_username
|
||||
DEPLOY_USER_GROUP:
|
||||
from_secret: deploy_user_group
|
||||
SPT_WEBSITE_PATH:
|
||||
from_secret: website_deploy_path
|
||||
target:
|
||||
- website-check
|
||||
|
||||
- name: apply ansible playbook website
|
||||
image: plugins/ansible:3
|
||||
settings:
|
||||
playbook: ./.ansible-website/playbook.yml
|
||||
inventory: ./.ansible-website/inventory
|
||||
galaxy: ./.ansible-website/requirements.yml
|
||||
timeout: 60
|
||||
verbose: 2
|
||||
environment:
|
||||
DEPLOY_HOSTNAME:
|
||||
from_secret: deploy_hostname
|
||||
DEPLOY_USER:
|
||||
from_secret: deploy_username
|
||||
DEPLOY_USER_GROUP:
|
||||
from_secret: deploy_user_group
|
||||
SPT_WEBSITE_PATH:
|
||||
from_secret: website_deploy_path
|
||||
target:
|
||||
- website
|
||||
|
Loading…
x
Reference in New Issue
Block a user