Skip to content

Commit 47751a2

Browse files
Merge pull request #9 from guidograzioli/prerelease_0.2.0
Prerelease 0.2.0
2 parents 82fb605 + b73f187 commit 47751a2

File tree

19 files changed

+336
-300
lines changed

19 files changed

+336
-300
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ jobs:
99
release:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- name: Checkout code
13+
uses: actions/checkout@v2
1314
- name: Set up Python
1415
uses: actions/setup-python@v1
1516
with:
@@ -35,4 +36,18 @@ jobs:
3536
env:
3637
ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }}
3738
run: |
38-
ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY
39+
ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY
40+
dispatch:
41+
needs: release
42+
strategy:
43+
matrix:
44+
repo: ['ansible-middleware/cross-dc-rhsso-demo', 'ansible-middleware/flange-demo']
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Repository Dispatch
48+
uses: peter-evans/repository-dispatch@v1
49+
with:
50+
token: ${{ secrets.TRIGGERING_PAT }}
51+
repository: ${{ matrix.repo }}
52+
event-type: "Dependency released - Keycloak"
53+
client-payload: '{ "github": ${{toJson(github)}} }'

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
*.tar.gz
1+
*.tar.gz
2+
*.zip

README.md

Lines changed: 65 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,60 +29,87 @@ collections:
2929
- name: middleware_automation.keycloak
3030
```
3131
32+
The keycloak collection also depends on the following python packages to be present on the controller host:
33+
34+
* netaddr
35+
36+
A requirement file is provided to install:
37+
38+
pip install -r requirements.txt
39+
40+
41+
### Included roles
42+
43+
* [`keycloak`](https://github.com/ansible-middleware/keycloak/blob/main/roles/keycloak/README.md): role for installing the service.
44+
* [`keycloak_realm`](https://github.com/ansible-middleware/keycloak/blob/main/roles/keycloak_realm/README.md): role for configuring a realm, user federation(s), clients and users, in an installed service.
45+
46+
47+
## Usage
48+
49+
3250
### Install Playbook
3351

34-
`playbooks/keycloak.yml` installs the upstream(Keycloak) based on the defined variables.
35-
`playbooks/rhsso.yml` installs Red Hat Single Sign-On(RHSSO) based on defined variables.
52+
* [`playbooks/keycloak.yml`](playbooks/keycloak.yml) installs the upstream(Keycloak) based on the defined variables.
53+
* [`playbooks/rhsso.yml`](playbooks/rhsso.yml) installs Red Hat Single Sign-On(RHSSO) based on defined variables.
3654

37-
### Choosing between upstream(Keycloak) project and Red Hat Single Sign-On(RHSSO)
55+
Both playbooks include the `keycloak` role, with different settings, as described in the following sections.
3856

39-
The roles supports installing upstream(Keycloak) or Red Hat Single Sign-On in the following ways
57+
For service configuration details, refer to the [keycloak role README](roles/keycloak/README.md).
4058

41-
#### Install upstream(Keycloak) from remote source
4259

43-
This is default approach, there is one required variable
60+
### Choosing between upstream project (Keycloak) and Red Hat Single Sign-On (RHSSO)
4461

45-
```
46-
keycloak_admin_password: "<changeme>"
47-
```
62+
The general flag `keycloak_rhsso_enable` controls what to install between upstream(Keycloak, when `False`) or Red Hat Single Sign-On (when `True`).
63+
The default value for the flag if `True` when Red Hat Network credentials are defined, `False` otherwise.
4864

49-
#### Install upstream(Keycloak) from local source when the following variable is defined
5065

51-
```
52-
keycloak_admin_password: "<changeme>"
53-
zip_file_local_path: <keycloak zip file on Ansible control node local path>
54-
```
66+
#### Install upstream (Keycloak) from keycloak releases
5567

56-
#### Install RHSSO from the Red Hat Customer Support Portal, when the following variables are defined
68+
This is the default approach when RHN credentials are not defined. Keycloak is downloaded from keycloak builds (hosted on github.com) locally, and distributed to target nodes.
5769

58-
```
59-
keycloak_admin_password: "<changeme>"
70+
71+
#### Install RHSSO from the Red Hat Customer Support Portal
72+
73+
Define the credentials as follows, and the default behaviour is to download a fresh archive of RHSSO on the controller node, then distribute to target nodes.
74+
75+
```yaml
6076
rhn_username: '<customer_portal_username>'
6177
rhn_password: '<customer_portal_password>'
62-
rhsso_rhn_id: '<sso_product_id>'
78+
# (keycloak_rhsso_enable defaults to True)
6379
```
6480

