From 26691baf8ec6967ca0409747bd43deac0468d223 Mon Sep 17 00:00:00 2001 From: Bill Buchan Date: Fri, 8 Mar 2024 17:34:20 +0000 Subject: [PATCH 01/12] Use Config Branch --- .github/workflows/oracle-db-backup.yml | 2 +- ansible/group_vars/dev.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oracle-db-backup.yml b/.github/workflows/oracle-db-backup.yml index 9d8e0bf5..9c3f9d34 100644 --- a/.github/workflows/oracle-db-backup.yml +++ b/.github/workflows/oracle-db-backup.yml @@ -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 diff --git a/ansible/group_vars/dev.yml b/ansible/group_vars/dev.yml index 0df32a81..fd143321 100644 --- a/ansible/group_vars/dev.yml +++ b/ansible/group_vars/dev.yml @@ -1,3 +1,3 @@ --- 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 From f1ce3e3f7c50619e2be9d03f046efc8c38848dae Mon Sep 17 00:00:00 2001 From: Bill Buchan Date: Mon, 11 Mar 2024 09:16:48 +0000 Subject: [PATCH 02/12] Use newer image --- .github/workflows/oracle-db-backup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oracle-db-backup.yml b/.github/workflows/oracle-db-backup.yml index 9c3f9d34..658acd50 100644 --- a/.github/workflows/oracle-db-backup.yml +++ b/.github/workflows/oracle-db-backup.yml @@ -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.39.0-beta.2 timeout-minutes: 1440 env: backup_command: ansible-playbook operations/playbooks/oracle_backup/backup.yml From 53577411fdc8f01379bbf0020e68a4a9850e120d Mon Sep 17 00:00:00 2001 From: Bill Buchan Date: Mon, 11 Mar 2024 09:20:48 +0000 Subject: [PATCH 03/12] Use existing bucket --- ansible/group_vars/dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/ansible/group_vars/dev.yml b/ansible/group_vars/dev.yml index fd143321..fea10256 100644 --- a/ansible/group_vars/dev.yml +++ b/ansible/group_vars/dev.yml @@ -1,3 +1,4 @@ --- ansible_python_interpreter: /usr/bin/python3.9 ansible_aws_ssm_bucket_name: ldap-dev-migration20240123173113114100000001 +#ansible_aws_ssm_bucket_name: delius-core-development-openldap-migration \ No newline at end of file From 5ff83ab819e8f84441d22493b133add933d4d8da Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 11 Mar 2024 09:21:32 +0000 Subject: [PATCH 04/12] Commit changes made by code formatters --- ansible/group_vars/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/group_vars/dev.yml b/ansible/group_vars/dev.yml index fea10256..cb3ccb7c 100644 --- a/ansible/group_vars/dev.yml +++ b/ansible/group_vars/dev.yml @@ -1,4 +1,4 @@ --- ansible_python_interpreter: /usr/bin/python3.9 ansible_aws_ssm_bucket_name: ldap-dev-migration20240123173113114100000001 -#ansible_aws_ssm_bucket_name: delius-core-development-openldap-migration \ No newline at end of file +#ansible_aws_ssm_bucket_name: delius-core-development-openldap-migration From b86c2b68d85a0ecedb694d321cdfd5ae3e2cfb1f Mon Sep 17 00:00:00 2001 From: Bill Buchan Date: Mon, 11 Mar 2024 09:37:32 +0000 Subject: [PATCH 05/12] Revert image version --- .github/workflows/oracle-db-backup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oracle-db-backup.yml b/.github/workflows/oracle-db-backup.yml index 658acd50..9c3f9d34 100644 --- a/.github/workflows/oracle-db-backup.yml +++ b/.github/workflows/oracle-db-backup.yml @@ -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.39.0-beta.2 + image: ghcr.io/ministryofjustice/hmpps-delius-operational-automation:0.1 timeout-minutes: 1440 env: backup_command: ansible-playbook operations/playbooks/oracle_backup/backup.yml From 4de5d93538cc81e9e5d3e1c7a92d64dd9af30541 Mon Sep 17 00:00:00 2001 From: Bill Buchan Date: Mon, 11 Mar 2024 17:26:06 +0000 Subject: [PATCH 06/12] Add debug --- playbooks/oracle_backup/backup.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/playbooks/oracle_backup/backup.yml b/playbooks/oracle_backup/backup.yml index a7829034..123b78b5 100644 --- a/playbooks/oracle_backup/backup.yml +++ b/playbooks/oracle_backup/backup.yml @@ -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 From dcc6e61dcc057fbc1df89910cb205bf8c7a0834f Mon Sep 17 00:00:00 2001 From: Bill Buchan Date: Mon, 11 Mar 2024 17:45:39 +0000 Subject: [PATCH 07/12] Specify the bucket --- .github/workflows/oracle-db-backup.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/oracle-db-backup.yml b/.github/workflows/oracle-db-backup.yml index 9c3f9d34..0c6f9fdd 100644 --- a/.github/workflows/oracle-db-backup.yml +++ b/.github/workflows/oracle-db-backup.yml @@ -201,7 +201,7 @@ jobs: run: | 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') }} @@ -211,7 +211,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 @@ -220,12 +220,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 From 004bc9b36901fd9e0eb20cbebb39783c1658a970 Mon Sep 17 00:00:00 2001 From: Bill Buchan Date: Mon, 11 Mar 2024 17:50:40 +0000 Subject: [PATCH 08/12] debug --- .github/workflows/oracle-db-backup.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/oracle-db-backup.yml b/.github/workflows/oracle-db-backup.yml index 0c6f9fdd..03aeebeb 100644 --- a/.github/workflows/oracle-db-backup.yml +++ b/.github/workflows/oracle-db-backup.yml @@ -199,6 +199,8 @@ 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}" export ANSIBLE_CONFIG=$ansible_config ln -s $PWD/roles/ansible/roles $PWD/operations/playbooks/oracle_backup/roles $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 From d0251322ecae4267095fa0f8950c9869283461b7 Mon Sep 17 00:00:00 2001 From: Bill Buchan Date: Tue, 12 Mar 2024 08:47:00 +0000 Subject: [PATCH 09/12] Show the environment --- .github/workflows/oracle-db-backup.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/oracle-db-backup.yml b/.github/workflows/oracle-db-backup.yml index 03aeebeb..e1eaeef6 100644 --- a/.github/workflows/oracle-db-backup.yml +++ b/.github/workflows/oracle-db-backup.yml @@ -201,6 +201,7 @@ jobs: 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 ansible_aws_ssm_bucket_name=${{ vars.ANSIBLE_AWS_SSM_BUCKET_NAME }} -e rman_target=$RmanTarget -e daily_weekly=$Period -e enable_trace=$EnableTrace $VerboseOutput From 186c9313a35952ea63a45a43b0036def671b2bc5 Mon Sep 17 00:00:00 2001 From: Bill Buchan Date: Tue, 12 Mar 2024 08:59:04 +0000 Subject: [PATCH 10/12] Use environment variable --- .github/workflows/oracle-db-backup.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oracle-db-backup.yml b/.github/workflows/oracle-db-backup.yml index e1eaeef6..aac183c5 100644 --- a/.github/workflows/oracle-db-backup.yml +++ b/.github/workflows/oracle-db-backup.yml @@ -199,12 +199,12 @@ jobs: id: backup continue-on-error: true run: | - echo "Using bucket ${{ vars.ANSIBLE_AWS_SSM_BUCKET_NAME }}" + echo "Using bucket ${{ env.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 ansible_aws_ssm_bucket_name=${{ vars.ANSIBLE_AWS_SSM_BUCKET_NAME }} -e rman_target=$RmanTarget -e daily_weekly=$Period -e enable_trace=$EnableTrace $VerboseOutput + $backup_command -i $inventory -e ansible_aws_ssm_bucket_name=${{ env.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') }} From 29f38e99d9c858f50b82080b2e888a292de1dc84 Mon Sep 17 00:00:00 2001 From: Bill Buchan Date: Tue, 12 Mar 2024 09:27:40 +0000 Subject: [PATCH 11/12] New Image --- .github/workflows/oracle-db-backup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/oracle-db-backup.yml b/.github/workflows/oracle-db-backup.yml index aac183c5..f16d8531 100644 --- a/.github/workflows/oracle-db-backup.yml +++ b/.github/workflows/oracle-db-backup.yml @@ -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 From e45c421efa37e589862e8f86417e9e249303a297 Mon Sep 17 00:00:00 2001 From: Bill Buchan Date: Tue, 12 Mar 2024 09:31:44 +0000 Subject: [PATCH 12/12] Use vars instead --- .github/workflows/oracle-db-backup.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/oracle-db-backup.yml b/.github/workflows/oracle-db-backup.yml index f16d8531..df15e589 100644 --- a/.github/workflows/oracle-db-backup.yml +++ b/.github/workflows/oracle-db-backup.yml @@ -199,12 +199,12 @@ jobs: id: backup continue-on-error: true run: | - echo "Using bucket ${{ env.ANSIBLE_AWS_SSM_BUCKET_NAME }}" + 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 ansible_aws_ssm_bucket_name=${{ env.ANSIBLE_AWS_SSM_BUCKET_NAME }} -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') }}