Add Deployment Files
This commit is contained in:
42
.github/workflows/action-deploy.yml
vendored
Normal file
42
.github/workflows/action-deploy.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# This is a basic workflow to help you get started with Actions
|
||||||
|
|
||||||
|
name: Ansible Deployment
|
||||||
|
|
||||||
|
# Controls when the workflow will run
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["Docker Build"]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Run Ansible playbook
|
||||||
|
# uses: dawidd6/action-ansible-playbook@v2.5.0
|
||||||
|
uses: dawidd6/action-ansible-playbook@671974ed60e946e11964cb0c26e69caaa4b1f559
|
||||||
|
with:
|
||||||
|
playbook: playbook.yml
|
||||||
|
directory: ./
|
||||||
|
key: ${{secrets.DEPLOY_SSH_KEY}}
|
||||||
|
inventory: |
|
||||||
|
[docker]
|
||||||
|
fluttershub.com
|
||||||
|
[docker:vars]
|
||||||
|
ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
||||||
|
ansible_ssh_user=deploy
|
||||||
|
options: |
|
||||||
|
--verbose
|
||||||
|
# Set to "true" if root is required for running your playbook
|
||||||
|
# sudo: false # optional
|
||||||
|
# Set to "true" if the Ansible output should not include colors (defaults to "false")
|
||||||
|
# no_color: # optional
|
||||||
29
playbook.yml
Normal file
29
playbook.yml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
- hosts: docker
|
||||||
|
tasks:
|
||||||
|
- name: Ensures ~/docker/home dir exists
|
||||||
|
file:
|
||||||
|
path: ~/docker/home
|
||||||
|
state: directory
|
||||||
|
owner: deploy
|
||||||
|
group: deploy
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: "Copy home Compose files"
|
||||||
|
copy:
|
||||||
|
src: ./{{ item }}
|
||||||
|
dest: "~/docker/home/{{ item }}"
|
||||||
|
owner: deploy
|
||||||
|
group: deploy
|
||||||
|
mode: '0755'
|
||||||
|
loop:
|
||||||
|
- docker-compose.yml
|
||||||
|
register: compose
|
||||||
|
|
||||||
|
- name: deploy Docker Compose stack if updated
|
||||||
|
community.docker.docker_compose:
|
||||||
|
project_src: "~/docker/home"
|
||||||
|
pull: true
|
||||||
|
files:
|
||||||
|
- docker-compose.yml
|
||||||
|
when: compose.changed
|
||||||
Reference in New Issue
Block a user