Skip to content
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

Add cluster module #224

Merged
merged 29 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e5218b9
Cluster Module Updates
rsuplina May 8, 2024
86f778f
Remove cm_cluster
rsuplina May 8, 2024
5247710
Rename cm_cluster_info to cluster_info
wmudge May 8, 2024
c76fdaa
Add state parameter
wmudge May 8, 2024
bdc72b8
Add module defaults groups for general Cloudera Manager access and cl…
wmudge May 8, 2024
511a8f9
Update to create services on new cluster
wmudge May 8, 2024
6a9decc
Add hosts, host templates, and direct role group assignments to clust…
wmudge May 8, 2024
2c96301
Add tests for base config, service, role groups, host template, and d…
wmudge May 8, 2024
a0a5826
Add YAML args fixture
wmudge May 8, 2024
f760017
Fix cm-client Python dependency
wmudge May 8, 2024
439fa91
Add Google Analytics tag for API documentation
wmudge May 8, 2024
cde7014
Refactor parcel management logic into shared utility class
wmudge May 8, 2024
e80ad55
Add parcel activation for new cluster and reorder operations
wmudge May 8, 2024
d40acb8
Formatting for parcel module
wmudge May 8, 2024
186015a
Refactor Parcel class to use class instance for stage
wmudge May 8, 2024
dc076ff
Update integration test for host template assignment
wmudge May 8, 2024
3ebfed5
Remove commented code
wmudge May 9, 2024
b2fddd1
Add Parcel and create parse_parcel_result()
wmudge May 9, 2024
91fb3be
Update to use Parcel class in module_utils
wmudge May 9, 2024
fc76d23
Remove extraneous import
wmudge May 9, 2024
90d2f59
Parameterize parcel test inputs
wmudge May 9, 2024
91f3886
Add initial pre-commit configuration, including black linter for Pyth…
wmudge May 9, 2024
6e8b410
Comment out duplicate (and unused/invalid) 'when' keys found by pre-c…
wmudge May 9, 2024
9e0bb71
Comment out duplicate 'endpoint' path for updating Capacity Scheduler…
wmudge May 9, 2024
ef11f91
Update collection from initial pre-commit formatting for YAML and whi…
wmudge May 9, 2024
0fefdea
Add pre-commit GitHub Action
wmudge May 9, 2024
5aee9fa
Add role overrides for cluster creation
wmudge May 10, 2024
a04111d
Allow base role group discovery
wmudge May 14, 2024
0d25b54
Add full example of a basic cluster to tests
wmudge May 14, 2024
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
28 changes: 28 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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: pre-commit

on:
pull_request:
push:
branches: [main, devel]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.1
4 changes: 2 additions & 2 deletions .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ name: Publish documentation
on:
push:
branches:
- 'main'
- 'main'

workflow_dispatch:

jobs:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/validate_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
branches:
- 'release/**'
- 'devel'

jobs:
validate:
runs-on: ubuntu-latest
Expand All @@ -34,7 +34,7 @@ jobs:
with:
python-version: '3.9'
cache: 'pip'

- name: Set up Ansible and Ansible collections and roles
run: |
sudo update-alternatives --install /usr/bin/python python $(which python3) 1
Expand All @@ -49,16 +49,16 @@ jobs:
ansible --version
ansible-galaxy collection list
ansible-galaxy role list

- name: Set up Ansible collection dependencies
run: |
ansible-builder introspect --write-pip final_python.txt --write-bindep final_bindep.txt /usr/share/ansible/collections
[[ -f final_python.txt ]] && pip install -r final_python.txt || echo "No Python dependencies found."
[[ -f final_bindep.txt ]] && bindep --file final_bindep.txt || echo "No system dependencies found."

- name: Report installed Python dependencies
run: pip freeze

- name: Validate collection
run: |
pushd /usr/share/ansible/collections/ansible_collections/cloudera/cluster
Expand All @@ -75,7 +75,7 @@ jobs:
run: |
mkdir -p ./pr
echo $PR_NUMBER > ./pr/pr_number

- name: Upload the PR number
uses: actions/upload-artifact@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate_pr_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
branches:
- 'release/**'
- 'devel'

workflow_dispatch:

jobs:
Expand All @@ -31,4 +31,4 @@ jobs:
with:
antsibull-log-upload: true
collection-namespace: cloudera
collection-name: cluster
collection-name: cluster
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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.

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Thank you for considering contributions to the `cloudera.cluster` Ansible collec

## Submitting a pull request

