Skip to content

Commit ef77958

Browse files
authored
Add cm_local_repo role for provisioning a local CM repository (#314)
Signed-off-by: rsuplina <rsuplina@cloudera.com>
1 parent 79ef8c6 commit ef77958

File tree

13 files changed

+949
-0
lines changed

13 files changed

+949
-0
lines changed

roles/cm_repo_local/README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# cm_repo_local
2+
3+
Set up a local HTTP-based package repository for Cloudera Manager.
4+
5+
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.
6+
7+
The role will:
8+
- Install and configure Apache HTTP Server (httpd)
9+
- Download the Cloudera Manager tarball package from a specified URL
10+
- Extract the tarball to a local repository directory with proper permissions (755)
11+
- Configure httpd to serve the repository on a custom port
12+
- Create a YUM repository configuration pointing to the local repository
13+
- Clean YUM metadata to ensure the new repository is recognized
14+
15+
# Requirements
16+
17+
- Internet access from the target host to the specified package repository URL.
18+
- Appropriate system permissions to manage package repositories (e.g., root access or sudo privileges).
19+
20+
# Dependencies
21+
22+
None.
23+
24+
# Parameters
25+
26+
| Variable | Type | Required | Default | Description |
27+
| --- | --- | --- | --- | --- |
28+
| `cloudera_manager_version` | `str` | `False` | `7.11.3` | Version of Cloudera Manager (used for reference/documentation) |
29+
| `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`) |
30+
| `cloudera_manager_repo_username` | `str` | `False` | - | Username for authenticated tarball downloads (if required) |
31+
| `cloudera_manager_repo_password` | `str` | `False` | - | Password for authenticated tarball downloads (if required) |
32+
| `cm_local_repo_base_path` | `str` | `False` | `/var/www/html/cloudera-repos` | Base directory where the repository will be extracted |
33+
| `cm_local_repo_httpd_port` | `int` | `False` | `3333` | Port on which httpd will serve the local repository |
34+
| `cm_local_repo_httpd_conf` | `str` | `False` | `/etc/httpd/conf/httpd.conf` | Path to the httpd configuration file |
35+
| `cm_local_repo_yum_conf` | `str` | `False` | `/etc/yum.repos.d/cloudera-manager.repo` | Path to the YUM repository configuration file |
36+
37+
# Example Playbook
38+
39+
```yaml
40+
- hosts: all
41+
tasks:
42+
- name: Set up local repository with authentication
43+
ansible.builtin.import_role:
44+
name: cloudera.exe.cm_repo_local
45+
vars:
46+
cloudera_manager_version: 7.11.3
47+
cloudera_manager_tarball_url: "https://my-internal-repo.example/cm7/7.11.3/redhat8/yum/cloudera-manager-7.11.3.tar.gz"
48+
cloudera_manager_repo_username: "YOUR_UUID_HERE" # Replace with your actual UUID
49+
cloudera_manager_repo_password: "YOUR_PASSWORD_HERE" # Replace with your actual
50+
51+
- name: Set up local repository with custom paths and port
52+
ansible.builtin.import_role:
53+
name: cloudera.exe.cm_repo_local
54+
vars:
55+
cloudera_manager_tarball_url: "https://my-internal-repo.example/cm7/7.11.3/redhat8/yum/cloudera-manager-7.11.3.tar.gz"
56+
cm_local_repo_base_path: "/opt/repos/cloudera"
57+
cm_local_repo_httpd_port: 8080
58+
cloudera_manager_repo_username: "YOUR_UUID_HERE" # Replace with your actual UUID
59+
cloudera_manager_repo_password: "YOUR_PASSWORD_HERE" # Replace with your actual
60+
```
61+
62+
# License
63+
64+
```
65+
Copyright 2025 Cloudera, Inc.
66+
67+
Licensed under the Apache License, Version 2.0 (the "License");
68+
you may not use this file except in compliance with the License.
69+
You may obtain a copy of the License at
70+
71+
https://www.apache.org/licenses/LICENSE-2.0
72+
73+
Unless required by applicable law or agreed to in writing, software
74+
distributed under the License is distributed on an "AS IS" BASIS,
75+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
76+
See the License for the specific language governing permissions and
77+
limitations under the License.
78+
```
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
# Copyright 2025 Cloudera, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
cloudera_manager_version: 7.11.3
17+
# cloudera_manager_release: "{{ cloudera_manager_version }}"
18+
19+
# cloudera_manager_tarball_url: URL to the CM tarball package
20+
# cloudera_manager_repo_username: Username for authenticated downloads
21+
# cloudera_manager_repo_password: Password for authenticated downloads
22+
23+
24+
cm_local_repo_base_path: "/var/www/html/cloudera-repos"
25+
cm_local_repo_httpd_port: 3333
26+
cm_local_repo_httpd_conf: "/etc/httpd/conf/httpd.conf"
27+
cm_local_repo_yum_conf: "/etc/yum.repos.d/cloudera-manager.repo"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
# Copyright 2025 Cloudera, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
- name: restart httpd
17+
ansible.builtin.service:
18+
name: httpd
19+
state: restarted
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
# Copyright 2025 Cloudera, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
argument_specs:
17+
main:
18+
short_description: Set up a local HTTP-based package repository for Cloudera Manager
19+
description:
20+
- Downloads a Cloudera Manager tarball package and sets up a local HTTP repository
21+
- Installs and configures Apache HTTP Server (httpd)
22+
- Extracts the tarball with proper permissions (755)
23+
- Creates YUM repository configuration pointing to the local repository
24+
author:
25+
- "Ronald Suplina <rsuplina@cloudera.com>"
26+
version_added: "3.3.0"
27+
options:
28+
cloudera_manager_version:
29+
type: str
30+
required: false
31+
default: "7.11.3"
32+
description: Version of Cloudera Manager (used for reference/documentation)
33+
cloudera_manager_tarball_url:
34+
type: str
35+
required: true
36+
description: Full URL to the Cloudera Manager tarball package
37+
cloudera_manager_repo_username:
38+
type: str
39+
required: false
40+
description: Username for authenticated tarball downloads
41+
cloudera_manager_repo_password:
42+
type: str
43+
required: false
44+
description: Password for authenticated tarball downloads
45+
no_log: true
46+
cm_local_repo_base_path:
47+
type: str
48+
required: false
49+
default: "/var/www/html/cloudera-repos"
50+
description: Base directory where the repository will be extracted
51+
cm_local_repo_httpd_port:
52+
type: int
53+
required: false
54+
default: 3333
55+
description: Port on which httpd will serve the local repository
56+
cm_local_repo_httpd_conf:
57+
type: str
58+
required: false
59+
default: "/etc/httpd/conf/httpd.conf"
60+
description: Path to the httpd configuration file
61+
cm_local_repo_yum_conf:
62+
type: str
63+
required: false
64+
default: "/etc/yum.repos.d/cloudera-manager.repo"
65+
description: Path to the YUM repository configuration file
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
# Copyright 2025 Cloudera, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
- name: Converge
17+
hosts: all
18+
gather_facts: true
19+
become: true
20+
tasks:
21+
- name: Set up Cloudera Manager repository
22+
ansible.builtin.import_role:
23+
name: cloudera.exe.cm_repo_local

0 commit comments

Comments
 (0)