Skip to content

Commit d6a96c4

Browse files
ChaffelsonTristan Stevens
authored andcommitted
Add selectable distribution support for cloudera.cluster (#35)
* FIX: parcel os distribution - When dynamically creating the cluster template, the OS distribution is not taken into account. - For instance, Ubuntu tries to load the KEYTRUSTEE_SERVER parcel but fails because it's only available for `el7` and `el8` Signed-off-by: Cody Fincher <[email protected]> * FIX: add ansible_distribution_release to product parsing. Signed-off-by: Cody Fincher <[email protected]> * Centos 8 support WIP Disable dnf AppStream module for Postgresql when centos 8 in use Setup system Python2 for CM to use Signed-off-by: Daniel Chaffelson <[email protected]> * Add EL8 support to Cloudera Collections Set default CM version to 7.4.4 in cloudera.cluster Derive parcel version of el7 or el8 from inventory target OS family in cloudera.cluster.cloudera_manager.repo Ensure that Python2/3 are present on nodes when deploying on Rhel8 family OS Change cloudera-deploy defaults to el7, but allow el8 to be specified and recognised Update utility VM used for download mirror to function correctly with el7 or el8 OS Add default_cluster tag to cluster.yml playbook CM Agent heartbeat test to avoid obscure failures Signed-off-by: Daniel Chaffelson <[email protected]> * Add selectable distribution support for cloudera.cluster Enable by setting parcel_distro in definition to [el7, el8, or bionic] per dynamic OS options in cloudera.exe.infrastructure.vars Change default dynamic inventory selection strings from 'centos7' to match the distribution identity strings of el7 etc. - user can update defaults to a different el7 distro etc. in cloudera.exe.infrastructure.vars Add Ubuntu 18.04 'bionic' as option to dynamic inventory Determine preferred parcel distribution in cloudera-deploy init Add uniqueness to generated dynamic inventory VM name to reflect selection of distribution in case multiple clusters are deployed in the same account Move dynamic inventory OS selection to globals, update appropriate reference docs to reflect change Add filtering by distro to download mirror support, and ensure that manifest is still always collected Enforce no_log always when working with Paywall credentials Increase initial paywall download timeout to 7200s due to present CDN speed issues when deploying on EC2 outside of us-east-1 Modify ansible.builtin.package lock_timeout to only be used on RedHat, as it is not a Debian option Pass selected parcel distribution to repo analysis during intial deployment when target cluster OS is not yet determined by deployment Move cloudera.cluster plays which require knowledge of the cluster distribution to run on the cloudera_manager host instead of the Ansible controller so the correct distribution actions are applied Fix extract_products_from_manifests filter in cloudera.cluster to correctly reference self and process os_distribution value Fix import ordering in cloudera.cluster filters.py to not break under recent versions of Python3 Add distribution specific tasks for cloudera.cluster.deployment.repometa so it can identify the cluster distribution using the strings recognised by Cloudera Manager deployment Force refresh of apt package cache on Debian distributions during OS prereqs setup in cloudera.cluster as the package cache in the image is sometimes missing packages Signed-off-by: Daniel Chaffelson <[email protected]> * Improve for CDH5 and Centos7 Pin boto3 version <1.18 when using Python2 for s3sync to work Set GPG to not be checked by default when deploying cm5 Set variants for cm5 and cm6/7 paths for cloudera manager URL Signed-off-by: Daniel Chaffelson <[email protected]> * Further multi-os improvements for clusters Improve readability of cloudera manager database user tasks Simplify variable inclusion for Debian OS by standardising for both Ubuntu18 and Ubuntu20 Replace hardcoded Ubuntu1804 version with derived version string where necessary Improve ca_server setup to recognise python differences between el7, el8 and debian Set rdbms setup to use psycopg2-binary instead of slightly less reliable python package install in Debian Move os-specific configurations to top of os setup tasks to allow Python to be fixed first as dependency for other things Add fix for Ubuntu20.04 to allow root to edit any file on the OS by default, which otherwise breaks cloudera manager database setup Ensure python2 is symlinked to /usr/bin/python on Redhat where /usr/bin/python is not already symlinked. This fixes Ranger startup issues. tls_signing now explicitly uses /bin/bash as executable to also work on Ubuntu20 Updated readme to reflect additionally tested OSs Signed-off-by: Daniel Chaffelson <[email protected]> Co-authored-by: Cody Fincher <[email protected]> Fixes #32
1 parent 89f81b4 commit d6a96c4

File tree

40 files changed

+197
-85
lines changed

40 files changed

+197
-85
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ This Ansible Collection is designed to work hand-in-hand with [Cloudera Deploy](
2323
### Operating Systems
2424

2525
- Red Hat / CentOS 7.x
26-
- Ubuntu 18.04.04 LTS (Bionic Beaver)
26+
- Red Hat / CentOS 8.x
27+
- Ubuntu 18.04 LTS (Bionic Beaver)
28+
- Ubuntu 20.04 LTS (Focal Fossa)
2729

2830
Active development is focused on **CDP Private Cloud Base** (formerly CDP-DC) deployments and their respective platform compatibility matrices.
2931

plugins/filter/filters.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
15-
from __future__ import (absolute_import, division, print_function)
14+
from __future__ import absolute_import, division, print_function
15+
from typing import Optional
1616
import re
1717

1818
__metaclass__ = type
@@ -74,15 +74,24 @@ def _flatten_dict_list(i, l, parents):
7474

7575
return state
7676

77-
def extract_products_from_manifests(self, manifests):
77+
def extract_products_from_manifests(self, manifests, os_distribution: Optional[str] = None):
7878
products = dict()
7979
for manifest in manifests:
80-
for parcel in manifest['parcels']:
80+
for parcel in manifest["parcels"]:
81+
# fetch the full parcel name from the manifest
82+
full_parcel_name = str(parcel["parcelName"])
83+
# the parcel OS distribution is between the last "-" and the ".parcel" extension
84+
parcel_os_distribution = full_parcel_name[
85+
full_parcel_name.rindex("-")
86+
+ 1: full_parcel_name.rindex(".parcel")
87+
]
8188
# take first parcel, strip off OS name and file extension
82-
parcel_name = re.sub(r"-[a-z0-9]+\.parcel$", "", str(parcel['parcelName']))
89+
parcel_name = re.sub(r"-[a-z0-9]+\.parcel$", "", full_parcel_name)
8390
# the product name is before the first dash
84-
product = parcel_name[:parcel_name.index("-")]
85-
if product not in products:
91+
product = parcel_name[: parcel_name.index("-")]
92+
if product not in products and (
93+
os_distribution == parcel_os_distribution or os_distribution is None
94+
):
8695
# the version string is everything after the first dash
8796
version = parcel_name[parcel_name.index("-") + 1:]
8897
products[product] = version

roles/cloudera_manager/agent/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
# Note on the CM server this will perform an upgrade of the server if it hasn't already been upgraded
3838
- name: Install or Upgrade Cloudera Manager agent packages
3939
ansible.builtin.package:
40-
lock_timeout: 60
40+
lock_timeout: "{{ (ansible_os_family == 'RedHat') | ternary(60, omit) }}"
4141
name: cloudera-manager-agent
4242
update_cache: yes
4343
state: latest

roles/cloudera_manager/daemons/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
- name: Install Cloudera Manager daemons package
1818
ansible.builtin.package:
19-
lock_timeout: 180
19+
lock_timeout: "{{ (ansible_os_family == 'RedHat') | ternary(180, omit) }}"
2020
name: cloudera-manager-daemons
2121
update_cache: yes
2222
state: present

roles/cloudera_manager/database/tasks/embedded.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
- name: Install Cloudera Manager embedded database
1818
ansible.builtin.package:
19-
lock_timeout: 60
19+
lock_timeout: "{{ (ansible_os_family == 'RedHat') | ternary(60, omit) }}"
2020
name:
2121
- cloudera-manager-server-db-2
2222
state: present

roles/cloudera_manager/database/tasks/external.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
---
1616

17-
- name: Create Cloudera Manager database user
17+
- name: Create Cloudera Manager database user for Postgres
1818
postgresql_user:
1919
name: "{{ cloudera_manager_database_user }}"
2020
password: "{{ cloudera_manager_database_password }}"
@@ -39,7 +39,7 @@
3939
- cloudera_manager_database_type == 'postgresql'
4040
- cloudera_manager_database_host in groups.db_server | default([])
4141

42-
- name: Create Cloudera Manager database user
42+
- name: Create Cloudera Manager database user for MySQL
4343
mysql_user:
4444
name: "{{ cloudera_manager_database_user }}"
4545
password: "{{ cloudera_manager_database_password }}"
@@ -66,7 +66,7 @@
6666

6767
- name: Prepare Cloudera Manager Server external database
6868
command: |
69-
{{ cloudera_manager_database_prepare_script }} -f --host {{ cloudera_manager_database_host }} --port {{ cloudera_manager_database_port }}
69+
{{ cloudera_manager_database_prepare_script }} -f --host {{ cloudera_manager_database_host }} --port {{ cloudera_manager_database_port }}
7070
{{ cloudera_manager_database_type | regex_replace('mariadb', 'mysql') }}
7171
{{ cloudera_manager_database_name }}
7272
{{ cloudera_manager_database_user }}

roles/cloudera_manager/repo/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414

1515
---
1616
cloudera_archive_base_url: https://archive.cloudera.com
17-
cloudera_manager_version: 7.1.4
17+
cloudera_manager_version: 7.4.4
1818

1919
install_repo_on_host: yes

roles/cloudera_manager/repo/tasks/main-Debian.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818
set_fact:
1919
cloudera_manager_repo_url_with_creds: "{{ cloudera_manager_repo_url | regex_replace('^(?P<proto>http[s]?://)','\\g<proto>' + cloudera_manager_repo_username|string + ':' + cloudera_manager_repo_password|string + '@')}}"
2020
cloudera_manager_repo_key_with_creds: "{{ cloudera_manager_repo_key | regex_replace('^(?P<proto>http[s]?://)','\\g<proto>' + cloudera_manager_repo_username|string + ':' + cloudera_manager_repo_password|string + '@')}}"
21-
no_log: cloudera_manager_repo_username is defined
21+
no_log: yes
2222
when: cloudera_manager_repo_username is defined
2323

2424
- name: Add Cloudera Manager apt repository key
2525
apt_key:
2626
url: "{{ cloudera_manager_repo_key_with_creds | default(cloudera_manager_repo_key) }}"
2727
state: present
28-
no_log: cloudera_manager_repo_username is defined
28+
no_log: yes
2929

3030
- name: Add Cloudera Manager apt repository
3131
apt_repository:
3232
repo: "deb [arch=amd64] {{ cloudera_manager_repo_url_with_creds | default(cloudera_manager_repo_url) }} {{ cloudera_manager_repo_apt_codename }} {{ cloudera_manager_repo_apt_component }}"
3333
filename: cloudera-manager
34-
no_log: cloudera_manager_repo_username is defined
34+
no_log: yes
3535

roles/cloudera_manager/repo/tasks/main.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414

1515
---
1616

17-
- name: Include variables for not-Debian in cm6/7
17+
- name: Include variables
1818
include_vars:
1919
file: "{{ ansible_os_family }}.yml"
20-
when: ansible_os_family != "Debian"
2120

2221
- name: Correct repo URL for Redhat with cm5
2322
ansible.builtin.set_fact:
@@ -26,11 +25,6 @@
2625
- ansible_os_family != "Debian"
2726
- cloudera_manager_version.split('.')[0] == "5"
2827

29-
- name: Include variables
30-
include_vars:
31-
file: "{{ ansible_distribution }}{{ ansible_distribution_major_version }}.yml"
32-
when: ansible_os_family == "Debian"
33-
3428
- name: Define Cloudera Manager trial repository details
3529
set_fact:
3630
cloudera_manager_repo_url: "{{ __cloudera_manager_repo_url_trial }}"

roles/cloudera_manager/repo/vars/Ubuntu18.yml renamed to roles/cloudera_manager/repo/vars/Debian.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
---
1616
__cloudera_manager_major_version: "{{ cloudera_manager_version.split('.')[0] }}"
17-
__cloudera_manager_repo_url_trial: "{{ cloudera_archive_base_url }}/cm{{ __cloudera_manager_major_version }}/{{ cloudera_manager_version }}/ubuntu1804/apt"
18-
__cloudera_manager_repo_url_paywall: "{{ cloudera_archive_base_url }}/p/cm{{ __cloudera_manager_major_version }}/{{ cloudera_manager_version }}/ubuntu1804/apt"
17+
__cloudera_manager_repo_url_trial: "{{ cloudera_archive_base_url }}/cm{{ __cloudera_manager_major_version }}/{{ cloudera_manager_version }}/{{ ansible_distribution | lower }}{{ ansible_distribution_version | replace('.','') }}/apt"
18+
__cloudera_manager_repo_url_paywall: "{{ cloudera_archive_base_url }}/p/cm{{ __cloudera_manager_major_version }}/{{ cloudera_manager_version }}/{{ ansible_distribution | lower }}{{ ansible_distribution_version | replace('.','') }}/apt"
1919
__cloudera_manager_repo_key_filename: archive.key
2020
__cloudera_manager_repo_key_trial: "{{ __cloudera_manager_repo_url_trial }}/{{ __cloudera_manager_repo_key_filename }}"
2121
__cloudera_manager_repo_key_paywall: "{{ __cloudera_manager_repo_url_paywall }}/{{ __cloudera_manager_repo_key_filename }}"

0 commit comments

Comments
 (0)