Skip to content

Add CSD download role #316

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

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
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
75 changes: 75 additions & 0 deletions roles/cm_csds/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# cm_csds

Download CSDs.

This role downloads a specified list of Cloudera Custom Services Descriptor (CSD) files to a designated directory, typically on a Cloudera Manager Server host. It can optionally trigger a restart of the Cloudera Manager Server to apply the newly downloaded CSDs and supports authentication for downloading CSDs from protected repositories.

The role will:
- Ensure the `cloudera_manager_csd_directory` exists and has appropriate permissions.
- Download each CSD file specified in `cloudera_manager_csds` to the CSD directory.
- If `cloudera_manager_csd_restarted` is true, restart the Cloudera Manager Server service.
- Handle authentication for CSD downloads if `cloudera_manager_repo_username` and `cloudera_manager_repo_password` are provided.

# Requirements

- Network access from the target host to the URLs specified in `cloudera_manager_csds`.
- Write permissions for the Ansible user on the `cloudera_manager_csd_directory`.
- If `cloudera_manager_csd_restarted` is set to `true`, the target host must be the Cloudera Manager Server, and the Ansible user must have permissions to restart its service.

# Dependencies

None.

# Parameters

| Variable | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `cloudera_manager_csd_directory` | `str` | `False` | `/opt/cloudera/csd` | Location where CSD JAR files are downloaded on the target host. |
| `cloudera_manager_csds` | `list` of `str` | `False` | `[]` | A list of URLs pointing to the CSD JAR files to download. |
| `cloudera_manager_csd_restarted` | `bool` | `False` | `false` | Flag to restart the Cloudera Manager Server service after downloading CSDs. Set to `true` to apply new CSDs immediately. |
| `cloudera_manager_repo_username` | `str` | `False` | | Username for authenticating to a protected Cloudera package repository from which CSDs might be downloaded. |
| `cloudera_manager_repo_password` | `str` | `False` | | Password for authenticating to a protected Cloudera package repository from which CSDs might be downloaded. |

# Example Playbook

```yaml
- hosts: cm_server
tasks:
- name: Download specified CSDs and restart CM
ansible.builtin.import_role:
name: cloudera.cluster.cm_csds
vars:
cloudera_manager_csds:
- "https://archive.cloudera.com/csd/service_name-1.0.jar"
- "https://my-internal-repo.example.com/custom_service-2.0.jar"
cloudera_manager_csd_restarted: true
cloudera_manager_repo_username: "my_repo_user" # Only if CSDs are in a protected repo
cloudera_manager_repo_password: "my_repo_password" # Only if CSDs are in a protected repo

- name: Download CSDs to a custom directory without restarting
ansible.builtin.import_role:
name: cloudera.cluster.cm_csds
vars:
cloudera_manager_csd_directory: "/usr/local/cloudera/csd_extra"
cloudera_manager_csds:
- http://another.example.com/another_csd.jar"
cloudera_manager_csd_restarted: false
```

# License

```
Copyright 2025 Cloudera, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
22 changes: 22 additions & 0 deletions roles/cm_csds/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2024 Cloudera, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---

cloudera_manager_csd_directory: "/opt/cloudera/csd"

Check failure on line 17 in roles/cm_csds/defaults/main.yml

View workflow job for this annotation

GitHub Actions / pre-commit

var-naming[no-role-prefix]

Variables names from within roles should use cm_csds_ as a prefix. (vars: cloudera_manager_csd_directory)
cloudera_manager_csds: []

Check failure on line 18 in roles/cm_csds/defaults/main.yml

View workflow job for this annotation

GitHub Actions / pre-commit

var-naming[no-role-prefix]

Variables names from within roles should use cm_csds_ as a prefix. (vars: cloudera_manager_csds)
cloudera_manager_csd_restarted: false

Check failure on line 19 in roles/cm_csds/defaults/main.yml

View workflow job for this annotation

GitHub Actions / pre-commit

var-naming[no-role-prefix]

Variables names from within roles should use cm_csds_ as a prefix. (vars: cloudera_manager_csd_restarted)

# cloudera_manager_repo_username:
# cloudera_manager_repo_password:
45 changes: 45 additions & 0 deletions roles/cm_csds/meta/argument_specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2024 Cloudera, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

argument_specs:
main:
short_description: "Download CSDs"
description:
- Downloads a specified list of Cloudera Custom Services Descriptor (CSD) files.
author:
- "Jim Enright <[email protected]>"
version_added: 5.0.0
options:
cloudera_manager_csd_directory:
description: Location where CSDs are downloaded
type: str
required: false
default: "/opt/cloudera/csd"
cloudera_manager_csds:
description: List of CSD jars URLs to download
type: list
elements: str
required: false
default: []
cloudera_manager_csd_restarted:
description: Flag to restart Cloudera Manager Server if CSDs are downloaded.
type: bool
required: false
default: false
cloudera_manager_repo_username:
description:
- Cloudera package repository username
cloudera_manager_repo_password:
description:
- Cloudera package repository password
27 changes: 27 additions & 0 deletions roles/cm_csds/molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2024 Cloudera, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Converge
hosts: all
gather_facts: true
become: true
tasks:
- name: Install CSDs
ansible.builtin.import_role:
name: cm_csds
vars:
cloudera_manager_csds:

Check failure on line 24 in roles/cm_csds/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / pre-commit

var-naming[no-role-prefix]

Variables names from within roles should use cm_csds_ as a prefix. (vars: cloudera_manager_csds)
- https://archive.cloudera.com/p/cfm2/2.1.6.1005/redhat8/yum/tars/parcel/NIFI-1.23.1.2.1.6.1005-1.jar
- https://archive.cloudera.com/p/csa/1.10.0.0/csd/FLINK-1.16.1-csa1.10.0.0-cdh7.1.8.0-801-41959971.jar
- https://archive.cloudera.com/p/csa/1.10.0.0/csd/SQL_STREAM_BUILDER-1.16.1-csa1.10.0.0-cdh7.1.8.0-801-41959971.jar
Loading
Loading