Skip to content

Commit 1fcaecb

Browse files
committed
Add JDK support check for Cloudera Manager and Cloudera Manager
Signed-off-by: Webster Mudge <[email protected]>
1 parent 74c8a38 commit 1fcaecb

File tree

5 files changed

+49
-0
lines changed

5 files changed

+49
-0
lines changed

roles/prereq_jdk/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ Set up JDK
44

55
This role automates the setup of a Java Development Kit (JDK) on a host. It can optionally install the JDK packages from various providers (OpenJDK, Oracle, Azul), handle version management, and perform post-installation configuration. For older JDK versions (9 and below), it can also enable the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy to support stronger encryption.
66

7+
This role also verifies the JDK on target host against the official Cloudera on-premises support matrix, which is available at [supportmatrix.cloudera.com/](https://supportmatrix.cloudera.com). It is designed to be run early in a deployment pipeline to ensure that the environment meets the JDK prerequisites before proceeding with the installation of Cloudera products.
8+
79
The role will:
810
- Install the specified JDK packages if `jdk_install_packages` is `true`.
911
- For JDK versions 8 and below, it will apply the JCE Unlimited Strength Jurisdiction Policy if needed, by modifying `java.security` files.
1012
- If multiple `java.security` files are found during JCE configuration, it will either proceed or halt based on the `jdk_security_paths_override` flag.
1113
- For JDKs installed from Cloudera's repository, the role will ensure that any missing symbolic links are created to support a consistent JDK installation path.
14+
- Compare JDK against the support matrix at [supportmatrix.cloudera.com/](https://supportmatrix.cloudera.com) for the specified versions of Cloudera Manager and Cloudera Runtime.
1215

1316
# Requirements
1417

1518
- Root or `sudo` privileges are required to install packages and modify system-wide configuration files.
1619
- Network access to the package repositories for the chosen JDK provider.
20+
- Access to the [supportmatrix.cloudera.com/](https://supportmatrix.cloudera.com) site.
1721

1822
# Dependencies
1923

@@ -29,6 +33,8 @@ None.
2933
| `jdk_version` | `int` | `False` | `17` | The supported JDK version to install. Valid choices are `8`, `11`, and `17`. |
3034
| `jdk_security_paths` | `list` of `path` | `False` | - | A list of paths to search for `java.security` files. The role will only apply JCE changes to files in these locations. |
3135
| `jdk_security_paths_override` | `bool` | `False` | `False` | Flag to control behavior when multiple `java.security` files are found in the specified paths. If `true`, the role will continue with JCE changes even if multiple files are found. If `false`, the role will fail, requiring a more specific path list. |
36+
| `cloudera_manager_version` | `str` | `True` | | The version of Cloudera Manager to validate against. |
37+
| `cloudera_runtime_version` | `str` | `True` | | The version of Cloudera Runtime to validate against. |
3238

3339
# Example Playbook
3440

@@ -38,6 +44,9 @@ None.
3844
- name: Set up default OpenJDK 17 installation
3945
ansible.builtin.import_role:
4046
name: cloudera.exe.prereq_jdk
47+
vars:
48+
cloudera_manager_version: "7.11.3"
49+
cloudera_runtime_version: "7.1.9"
4150
# All variables will use their defaults, installing OpenJDK 17.
4251

4352
- name: Set up Oracle JDK 11 without installing packages
@@ -47,6 +56,8 @@ None.
4756
jdk_provider: oracle
4857
jdk_version: 11
4958
jdk_install_packages: false # Assume JDK 11 is already installed
59+
cloudera_manager_version: "7.11.3"
60+
cloudera_runtime_version: "7.1.9"
5061

5162
- name: Set up OpenJDK 8 with JCE policy
5263
ansible.builtin.import_role:
@@ -57,6 +68,8 @@ None.
5768
jdk_security_paths:
5869
- /etc/java/security/
5970
jdk_security_paths_override: false
71+
cloudera_manager_version: "7.11.3"
72+
cloudera_runtime_version: "7.1.9"
6073
```
6174
6275
# License

roles/prereq_jdk/defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ jdk_install_packages: true
1919
jdk_version: 17
2020
# jdk_security_paths: []
2121
jdk_security_paths_override: false
22+
23+
cloudera_manager_version: "{{ undef(hint='Please specify the Cloudera Manager version') }}"
24+
cloudera_runtime_version: "{{ undef(hint='Please specify the Cloudera Runtime version') }}"

roles/prereq_jdk/meta/argument_specs.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,11 @@ argument_specs:
6060
- Flag to disable JCE changes ifo multiple C(java.security) files are found.
6161
type: bool
6262
default: false
63+
cloudera_manager_version:
64+
description: Version of Cloudera Manager for validation testing
65+
type: str
66+
required: true
67+
cloudera_runtime_version:
68+
description: Version of Cloudera Runtime for validation testing
69+
type: str
70+
required: true

roles/prereq_jdk/tasks/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
- name: Assert JDK support for Cloudera Runtime and Manager versions
17+
ansible.builtin.assert:
18+
that:
19+
- supported_cms |
20+
selectattr('family', 'eq', prereq_jdk_supported_map[jdk_provider]) |
21+
selectattr('version', 'eq', 'JDK' + jdk_version | string) |
22+
length > 0
23+
- supported_runtime |
24+
selectattr('family', 'eq', prereq_jdk_supported_map[jdk_provider]) |
25+
selectattr('version', 'eq', 'JDK' + jdk_version | string) |
26+
length > 0
27+
fail_msg: "{{ jdk_provider }} {{ jdk_version }} not supported."
28+
vars:
29+
supported_cms: "{{ lookup('cloudera.exe.supported', 'jdks', product='cloudera_manager', version=cloudera_manager_version) }}"
30+
supported_runtime: "{{ lookup('cloudera.exe.supported', 'jdks', product='cloudera_runtime', version=cloudera_runtime_version) }}"
31+
32+
- name: Gather distribution details
33+
ansible.builtin.setup:
34+
gather_subset: distribution
35+
1636
- name: Include OS-specific variables
1737
ansible.builtin.include_vars: "{{ item }}"
1838
with_first_found:

roles/prereq_jdk/vars/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
15+
prereq_jdk_supported_map:
16+
azul: AzulJDK
17+
openjdk: OpenJDK
18+
oracle: OracleJDK

0 commit comments

Comments
 (0)