65-
where `sso_product_id` is the ID for the specific Red Hat Single Sign-On version, ie. _101971_ will install version _7.5_)
6681

67-
#### Install RHSSO from remote sources like Nexus etc, when the following variables are defined
82+
#### Install from controller node (local source)
6883

69-
```
70-
keycloak_admin_password: "<changeme>"
71-
keycloak_rhsso_enable: True
72-
rhsso_source_download_url: '<url to download RHSSO zip file>'
84+
Making the keycloak zip archive (or the RHSSO zip archive), available to the playbook repository root directory, and setting `keycloak_offline_install` to `True`, allows to skip
85+
the download tasks. The local path for the archive matches the downloaded archive path, so it is also used as a cache when multiple hosts are provisioned in a cluster.
86+
87+
```yaml
88+
keycloak_offline_install: True
7389
```
7490

75-
#### Install RHSSO from local source when the following variable is defined
91+
And depending on `keycloak_rhsso_enable`:
7692

77-
```
78-
keycloak_admin_password: "<changeme>"
93+
* `True`: install RHSSO using file rh-sso-x.y.z-server-dist.zip
94+
* `False`: install keycloak using file keycloak-x.y.zip
95+
96+
97+
#### Install from alternate sources (like corporate Nexus, artifactory, proxy, etc)
98+
99+
For RHSSO:
100+
101+
```yaml
79102
keycloak_rhsso_enable: True
80-
zip_file_local_path: <rhsso zip file on Ansible control node local path>
103+
keycloak_rhsso_download_url: "https://<internal-nexus.private.net>/<path>/<to>/rh-sso-x.y.z-server-dist.zip"
81104
```
82105

83-
### Install role
106+
For keycloak:
107+
108+
```yaml
109+
keycloak_rhsso_enable: False
110+
keycloak_download_url: "https://<internal-nexus.private.net>/<path>/<to>/keycloak-x.y.zip"
111+
```
84112

