Skip to content
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
78 changes: 78 additions & 0 deletions roles/cm_repo_local/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# cm_repo_local

Set up a local HTTP-based package repository for Cloudera Manager.

This role downloads a Cloudera Manager tarball package and sets up a local HTTP repository using Apache (httpd). This is useful for air-gapped environments or when you want to serve Cloudera Manager packages from a local web server.

The role will:
- Install and configure Apache HTTP Server (httpd)
- Download the Cloudera Manager tarball package from a specified URL
- Extract the tarball to a local repository directory with proper permissions (755)
- Configure httpd to serve the repository on a custom port
- Create a YUM repository configuration pointing to the local repository
- Clean YUM metadata to ensure the new repository is recognized

# Requirements

- Internet access from the target host to the specified package repository URL.
- Appropriate system permissions to manage package repositories (e.g., root access or sudo privileges).

# Dependencies

None.

# Parameters

| Variable | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `cloudera_manager_version` | `str` | `False` | `7.11.3` | Version of Cloudera Manager (used for reference/documentation) |
| `cloudera_manager_tarball_url` | `str` | `True` | - | Full URL to the Cloudera Manager tarball package (e.g., `https://archive.cloudera.com/cm7/7.11.3/redhat8/yum/cloudera-manager-7.11.3-redhat8.tar.gz`) |
| `cloudera_manager_repo_username` | `str` | `False` | - | Username for authenticated tarball downloads (if required) |
| `cloudera_manager_repo_password` | `str` | `False` | - | Password for authenticated tarball downloads (if required) |
| `cm_local_repo_base_path` | `str` | `False` | `/var/www/html/cloudera-repos` | Base directory where the repository will be extracted |
| `cm_local_repo_httpd_port` | `int` | `False` | `3333` | Port on which httpd will serve the local repository |
| `cm_local_repo_httpd_conf` | `str` | `False` | `/etc/httpd/conf/httpd.conf` | Path to the httpd configuration file |
| `cm_local_repo_yum_conf` | `str` | `False` | `/etc/yum.repos.d/cloudera-manager.repo` | Path to the YUM repository configuration file |

# Example Playbook

```yaml
- hosts: all
tasks:
- name: Set up local repository with authentication
ansible.builtin.import_role:
name: cloudera.exe.cm_repo_local
vars:
cloudera_manager_version: 7.11.3
cloudera_manager_tarball_url: "https://my-internal-repo.example/cm7/7.11.3/redhat8/yum/cloudera-manager-7.11.3.tar.gz"
cloudera_manager_repo_username: "YOUR_UUID_HERE" # Replace with your actual UUID
cloudera_manager_repo_password: "YOUR_PASSWORD_HERE" # Replace with your actual

- name: Set up local repository with custom paths and port
ansible.builtin.import_role:
name: cloudera.exe.cm_repo_local
vars:
cloudera_manager_tarball_url: "https://my-internal-repo.example/cm7/7.11.3/redhat8/yum/cloudera-manager-7.11.3.tar.gz"
cm_local_repo_base_path: "/opt/repos/cloudera"
cm_local_repo_httpd_port: 8080
cloudera_manager_repo_username: "YOUR_UUID_HERE" # Replace with your actual UUID
cloudera_manager_repo_password: "YOUR_PASSWORD_HERE" # Replace with your actual
```

# 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.
```
27 changes: 27 additions & 0 deletions roles/cm_repo_local/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
# 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.

cloudera_manager_version: 7.11.3
# cloudera_manager_release: "{{ cloudera_manager_version }}"

# cloudera_manager_tarball_url: URL to the CM tarball package
# cloudera_manager_repo_username: Username for authenticated downloads
# cloudera_manager_repo_password: Password for authenticated downloads


cm_local_repo_base_path: "/var/www/html/cloudera-repos"
cm_local_repo_httpd_port: 3333
cm_local_repo_httpd_conf: "/etc/httpd/conf/httpd.conf"
cm_local_repo_yum_conf: "/etc/yum.repos.d/cloudera-manager.repo"
19 changes: 19 additions & 0 deletions roles/cm_repo_local/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
# 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.

- name: restart httpd
ansible.builtin.service:
name: httpd
state: restarted
65 changes: 65 additions & 0 deletions roles/cm_repo_local/meta/argument_specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
# 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.

argument_specs:
main:
short_description: Set up a local HTTP-based package repository for Cloudera Manager
description:
- Downloads a Cloudera Manager tarball package and sets up a local HTTP repository
- Installs and configures Apache HTTP Server (httpd)
- Extracts the tarball with proper permissions (755)
- Creates YUM repository configuration pointing to the local repository
author:
- "Ronald Suplina <[email protected]>"
version_added: "3.3.0"
options:
cloudera_manager_version:
type: str
required: false
default: "7.11.3"
description: Version of Cloudera Manager (used for reference/documentation)
cloudera_manager_tarball_url:
type: str
required: true
description: Full URL to the Cloudera Manager tarball package
cloudera_manager_repo_username:
type: str
required: false
description: Username for authenticated tarball downloads
cloudera_manager_repo_password:
type: str
required: false
description: Password for authenticated tarball downloads
no_log: true
cm_local_repo_base_path:
type: str
required: false
default: "/var/www/html/cloudera-repos"
description: Base directory where the repository will be extracted
cm_local_repo_httpd_port:
type: int
required: false
default: 3333
description: Port on which httpd will serve the local repository
cm_local_repo_httpd_conf:
type: str
required: false
default: "/etc/httpd/conf/httpd.conf"
description: Path to the httpd configuration file
cm_local_repo_yum_conf:
type: str
required: false
default: "/etc/yum.repos.d/cloudera-manager.repo"
description: Path to the YUM repository configuration file
23 changes: 23 additions & 0 deletions roles/cm_repo_local/molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
# 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.

- name: Converge
hosts: all
gather_facts: true
become: true
tasks:
- name: Set up Cloudera Manager repository
ansible.builtin.import_role:
name: cloudera.exe.cm_repo_local
Loading
Loading