You can start work on issues that are not yet part of a [Milestone](https://github.com/cloudera-labs/cloudera.cluster/milestones) -- anything in our issue tracker that isn't assigned to a Milestone is considered the [backlog](https://github.com/cloudera-labs/cloudera.cluster/issues?q=is%3Aopen+is%3Aissue+no%3Amilestone).
You can start work on issues that are not yet part of a [Milestone](https://github.com/cloudera-labs/cloudera.cluster/milestones) -- anything in our issue tracker that isn't assigned to a Milestone is considered the [backlog](https://github.com/cloudera-labs/cloudera.cluster/issues?q=is%3Aopen+is%3Aissue+no%3Amilestone).

Before you start working, please announce that you want to do so by commenting on the issue. _([Create an issue](https://github.com/cloudera-labs/cloudera.cluster/issues/new?labels=enhancement) if there isn't one yet, and you can also check out our [Discussions](https://github.com/cloudera-labs/cloudera.cluster/discussions) for ideas.)_ We try to ensure that all active work is assigned to a Milestone in order to keep our backlog accurate.

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ If you have any questions, want to chat about the collection's capabilities and

## API

See the [API documentation](https://cloudera-labs.github.io/cloudera.cluster/) for details for each plugin and role within the collection.
See the [API documentation](https://cloudera-labs.github.io/cloudera.cluster/) for details for each plugin and role within the collection.

## Roadmap

Expand Down Expand Up @@ -105,7 +105,7 @@ The collection also requires the following Python libraries to operate its modul

The collection's Python dependencies alone, _not_ the required Python libraries of its collection dependencies, are in `requirements.txt`.

All collection dependencies, required and optional, can be found in `requirements.yml`; only the _required_ dependencies are in `galaxy.yml`. `ansible-galaxy` will install only the _required_ collection dependencies; you will need to add the _optional_ collection dependencies as needed (see above).
All collection dependencies, required and optional, can be found in `requirements.yml`; only the _required_ dependencies are in `galaxy.yml`. `ansible-galaxy` will install only the _required_ collection dependencies; you will need to add the _optional_ collection dependencies as needed (see above).

`ansible-builder` can discover and install all Python dependencies - current collection and dependencies - if you wish to use that application to construct your environment. Otherwise, you will need to read each collection and role dependency and follow its installation instructions.

Expand Down Expand Up @@ -154,7 +154,7 @@ For example, here we use the
To create a local collection tarball, run:

```bash
ansible-galaxy collection build
ansible-galaxy collection build
```

## Building the API Documentation
Expand Down
2 changes: 1 addition & 1 deletion builder/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ roles:

# geerlingguy.mysql with fix for issue #332
- src: https://github.com/dbeech/ansible-role-mysql
version: master
version: master
14 changes: 7 additions & 7 deletions docs/inventories.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ host-1.example.com

### Cluster Nodes

A group named `cluster` is **required**. This is the set of nodes which will have a Cloudera Manager agent and receive pre-requisite configurations like OS tuning, database client and JDK installation and Kerberos configs.
A group named `cluster` is **required**. This is the set of nodes which will have a Cloudera Manager agent and receive pre-requisite configurations like OS tuning, database client and JDK installation and Kerberos configs.

Usually, `cluster` will be composed of child groups like this:

Expand All @@ -40,7 +40,7 @@ host-5.example.com
host-6.example.com
```

The names of the cluster sub-groups are arbitrary. These are only for convenience when assigning host template names and to make the inventory easier to read and understand.
The names of the cluster sub-groups are arbitrary. These are only for convenience when assigning host template names and to make the inventory easier to read and understand.

#### Assigning Host Templates

Expand Down Expand Up @@ -114,9 +114,9 @@ cdsw

### HDFS Encryption (KMS / Key Trustee Server)

Configuring HDFS encryption requires two extra groups `kts_active` and `kms_servers` with a third, optional (but **recommended**) group `kts_passive` to enable Key Trustee Server high availability.
Configuring HDFS encryption requires two extra groups `kts_active` and `kms_servers` with a third, optional (but **recommended**) group `kts_passive` to enable Key Trustee Server high availability.

The `kts_active` and `kts_passive` groups must contain a single node each. The KMS group `kms_servers` must have at least one host but can have as many as desired.
The `kts_active` and `kts_passive` groups must contain a single node each. The KMS group `kms_servers` must have at least one host but can have as many as desired.

```ini
[kms_servers]
Expand Down Expand Up @@ -181,10 +181,10 @@ host-10.example.com

## Multiple Clusters

It is possible to define multiple clusters in the inventory. The key point is that the `cluster` group must contain **all** servers which will be under Cloudera Manager's control, regardless of which cluster they belong to.
It is possible to define multiple clusters in the inventory. The key point is that the `cluster` group must contain **all** servers which will be under Cloudera Manager's control, regardless of which cluster they belong to.


The inventory group names `cluster1` and `cluster2` are arbitrary. This is just a convenience to make the inventory easier to understand.
The inventory group names `cluster1` and `cluster2` are arbitrary. This is just a convenience to make the inventory easier to understand.

```ini
[cluster1]
Expand All @@ -202,4 +202,4 @@ host-9.example.com host_template=Cluster2-Worker
[cluster:children]
cluster1
cluster2
```
```
4 changes: 2 additions & 2 deletions docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ tls=True
ca-server-1.example.com
```

3b) If you wish to manually sign certificates against an
3b) If you wish to manually sign certificates against an
external CA, like Active Directory, add the path where signed certificates will be stored and root CA certificate details in `defintion.yml`

```yaml
Expand Down Expand Up @@ -103,4 +103,4 @@ kms-3.example.com

If you do not want Key Trustee Server to be highly available, you can omit the `kts_passive` group (this is **not** recommended).

The KMS group `kms_servers` must have at least one host but can have as many as desired. Unlike KTS, KMS nodes are all active and load balanced.
The KMS group `kms_servers` must have at least one host but can have as many as desired. Unlike KTS, KMS nodes are all active and load balanced.
20 changes: 10 additions & 10 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ or
fatal: [host.example.com]: UNREACHABLE! => {"changed": false, "msg": "SSH password was requested, but none specified", "unreachable": true}
```

**Problem**:
**Problem**:

- Passwordless SSH connectivity is not correctly set up between your Ansible server and the remote servers in the inventory.
- Passwordless SSH connectivity is not correctly set up between your Ansible server and the remote servers in the inventory.

**Solutions**:

Expand All @@ -32,7 +32,7 @@ fatal: [host.example.com]: UNREACHABLE! => {"changed": false, "msg": "SSH passwo
fatal: [host.example.com]: UNREACHABLE! => {"changed": false, "msg": "Host key checking is enabled, and SSH reported an unrecognized or mismatching host key.", "unreachable": true}
```

**Problem**:
**Problem**:

- SSH host key checking is enabled (Ansible default) but the servers you are trying to connect to are not present in `known_hosts` (or their key has changed)

Expand All @@ -57,38 +57,38 @@ fatal: [host.example.com]: UNREACHABLE! => {"changed": false, "msg": "Host key c

The cause is likely to be one of the following:

1) Inconsistent hostname resolution. The Cloudera Manager is reporting itself with a different hostname to that contained in your inventory file.
1) Inconsistent hostname resolution. The Cloudera Manager is reporting itself with a different hostname to that contained in your inventory file.

2) Cloudera Manager agent(s) are not heartbeating correctly.

**Solution**:

By this stage of the playbook execution, Cloudera Manager server will be running. Log into Cloudera Manager and view the **Hosts** page:

- If hosts appear, check the list to ensure that the hostnames shown match your inventory file. If they do not match, either update your inventory file with these hostnames or update the cluster DNS so that the same names can be resolved consistently everywhere.
- If hosts appear, check the list to ensure that the hostnames shown match your inventory file. If they do not match, either update your inventory file with these hostnames or update the cluster DNS so that the same names can be resolved consistently everywhere.

- If no hosts appear, log into the server indicated in the error message, and:

- Check that the `cloudera-manager-agent` service is running.
- Check that the `cloudera-manager-agent` service is running.

- Check the Cloudera Manager agent log file `/var/log/cloudera-scm-agent/cloudera-scm-agent.log`. Any error message there should give a clue as to why communication with the Cloudera Manager server is failing.
- Check the Cloudera Manager agent log file `/var/log/cloudera-scm-agent/cloudera-scm-agent.log`. Any error message there should give a clue as to why communication with the Cloudera Manager server is failing.

## Common issue #4

```
ERROR! couldn't resolve module/action 'cm_api'. This often indicates a misspelling, missing collection, or incorrect module path.
```

**Problem**:
**Problem**:

- The `cm_api` action is not available in a custom role.

**Solution**:
**Solution**:

- Add the following into the role's `meta/main.yml` file.

```yaml
---
dependencies:
- role: cloudera_manager/api_client
```
```
2 changes: 1 addition & 1 deletion docsbuild/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

/temp-rst
/build
/rst
/rst
2 changes: 1 addition & 1 deletion docsbuild/antsibull-docs.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ logging_cfg = {
output_name = stderr
}
}
}
}
7 changes: 3 additions & 4 deletions docsbuild/cloudera.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
/**
* 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
*
*
* http://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.
*/

Loading
Loading