Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Config Branch #210

Closed
wants to merge 12 commits into from
Closed
15 changes: 9 additions & 6 deletions .github/workflows/oracle-db-backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
environment: ${{needs.build_rman_target_name.outputs.TargetEnvironment}}
runs-on: ubuntu-latest
container:
image: ghcr.io/ministryofjustice/hmpps-delius-operational-automation:0.1
image: ghcr.io/ministryofjustice/hmpps-delius-operational-automation:0.41.0
timeout-minutes: 1440
env:
backup_command: ansible-playbook operations/playbooks/oracle_backup/backup.yml
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
ansible/roles/secretsmanager-passwords
ansible/roles/get-modernisation-platform-facts
path: roles
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.SourceCodeVersion || 'main' }}
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.SourceConfigVersion || 'main' }}
fetch-depth: 0

- name: Configure AWS Credentials
Expand All @@ -199,9 +199,12 @@ jobs:
id: backup
continue-on-error: true
run: |
echo "Using bucket ${{ vars.ANSIBLE_AWS_SSM_BUCKET_NAME }}"
echo "Not using bucket ${ANSIBLE_AWS_SSM_BUCKET_NAME}"
env
export ANSIBLE_CONFIG=$ansible_config
ln -s $PWD/roles/ansible/roles $PWD/operations/playbooks/oracle_backup/roles
$backup_command -i $inventory -e rman_target=$RmanTarget -e daily_weekly=$Period -e enable_trace=$EnableTrace $VerboseOutput
$backup_command -i $inventory -e ansible_aws_ssm_bucket_name=${{ vars.ANSIBLE_AWS_SSM_BUCKET_NAME }} -e rman_target=$RmanTarget -e daily_weekly=$Period -e enable_trace=$EnableTrace $VerboseOutput

- name: Start Ansible Backup On First Standby (If Exists) If Primary Backup Failed
if: ${{ steps.backup.outcome == 'failure' && contains(env.RmanTarget,'primarydb') }}
Expand All @@ -211,7 +214,7 @@ jobs:
then
export ANSIBLE_CONFIG=$ansible_config
ln -s $PWD/roles/ansible/roles $PWD/operations/playbooks/oracle_backup/roles
$backup_command -i $inventory -e rman_target=${RmanTarget/primarydb/standbydb1} -e daily_weekly=$Period -e enable_trace=$EnableTrace $VerboseOutput
$backup_command -i $inventory -e ansible_aws_ssm_bucket_name=${{ vars.ANSIBLE_AWS_SSM_BUCKET_NAME }} -e rman_target=${RmanTarget/primarydb/standbydb1} -e daily_weekly=$Period -e enable_trace=$EnableTrace $VerboseOutput
else
echo "Standby Not Configured"
fi
Expand All @@ -220,12 +223,12 @@ jobs:
run: |
export ANSIBLE_CONFIG=$ansible_config
ln -s $PWD/roles/ansible/roles $PWD/operations/playbooks/oracle_backup/roles
$validate_command -i $inventory -e rman_target=$RmanTarget -e fix_absent_chunks=$FixAbsentChunks $VerboseOutput
$validate_command -i $inventory -e ansible_aws_ssm_bucket_name=${{ vars.ANSIBLE_AWS_SSM_BUCKET_NAME }} -e rman_target=$RmanTarget -e fix_absent_chunks=$FixAbsentChunks $VerboseOutput

- name: Start Ansible Delete DBIDs Not In Use
if: ${{ env.DeleteDefunct == 'yes' }}
run: |
export ANSIBLE_CONFIG=$ansible_config
ln -s $PWD/roles/ansible/roles $PWD/operations/playbooks/oracle_backup/roles
$delete_dbids_command -i $inventory -e rman_target=$RmanTarget $VerboseOutput
$delete_dbids_command -i $inventory -e ansible_aws_ssm_bucket_name=${{ vars.ANSIBLE_AWS_SSM_BUCKET_NAME }} -e rman_target=$RmanTarget $VerboseOutput

3 changes: 2 additions & 1 deletion ansible/group_vars/dev.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
ansible_python_interpreter: /usr/bin/python3.9
ansible_aws_ssm_bucket_name: delius-core-development-openldap-migration
ansible_aws_ssm_bucket_name: ldap-dev-migration20240123173113114100000001
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite sure why we're using an LDAP migration bucket to store SSM session data?

#ansible_aws_ssm_bucket_name: delius-core-development-openldap-migration
5 changes: 5 additions & 0 deletions playbooks/oracle_backup/backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
become_method: sudo

tasks:

- name: SSM Bucket to Use
debug:
var: ansible_aws_ssm_bucket_name

- name: RMAN script
block:
- name: Set database_global_database
Expand Down
Loading