Sync database from prod to dev #41818
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: 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' |