Oracle: delius-mis-stage_boe_primarydb_oem_agent_setup #107
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: "Oracle: OEM Agent Setup" | |
run-name: "Oracle: ${{ format('{0}_{1}', github.event.inputs.TargetEnvironment, github.event.inputs.TargetHost) }}_oem_agent_setup" | |
on: | |
workflow_dispatch: | |
inputs: | |
TargetEnvironment: | |
description: "Target environment" | |
required: true | |
type: choice | |
options: | |
- "delius-core-dev" | |
- "delius-core-test" | |
- "delius-core-training" | |
- "delius-core-stage" | |
- "delius-core-preprod" | |
- "delius-core-prod" | |
- "delius-mis-dev" | |
- "delius-mis-stage" | |
- "delius-mis-preprod" | |
- "delius-mis-prod" | |
TargetHost: | |
description: "Database target host" | |
required: true | |
type: choice | |
options: | |
- "delius_primarydb" | |
- "delius_standbydb1" | |
- "delius_standbydb2" | |
- "delius_dbs" | |
- "mis_primarydb" | |
- "mis_standbydb1" | |
- "mis_dbs" | |
- "boe_primarydb" | |
- "boe_standbydb1" | |
- "boe_dbs" | |
- "dsd_primarydb" | |
- "dsd_standbydb1" | |
- "dsd_dbs" | |
VerboseOutput: | |
description: "Verbose Output level" | |
type: choice | |
default: "" | |
options: | |
- "" | |
- "-vv" | |
- "-vvv" | |
- "-vvvv" | |
SourceCodeVersion: | |
description: "Source version for the hmpps-delius-operation-automation. Enter a pull request, branch, commit ID, tag, or reference." | |
type: string | |
default: "main" | |
SourceConfigVersion: | |
description: "Source version for the modernisation-platform-configuration-management. Enter a pull request, branch, commit ID, tag, or reference." | |
type: string | |
default: "main" | |
env: | |
ansible_config: ansible/playbooks/ansible.cfg | |
permissions: | |
contents: read | |
packages: read | |
id-token: write | |
jobs: | |
build_target_name: | |
runs-on: ubuntu-latest | |
outputs: | |
TargetHost: ${{ steps.preparetargetname.outputs.TargetHost }} | |
steps: | |
- name: Prepare Target Name | |
id: preparetargetname | |
run: echo TargetHost="environment_name_$(echo ${{ github.event.inputs.TargetEnvironment }} | sed 's/dev/development_dev/;s/test/test_test/;s/training/test_training/;s/stage/preproduction_stage/;s/pre-prod/preproduction_pre_prod/;s/-prod/_production_prod/;s/-/_/g')_${{ github.event.inputs.TargetHost }}" >> $GITHUB_OUTPUT | |
deployment: | |
name: oracle-db-oem-agent-setup | |
needs: build_target_name | |
environment: ${{ github.event.inputs.TargetEnvironment }} | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/ministryofjustice/hmpps-delius-operational-automation:0.78.0 | |
timeout-minutes: 1440 | |
env: | |
command: ansible-playbook operations/ansible/site.yml -e force_role=oracle-oem-agent-setup -e role=oracle-oem-agent-setup | |
inventory: inventory/ansible | |
continue-on-error: false | |
steps: | |
- name: Checkout From hmpps-delius-operational-automation | |
uses: actions/checkout@v4 | |
with: | |
repository: ministryofjustice/hmpps-delius-operational-automation | |
sparse-checkout-cone-mode: false | |
sparse-checkout: | | |
playbooks/ansible.cfg | |
path: ansible | |
ref: ${{ github.event.inputs.SourceCodeVersion }} | |
fetch-depth: 0 | |
- name: Checkout Role From modernisation-platform-configuration-management | |
uses: actions/checkout@v4 | |
with: | |
repository: ministryofjustice/modernisation-platform-configuration-management | |
sparse-checkout-cone-mode: false | |
sparse-checkout: | | |
ansible/roles/oracle-oem-agent-setup | |
ansible/roles/get-ec2-facts | |
ansible/roles/secretsmanager-passwords | |
ansible/roles/get-modernisation-platform-facts | |
ansible/roles/epel | |
ansible/site.yml | |
path: operations | |
ref: ${{ github.event.inputs.SourceConfigVersion }} | |
fetch-depth: 0 | |
- name: Checkout Inventory From modernisation-platform-configuration-management | |
uses: actions/checkout@v4 | |
with: | |
repository: ministryofjustice/modernisation-platform-configuration-management | |
sparse-checkout-cone-mode: false | |
sparse-checkout: | | |
ansible/hosts | |
ansible/group_vars | |
path: inventory | |
ref: ${{ github.event.inputs.SourceConfigVersion }} | |
fetch-depth: 0 | |
- name: Configure AWS Credentials | |
id: login-aws | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: "arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/modernisation-platform-oidc-cicd" | |
role-session-name: "hmpps-delius-operational-automation-${{ github.run_number }}" | |
role-duration-seconds: 21600 | |
aws-region: "eu-west-2" | |
- name: Start OEM Agent Setup | |
run: | | |
export ANSIBLE_CONFIG=$ansible_config | |
$command -i $inventory -e ansible_aws_ssm_bucket_name=${{ vars.ANSIBLE_AWS_SSM_BUCKET_NAME }} -e target=${{needs.build_target_name.outputs.TargetHost}} ${{ github.event.inputs.VerboseOutput }} |