add ansible script
parent
a123ec71be
commit
7e403d11da
|
@ -1,28 +1,25 @@
|
||||||
name: deployment
|
name: deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
repository_dispatch:
|
|
||||||
types: [update_deployment]
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: update compose deployment
|
- name: Prepare environment
|
||||||
run: |
|
run: |
|
||||||
# validate config
|
id
|
||||||
docker-compose config -q
|
|
||||||
# set up ssh
|
|
||||||
eval $(ssh-agent -s)
|
eval $(ssh-agent -s)
|
||||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" | tr -d '\r' | ssh-add -
|
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
chmod 700 ~/.ssh
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
||||||
touch ~/.ssh/known_hosts
|
ssh-keyscan akheron.rudin.io >> ~/.ssh/known_hosts
|
||||||
chmod 644 ~/.ssh/known_hosts
|
chmod -R 700 ~/.ssh
|
||||||
ssh-keyscan pandorabox.io >> ~/.ssh/known_hosts
|
ansible-galaxy collection install community.general
|
||||||
# execute deployment script
|
- name: Run ansible
|
||||||
cat scripts/deploy.sh | ssh root@pandorabox.io "cd /data/pandorabox.io && /bin/bash -"
|
run: |
|
||||||
|
ansible-playbook -i hosts --private-key ~/.ssh/id_rsa deploy.yml
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
remote_user: root
|
||||||
|
vars:
|
||||||
|
compose_directory: /data/pandorabox.io
|
||||||
|
tasks:
|
||||||
|
- name: Checkout git master
|
||||||
|
ansible.builtin.git:
|
||||||
|
repo: https://github.com/pandorabox-io/pandorabox.io
|
||||||
|
dest: "{{ compose_directory }}"
|
||||||
|
single_branch: yes
|
||||||
|
version: master
|
||||||
|
|
||||||
|
- name: Generate minetest config
|
||||||
|
shell:
|
||||||
|
cmd: "cat minetest.conf minetest.conf.keys > data/minetest/minetest.conf"
|
||||||
|
chdir: "{{ compose_directory }}"
|
||||||
|
|
||||||
|
- name: Create and start services
|
||||||
|
community.general.docker_compose:
|
||||||
|
project_src: "{{ compose_directory }}"
|
||||||
|
pull: yes
|
||||||
|
build: yes
|
||||||
|
remove_orphans: yes
|
||||||
|
|
||||||
|
- name: Reload nginx config
|
||||||
|
shell:
|
||||||
|
cmd: "docker-compose exec -T nginx nginx -s reload"
|
||||||
|
chdir: "{{ compose_directory }}"
|
Loading…
Reference in New Issue