-
Notifications
You must be signed in to change notification settings - Fork 3
45 lines (38 loc) · 1.18 KB
/
sync-db.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Sync database from prod to dev
on:
schedule:
- cron: '*/30 * * * *' # Every minute 0 (every hour)
concurrency:
group: sync-database
jobs:
sync-db:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ansible==6.4.0 requests
- name: set ansible config secrets
env:
ANSIBLE_VAULT_PASSWORD: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
run: |
echo "$ANSIBLE_VAULT_PASSWORD" > .ansible-vault-password
- name: Load ssh key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.AUTOMATION_SSH_KEY }}
- name: run playbook
run: |
ansible-playbook -i environments/prod/hosts sync-backup-database.yml \
--vault-password-file .ansible-vault-password \
--tags sync-db \
--extra-vars "ansible_user=automation"
env:
ANSIBLE_HOST_KEY_CHECKING: 'False'