Skip to content

Commit

Permalink
add github action ansible deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
sirodoht committed May 10, 2024
1 parent 1ac227f commit 20427f2
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy

on:
push:
branches: [ "main" ]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.12"

- name: Load SSH key
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/huron.key
chmod 600 ~/.ssh/huron.key
env:
SSH_KEY: ${{ secrets.SSH_KEY }}

- name: Install ansible
run: pip install ansible==9.5.1

- name: Run ansible
run: cd ansible/ && ansible-playbook playbook.yaml --start-at-task="clone"
env:
ANSIBLE_HOST_KEY_CHECKING: False
ANSIBLE_PRIVATE_KEY_FILE: "~/.ssh/huron.key"
ANSIBLE_HOST: ${{ vars.ANSIBLE_HOST }}
ANSIBLE_USER: ${{ vars.ANSIBLE_USER }}
DEBUG: ${{ vars.DEBUG }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}

0 comments on commit 20427f2

Please sign in to comment.