Fix docker service stop #136
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ansible deploy | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: {} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: | |
- media.bovbel.com | |
# - home.bovbel.com | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Join tailnet | |
uses: tailscale/github-action@v2 | |
with: | |
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} | |
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} | |
tags: tag:server | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.SSH_KEY }} | |
name: id_rsa | |
known_hosts: unnecessary | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: 'pip' | |
- name: Install pip dependencies | |
run: pip install -r requirements.txt | |
- name: Cache ansible | |
uses: actions/cache@v2 | |
with: | |
path: ~/.ansible/collections | |
key: ${{ hashFiles('requirements.yaml') }} | |
- name: Install ansible galaxy | |
shell: bash | |
env: | |
VAULT_PASS : ${{ secrets.VAULT_PASS }} | |
run: ansible-galaxy install -r requirements.yaml | |
- name: Run ansible | |
shell: bash | |
env: | |
TARGET : ${{ matrix.target }} | |
VAULT_PASS : ${{ secrets.VAULT_PASS }} | |
run: | | |
ssh-keyscan -H $TARGET >> ~/.ssh/known_hosts && | |
ansible-playbook -i inventory/bovbel --limit $TARGET playbooks/lab.yaml --vault-password-file <(cat <<<"$VAULT_PASS") |