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

Removing AWS from the collection and making it general #8

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 7 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@

[![CI](https://github.com/ansible-middleware/rhbk-ha-cluster/actions/workflows/ci.yml/badge.svg)](https://github.com/ansible-middleware/rhbk-ha-cluster/actions/workflows/ci.yml)

Provision and deploy a Red Hat Build of Keycloak authentication service on multiple AWS regions via Ansible
Provision and deploy a Red Hat Build of Keycloak authentication service on multi-region clusters via Ansible

### Use case of rhbk-ha-cluster collection

The primary use case of the `rhbk-ha-cluster` collection is to install Red Hat Build of Keycloak (RHBK) with high availability (HA) across multiple AWS regions. This ensures that the authentication service is resilient, fault-tolerant, and capable of serving users even in the event of a regional failure. By leveraging AWS infrastructure, the collection automates the setup of RHBK in a highly available architecture, integrating with Data Grid for distributed caching and ensuring smooth, secure authentication.
The primary use case of the `rhbk-ha-cluster` collection is to install Red Hat Build of Keycloak (RHBK) with high availability (HA) across multi-region clusters. This ensures that the authentication service is resilient, fault-tolerant, and capable of serving users even in the event of a regional failure. The collection automates the setup of RHBK in a highly available architecture, integrating with Data Grid for distributed caching and ensuring smooth, secure authentication.

### 0. prerequisites

* The two regions that will host the authentication service (ie. us-east-1 and us-west-2)
* An AWS account with permissions on `ec2` on said regions with default profile in $HOME/.aws/credentials that will be used to provision ec2 compute nodes
* A database service that can be accessed from the deployment regions; or otherwise, `rds` permissions on the AWS account so an Aurora service can be provisioned
* Setup multi-region clusters infrastructure.
* A database service that can be accessed from the deployment regions.
* TLS certificates for the desired domain name to provide the authentication service

### 1. create ansible.cfg

```
[defaults]
guidograzioli marked this conversation as resolved.
Show resolved Hide resolved
remote_user=ec2-user
remote_user=<ssh_user>
private_key_file=<path_to_private_key>
host_key_checking=False
gathering=smart
Expand All @@ -39,23 +38,13 @@ token=<automation_hub_token>

Set the `token` to the value you get after authentication on automation hub.


### 2. install dependencies

The following command will download and install the dependencies.

# pip install -r requirements.txt
# ansible-galaxy collection install -r requirements.yml


### 3. create key pair

This key pair will be used by ansible to connect to the EC2 instances.

* Paste the path to the private key in ansible.cfg option `private_key_file`
* Copy the public key file to `files/id_rsa_aws.pub`


### 4. domain names and certificates

* Update the configuration to reflect your domain and certificate details for secure access.
Expand All @@ -64,16 +53,12 @@ This key pair will be used by ansible to connect to the EC2 instances.

To edit the configuration, you would need to modify the ansible.cfg file and relevant playbook variables. This includes:

* Setting the private_key_file path in ansible.cfg to allow Ansible to connect to EC2 instances.
* Specifying AWS regions, database information, and TLS certificates in the playbooks or group variables (typically located in group_vars/).
* Provide Ansible Automation Hub token in ansible.cfg
* Database information, and TLS certificates in the playbooks or group variables (typically located in group_vars/).
* Configuring other parameters like the domain names for Keycloak and Data Grid.

These configurations ensure the infrastructure is tailored to your specific setup requirements before provisioning and deploying.

### 6. run the infra provisioning

Inside `playbooks/roles` path we have `infra-up.yml` and `infra-down.yml` run both according to you need.

### 7. run the deployment of data_grid and rhbk

Inside `playbooks/roles` path we have `deploy.yml` playbook to deploy data_grid and rhbk.
Expand Down
7 changes: 4 additions & 3 deletions galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
namespace: infra
name: rhbk_datagrid_aws
name: rhbk_ha_cluster
version: "1.0.0"
readme: README.md
authors:
- Guido Grazioli <[email protected]>
description: Provision and deploy a Red Hat Build of Keycloak multi-regional authentication service on AWS
- Ranabir Chakraborty <[email protected]>
description: Provision and deploy a Red Hat Build of Keycloak multi-regional authentication service on clusters.
license_file: "LICENSE"
tags:
- keycloak
Expand All @@ -23,8 +24,8 @@ tags:
- middleware
- datagrid
- infinispan
- AWS
- a4mw
- cluster
dependencies:
"redhat.rhbk": ">=2.0.0"
"redhat.data_grid": ">=1.1.4"
Expand Down
19 changes: 0 additions & 19 deletions inventory/cloud_aws_ec2.yml

This file was deleted.

3 changes: 0 additions & 3 deletions inventory/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
jvm_package: java-17-openjdk-headless
domain_name: '.internal.ansiblemiddleware.com'
external_domain_name: 'rhbk.demos.ansiblemiddleware.com'
regions:
- eu-central-1
- us-east-2
resource_tags:
Environment: rhbk-ha-cluster
Application: rhbk
Expand Down
2 changes: 1 addition & 1 deletion inventory/group_vars/eu_central_1.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
aurora_endpoint: rhbk-ha-cluster.cluster-cqy2krcosm24.eu-central-1.rds.amazonaws.com:5432
db_endpoint: rhbk-ha-cluster.cluster-cqy2krcosm24.eu-central-1:5432
data_grid_jgroups_relay_site: eu-central-1
2 changes: 1 addition & 1 deletion inventory/group_vars/rhbk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
rhbk_ha_enabled: True
rhbk_frontend_url: "https://{{ external_domain_name }}/auth/"
rhbk_jdbc_engine: postgres
rhbk_jdbc_url: "jdbc:postgresql://{{ aurora_endpoint }}/keycloak?socketTimeout=10000"
rhbk_jdbc_url: "jdbc:postgresql://{{ db_endpoint }}/keycloak?socketTimeout=10000"

rhbk_db_user: keycloak
rhbk_configure_firewalld: True
Expand Down
2 changes: 1 addition & 1 deletion inventory/group_vars/us_east_2.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
aurora_endpoint: rhbk-datagrid-global-cluster-1.cluster-cpthunyvi99s.us-east-2.rds.amazonaws.com:5432
db_endpoint: rhbk-datagrid-global-cluster-1.cluster-cpthunyvi99s.us-east-2:5432
data_grid_jgroups_relay_site: us-east-2
8 changes: 0 additions & 8 deletions playbooks/infra-down.yml

This file was deleted.

8 changes: 0 additions & 8 deletions playbooks/infra-up.yml

This file was deleted.

67 changes: 0 additions & 67 deletions playbooks/roles/aws/README.md

This file was deleted.

79 changes: 0 additions & 79 deletions playbooks/roles/aws/defaults/main.yml

This file was deleted.

1 change: 0 additions & 1 deletion playbooks/roles/aws/files

This file was deleted.

2 changes: 0 additions & 2 deletions playbooks/roles/aws/handlers/main.yml

This file was deleted.

38 changes: 0 additions & 38 deletions playbooks/roles/aws/meta/argument_specs.yml

This file was deleted.

Loading
Loading