-
Notifications
You must be signed in to change notification settings - Fork 29
Add cm_local_repo role for provisioning a local CM repository #314
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.