Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
milesstoetzner committed Jan 7, 2024
1 parent 9bdb555 commit d7663a0
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/actions/prepare-integration-job/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ runs:
fi
cat << EOF > /tmp/os-credentials.sh
#!/usr/bin/env bash
#!/usr/bin/bash
export OS_AUTH_TYPE=v3applicationcredential
export OS_AUTH_URL=https://idm02.bw-cloud.org:5000/v3
export OS_IDENTITY_API_VERSION=3
Expand Down
78 changes: 48 additions & 30 deletions examples/xopera-pruning/lib/gcp/dbms/create.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,54 @@
---
- name: Create GCP Cloud SQL Instance
hosts: all
gather_facts: false
tasks:
- name: Activate service account
shell: 'gcloud auth activate-service-account --key-file {{ service_account_file }} --project {{ project }}'
- name: Create GCP Cloud SQL Instance
hosts: all
gather_facts: false
tasks:
- name: Activate service account
shell: gcloud auth activate-service-account --key-file {{ service_account_file }} --project {{ project }}
args:
executable: /usr/bin/bash

# https://cloud.google.com/sql/docs/mysql/connect-instance-cloud-shell
- name: Enable Cloud SQL Admin API
shell: |
GCP_SERVICE=sqladmin.googleapis.com
GCP_SERVICE_ENABLED=$(gcloud services list --filter ${GCP_SERVICE} --format json --enabled | jq length)
if [ ${GCP_SERVICE_ENABLED} == 0 ]; then
gcloud services enable ${GCP_SERVICE}
fi
# https://cloud.google.com/sql/docs/mysql/connect-instance-cloud-shell
- name: Enable Cloud SQL Admin API
shell: |
GCP_SERVICE=sqladmin.googleapis.com
GCP_SERVICE_ENABLED=$(gcloud services list --filter ${GCP_SERVICE} --format json --enabled | jq length)
if [ ${GCP_SERVICE_ENABLED} == 0 ]; then
gcloud services enable ${GCP_SERVICE}
fi
args:
executable: /usr/bin/bash

# https://cloud.google.com/sql/docs/mysql/create-instance
# https://cloud.google.com/sdk/gcloud/reference/sql/instances/create
- name: Create Instance
shell: 'gcloud sql instances create {{ instance_name }} --tier {{ instance_tier }} --region {{ region }} --database-version={{ database_version }} --authorized-networks {{ authorized_networks }} --availability-type {{ availability_type }} {{ "--backup --enable-bin-log" if backups else "--no-backup" }} --timeout unlimited'
# https://cloud.google.com/sql/docs/mysql/create-instance
# https://cloud.google.com/sdk/gcloud/reference/sql/instances/create
- name: Create Instance
shell: |
gcloud sql instances create {{ instance_name }} \
--tier {{ instance_tier }} \
--region {{ region }} \
--database-version={{ database_version }} \
--authorized-networks {{ authorized_networks }} \
--availability-type {{ availability_type }} \
{{ "--backup --enable-bin-log" if backups else "--no-backup" }} \
--timeout unlimited
args:
executable: /usr/bin/bash

# https://cloud.google.com/sql/docs/mysql/create-instance
- name: Set Root Password
shell: 'gcloud sql users set-password root --host=% --instance {{ instance_name }} --password {{ root_password }}'
# https://cloud.google.com/sql/docs/mysql/create-instance
- name: Set Root Password
shell: gcloud sql users set-password root --host=% --instance {{ instance_name }} --password {{ root_password }}
args:
executable: /usr/bin/bash

# https://cloud.google.com/sdk/gcloud/reference/sql/instances/describe
- name: Get Instance Information
shell: 'gcloud sql instances describe {{ instance_name }}'
register: instance_info
# https://cloud.google.com/sdk/gcloud/reference/sql/instances/describe
- name: Get Instance Information
shell: gcloud sql instances describe {{ instance_name }}
register: instance_info
args:
executable: /usr/bin/bash

- name: Set Attributes
set_stats:
data:
public_address: '{{ (instance_info.stdout | from_yaml).ipAddresses[0].ipAddress }}'
- name: Set Attributes
set_stats:
data:
public_address: '{{ (instance_info.stdout | from_yaml).ipAddresses[0].ipAddress }}'

0 comments on commit d7663a0

Please sign in to comment.