85-
* [`keycloak`](https://github.com/ansible-middleware/keycloak/blob/main/roles/keycloak/README.md): role for installing the service. _Requires: python3-netaddr_
86113

87114
### Example installation command
88115

@@ -100,21 +127,20 @@ ansible-playbook -i <ansible_hosts> -e @rhn-creds.yml playbooks/keycloak.yml -e
100127
localhost ansible_connection=local
101128
```
102129
130+
103131
## Configuration
104132
105-
### Config Playbook
106133
107-
`playbooks/keycloak-realm.yml` creates provided realm, user federation(s), client(s), client role(s) and client user(s) if they don't exist.
134+
### Config Playbook
108135
109-
### Config role
136+
[`playbooks/keycloak-realm.yml`](playbooks/keycloak-realm.yml) creates provided realm, user federation(s), client(s), client role(s) and client user(s) if they don't exist.
110137
111-
* [`keycloak_realm`](https://github.com/ansible-middleware/keycloak/blob/main/roles/keycloak_realm/README.md): role for configuring a realm, user federation(s), clients and users, in an installed service.
112138
113139
### Example configuration command
114140
115141
Execute the following command from the source root directory
116142
117-
```
143+
```bash
118144
ansible-playbook -i <ansible_hosts> playbooks/keycloak-realm.yml -e keycloak_admin_password=<changeme> -e keycloak_realm=test
119145
```
120146

@@ -127,9 +153,12 @@ ansible-playbook -i <ansible_hosts> playbooks/keycloak-realm.yml -e keycloak_adm
127153
localhost ansible_connection=local
128154
```
129155

156+
For configuration details, refer to the [keycloak_realm role README](roles/keycloak_realm/README.md).
157+
158+
130159
## License
131160

132161
Apache License v2.0 or later
133162

134-
See [LICENCE](LICENSE) to view the full text.
163+
See [LICENSE](LICENSE) to view the full text.
135164

galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace: middleware_automation
22
name: keycloak
3-
version: "0.1.9"
3+
version: "0.2.0"
44
readme: README.md
55
authors:
66
- Romain Pelisse <[email protected]>

requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#################################################
2+
# python dependencies required to be installed
3+
# on the controller host with:
4+
# pip install -r requirements.txt
5+
#
6+
netaddr

roles/keycloak/README.md

Lines changed: 64 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ This role requires the `python3-netaddr` library installed on the controller nod
1111

1212
* to install via yum/dnf: `dnf install python3-netaddr`
1313
* or via pip: `pip install netaddr==0.8.0`
14+
* or via the collection: `pip install -r requirements.txt`
15+
16+
17+
Dependencies
18+
------------
19+
20+
The roles depends on:
21+
22+
* the `redhat_csp_download` role from [middleware_automation.redhat_csp_download](https://github.com/ansible-middleware/redhat-csp-download) collection if Red Hat Single Sign-on zip have to be downloaded from RHN.
23+
* the `wildfly_driver` role from [middleware_automation.wildfly](https://github.com/ansible-middleware/wildfly) collection
1424

1525

1626
Versions
@@ -24,23 +34,43 @@ Versions
2434
Role Defaults
2535
-------------
2636

37+
* Service configuration
38+
2739
| Variable | Description | Default |
2840
|:---------|:------------|:---------|
29-
|`keycloak_rhsso_enable`| Enable Red Hat Single Sign-on installation | `False` |
3041
|`keycloak_ha_enabled`| Enable auto configuration for database backend, clustering and remote caches on infinispan | `False` |
3142
|`keycloak_db_enabled`| Enable auto configuration for database backend | `True` if `keycloak_ha_enabled` is True, else `False` |
3243
|`keycloak_admin_user`| Administration console user account | `admin` |
3344
|`keycloak_bind_address`| Address for binding service ports | `0.0.0.0` |
3445
|`keycloak_host`| hostname | `localhost` |
3546
|`keycloak_http_port`| HTTP port | `8080` |
3647
|`keycloak_https_port`| TLS HTTP port | `8443` |
48+
|`keycloak_ajp_port`| AJP port | `8009` |
49+
|`keycloak_jgroups_port`| jgroups cluster tcp port | `7600` |
3750
|`keycloak_management_http_port`| Management port | `9990` |
3851
|`keycloak_management_https_port`| TLS management port | `9993` |
3952
|`keycloak_java_opts`| Additional JVM options | `-Xms1024m -Xmx2048m` |
4053
|`keycloak_prefer_ipv4`| Prefer IPv4 stack and addresses for port binding | `True` |
54+
|`keycloak_config_standalone_xml`| filename for configuration | `keycloak.xml` |
55+
|`keycloak_service_user`| posix account username | `keycloak` |
56+
|`keycloak_service_group`| posix account group | `keycloak` |
57+
|`keycloak_service_pidfile`| pid file path for service | `/run/keycloak.pid` |
4158
|`jvm_package`| RHEL java package runtime | `java-1.8.0-openjdk-devel` |
4259

4360

61+
* Install options
62+
63+
| Variable | Description | Default |
64+
|:---------|:------------|:---------|
65+
|`keycloak_rhsso_enable`| Enable Red Hat Single Sign-on installation | `False` |
66+
|`keycloak_offline_install` | perform an offline install | `False`|
67+
|`keycloak_download_url`| Download URL for keycloak | `https://github.com/keycloak/keycloak/releases/download/<version>/<archive>`|
68+
|`keycloak_rhsso_download_url`| Download URL for RHSSO | `https://access.redhat.com/jbossnetwork/restricted/softwareDownload.html?softwareId=<productID>`|
69+
|`keycloak_version`| keycloak.org package version | `15.0.2` |
70+
|`keycloak_rhsso_version`| RHSSO version | `7.5.0` |
71+
|`keycloak_dest`| Installation root path | `/opt/keycloak` |
72+
73+
4474
Role Variables
4575
--------------
4676

@@ -76,44 +106,14 @@ The following variables are _required_ only when `keycloak_db_enabled` is True:
76106
|`keycloak_db_user` | username for connecting to postgres | `keycloak-user` |
77107
|`keycloak_db_pass` | password for connecting to postgres | `keycloak-pass` |
78108

79-
The following variable can be used to install Keycloak or Red Hat Single Sign-On from local path:
80-
| Variable | Description | Example |
81-
|:---------|:------------|:---------|
82-
|`zip_file_local_path` | Full local path of upstream(Keycloak) or Red Hat Single Sign-On zip file on Ansible control plane | `tmp/rhsso/rh-sso-7.5-server-dist.zip` |
83109

84-
The following variable can be used to install Red Hat Single Sign-On from source via url, auth support is not added right now.
85-
| Variable | Description | Example |
86-
|:---------|:------------|:---------|
87-
|`rhsso_source_download_url` | URL to download Red Hat Single Sign-On zip file from source | `http://localhost:8081/nexus/rhsso/rh-sso-7.5-server-dist.zip` |
110+
Example Playbooks
111+
-----------------
88112

89-
Dependencies
90-
------------
91-
92-
The roles depends on:
113+
_NOTE_: use ansible vaults or other security systems for storing credentials.
93114

94-
* the redhat_csp_download role from [middleware_automation.redhat_csp_download](https://github.com/ansible-middleware/redhat-csp-download) collection if Red Hat Single Sign-on zip have to be downloaded from RHN.
95-
* the wildfly_driver role from [middleware_automation.wildfly](https://github.com/ansible-middleware/wildfly) collection
96-
97-
98-
Example Playbook
99-
----------------
100-
101-
The following is an example playbook that makes use of the role to install keycloak from remote
102-
103-
```yaml
104-
---
105-
- hosts: ...
106-
collections:
107-
- middleware_automation.keycloak
108-
tasks:
109-
- name: Include keycloak role
110-
include_role:
111-
name: keycloak
112-
vars:
113-
keycloak_admin_password: "changeme"
114-
```
115115

116-
The following is an example playbook that makes use of the role to install keycloak from local path on Ansible node
116+
* The following is an example playbook that makes use of the role to install keycloak from remote:
117117

118118
```yaml
119119
---
@@ -126,10 +126,9 @@ The following is an example playbook that makes use of the role to install keycl
126126
name: keycloak
127127
vars:
128128
keycloak_admin_password: "changeme"
129-
zip_file_local_path: "/tmp/keycloak/keycloak-16.1.0.zip" # This should be local path on Ansible node of upstream(keycloak) zip file
130129
```
131130
132-
The following is an example playbook that makes use of the role to install Red Hat Single Sign-On from RHN
131+
* The following is an example playbook that makes use of the role to install Red Hat Single Sign-On from RHN:
133132
134133
```yaml
135134
---
@@ -146,9 +145,30 @@ The following is an example playbook that makes use of the role to install Red H
146145
vars:
147146
keycloak_admin_password: "changeme"
148147
keycloak_rhsso_enable: True
148+
rhn_username: '<customer portal username>'
149+
rhn_password: '<customer portal password>'
149150
```
150151
151-
The following is an example playbook that makes use of the role to install Red Hat Single Sign-On from source url
152+
153+
* The following example playbook makes use of the role to install keycloak from the controller node:
154+
155+
```yaml
156+
---
157+
- hosts: ...
158+
collections:
159+
- middleware_automation.keycloak
160+
tasks:
161+
- name: Include keycloak role
162+
include_role:
163+
name: keycloak
164+
vars:
165+
keycloak_admin_password: "changeme"
166+
keycloak_offline_install: True
167+
# This should be the filename of keycloak archive on Ansible node: keycloak-16.1.0.zip
168+
```
169+
170+
171+
* This playbook installs Red Hat Single Sign-On from an alternate url:
152172

153173
```yaml
154174
---
@@ -162,10 +182,12 @@ The following is an example playbook that makes use of the role to install Red H
162182
vars:
163183
keycloak_admin_password: "changeme"
164184
keycloak_rhsso_enable: True
165-
rhsso_source_download_url: "<REPLACE with - Source download url>" # This should be the full of remote source rhsso zip file
185+
keycloak_rhsso_download_url: "<REPLACE with download url>"
186+
# This should be the full of remote source rhsso zip file and can contain basic authentication credentials
166187
```
167188

168-
The following is an example playbook that makes use of the role to install Red Hat Single Sign-On from local path on Ansible node
189+
190+
* The following is an example playbook that makes use of the role to install Red Hat Single Sign-On from the controller node:
169191

170192
```yaml
171193
---
@@ -179,7 +201,8 @@ The following is an example playbook that makes use of the role to install Red H
179201
vars:
180202
keycloak_admin_password: "changeme"
181203
keycloak_rhsso_enable: True
182-
zip_file_local_path: "/tmp/rhsso/rh-sso-7.5-server-dist.zip" # This should be local path on Ansible node of rhsso zip file
204+
keycloak_offline_install: True
205+
# This should be the filename of rhsso zip file on Ansible node: rh-sso-7.5-server-dist.zip
183206
```
184207

185208
License

0 commit comments

Comments
 (0)