You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+65-36Lines changed: 65 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,60 +29,87 @@ collections:
29
29
- name: middleware_automation.keycloak
30
30
```
31
31
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
+
32
50
### Install Playbook
33
51
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.
36
54
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.
38
56
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).
40
58
41
-
#### Install upstream(Keycloak) from remote source
42
59
43
-
This is default approach, there is one required variable
60
+
### Choosing between upstream project (Keycloak) and Red Hat Single Sign-On (RHSSO)
44
61
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.
48
64
49
-
#### Install upstream(Keycloak) from local source when the following variable is defined
#### Install upstream (Keycloak) from keycloak releases
55
67
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.
57
69
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
60
76
rhn_username: '<customer_portal_username>'
61
77
rhn_password: '<customer_portal_password>'
62
-
rhsso_rhn_id: '<sso_product_id>'
78
+
# (keycloak_rhsso_enable defaults to True)
63
79
```
64
80
65
-
where `sso_product_id` is the ID for the specific Red Hat Single Sign-On version, ie. _101971_ will install version _7.5_)
66
81
67
-
#### Install RHSSO from remote sources like Nexus etc, when the following variables are defined
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
73
89
```
74
90
75
-
#### Install RHSSO from local source when the following variable is defined
91
+
And depending on `keycloak_rhsso_enable`:
76
92
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
* [`keycloak`](https://github.com/ansible-middleware/keycloak/blob/main/roles/keycloak/README.md): role for installing the service. _Requires: python3-netaddr_
`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
108
135
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.
110
137
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.
112
138
113
139
### Example configuration command
114
140
115
141
Execute the following command from the source root directory
Copy file name to clipboardExpand all lines: roles/keycloak/README.md
+64-41Lines changed: 64 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,16 @@ This role requires the `python3-netaddr` library installed on the controller nod
11
11
12
12
* to install via yum/dnf: `dnf install python3-netaddr`
13
13
* 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
14
24
15
25
16
26
Versions
@@ -24,23 +34,43 @@ Versions
24
34
Role Defaults
25
35
-------------
26
36
37
+
* Service configuration
38
+
27
39
| Variable | Description | Default |
28
40
|:---------|:------------|:---------|
29
-
|`keycloak_rhsso_enable`| Enable Red Hat Single Sign-on installation |`False`|
30
41
|`keycloak_ha_enabled`| Enable auto configuration for database backend, clustering and remote caches on infinispan |`False`|
31
42
|`keycloak_db_enabled`| Enable auto configuration for database backend |`True` if `keycloak_ha_enabled` is True, else `False`|
32
43
|`keycloak_admin_user`| Administration console user account |`admin`|
33
44
|`keycloak_bind_address`| Address for binding service ports |`0.0.0.0`|
34
45
|`keycloak_host`| hostname |`localhost`|
35
46
|`keycloak_http_port`| HTTP port |`8080`|
36
47
|`keycloak_https_port`| TLS HTTP port |`8443`|
48
+
|`keycloak_ajp_port`| AJP port |`8009`|
49
+
|`keycloak_jgroups_port`| jgroups cluster tcp port |`7600`|
37
50
|`keycloak_management_http_port`| Management port |`9990`|
38
51
|`keycloak_management_https_port`| TLS management port |`9993`|
@@ -76,44 +106,14 @@ The following variables are _required_ only when `keycloak_db_enabled` is True:
76
106
|`keycloak_db_user`| username for connecting to postgres |`keycloak-user`|
77
107
|`keycloak_db_pass`| password for connecting to postgres |`keycloak-pass`|
78
108
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`|
83
109
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
+
-----------------
88
112
89
-
Dependencies
90
-
------------
91
-
92
-
The roles depends on:
113
+
_NOTE_: use ansible vaults or other security systems for storing credentials.
93
114
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
-
```
115
115
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:
117
117
118
118
```yaml
119
119
---
@@ -126,10 +126,9 @@ The following is an example playbook that makes use of the role to install keycl
126
126
name: keycloak
127
127
vars:
128
128
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
130
129
```
131
130
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:
133
132
134
133
```yaml
135
134
---
@@ -146,9 +145,30 @@ The following is an example playbook that makes use of the role to install Red H
146
145
vars:
147
146
keycloak_admin_password: "changeme"
148
147
keycloak_rhsso_enable: True
148
+
rhn_username: '<customer portal username>'
149
+
rhn_password: '<customer portal password>'
149
150
```
150
151
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:
152
172
153
173
```yaml
154
174
---
@@ -162,10 +182,12 @@ The following is an example playbook that makes use of the role to install Red H
162
182
vars:
163
183
keycloak_admin_password: "changeme"
164
184
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
166
187
```
167
188
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:
169
191
170
192
```yaml
171
193
---
@@ -179,7 +201,8 @@ The following is an example playbook that makes use of the role to install Red H
179
201
vars:
180
202
keycloak_admin_password: "changeme"
181
203
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
0 commit comments