Skip to content

Commit 99fddc5

Browse files
Chaffelsonwmudge
authored andcommitted
Fixes for RHEL8.6 support and custom_repo with Cloudera Manager (cloudera-labs#83)
* Fix download and reuse of Cloudera Manager repo-as-tarball * Switch to using custom_repo as base url for archive.cloudera.com by default if custom_repo is specified in build without a specific base_url being supplied. * Fix kts setup for RHEL8+ where gpg 2.1+ is used which has changed the default file set - look for kbx files. * Setup of automatic DNS on the freeipa server now supports running on ec2 instances with RHEL8.6, and EL8 generally * Automatically set selinux to permissive on the krb5_server for RHEL8, as otherwise setup is blocked * Separate Py2 and Py3 setup on RHEL8 in preparation for final Py2 deprecation in Cloudera products * Set default admins group as configurable variable in freeipa config * Add option to ensure creation of a 'superuser' in FreeIPA as the default 'admin' user can clash with system users within CDP in some circumstances. This user is then useful to PvC-DS installs and not created by default otherwise. Signed-off-by: Daniel Chaffelson <[email protected]>
1 parent 9b49655 commit 99fddc5

File tree

12 files changed

+99
-26
lines changed

12 files changed

+99
-26
lines changed

roles/cloudera_manager/repo/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ cloudera_manager_distro_name: "{{ ansible_os_family | lower }}"
1919
cloudera_manager_distro_version: "{{ ansible_distribution_major_version }}"
2020

2121
install_repo_on_host: yes
22+
23+
set_custom_repo_as_archive_base_url: "{{ use_custom_repo_as_archive_base_url | default(True) }}"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
- name: yum-clean-metadata
2929
command: yum clean metadata
3030
args:
31-
warn: no
31+
warn: no

roles/cloudera_manager/repo/tasks/main.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
include_vars:
1919
file: "{{ ansible_os_family }}.yml"
2020

21+
- name: Use Custom Repo as Archive Base if using Custom Repo
22+
when:
23+
- set_custom_repo_as_archive_base_url | bool
24+
- '"custom_repo" in groups'
25+
ansible.builtin.set_fact:
26+
cloudera_archive_base_url: "http://{{ groups['custom_repo'] | first }}"
27+
2128
- name: Correct repo URL for Redhat with cm5
2229
ansible.builtin.set_fact:
2330
__cloudera_manager_repo_url_paywall: "{{ cloudera_archive_base_url | regex_replace('/?$','') }}/p/cm{{ __cloudera_manager_major_version }}/redhat/{{ ansible_distribution_major_version }}/x86_64/cm/{{ cloudera_manager_version }}"
@@ -45,4 +52,4 @@
4552
- name: Install Cloudera Manager repository
4653
when: install_repo_on_host
4754
include_tasks:
48-
file: "main-{{ ansible_os_family }}.yml"
55+
file: "main-{{ ansible_os_family }}.yml"

roles/deployment/services/kts_common/defaults/main.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ keytrustee_server_key_files:
2222
- gpg.conf
2323
- keytrustee.conf
2424
- logging.conf
25+
- trustdb.gpg
26+
27+
# GnuPG 2.1+ uses .kbx for keyring, and retired secring / random_seed
28+
keytrustee_server_gpg_files:
29+
- secring.gpg
2530
- pubring.gpg
2631
- pubring.gpg~
2732
- random_seed
28-
- secring.gpg
29-
- trustdb.gpg
33+
34+
keytrustee_server_kbx_files:
35+
- pubring.kbx
36+
- pubring.kbx~

roles/deployment/services/kts_high_availability/tasks/main.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,18 @@
3333
state: directory
3434
mode: 0777
3535

36+
# GnuPG 2.1+ uses .kbx for keyring, and retired secring / random_seed
37+
- name: Determine gnupg version
38+
delegate_to: "{{ groups.kts_active | first }}"
39+
register: __gnupg_version
40+
shell: "gpg2 --version | head -n 1 | rev | cut -d ' ' -f1 | rev"
41+
3642
- name: Fetch GPG keys and configs from active Key Trustee Server
3743
delegate_to: "{{ groups.kts_active | first }}"
3844
fetch:
3945
src: "{{ keytrustee_server_conf_dir }}/{{ item }}"
4046
dest: "{{ local_temp_dir }}/kts"
41-
loop: "{{ keytrustee_server_key_files }}"
47+
loop: "{{ keytrustee_server_key_files + (keytrustee_server_kbx_files if __gnupg_version.stdout is version('2.1', '>=') else keytrustee_server_gpg_files) }}"
4248

4349
- name: Copy to passive Key Trustee Server
4450
delegate_to: "{{ groups.kts_passive | first }}"

roles/infrastructure/custom_repo/defaults/main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ repo_tar_local_dir: repo
1919
repo_tar_files: "{{ definition.repo_tar_files | default([]) }}"
2020
keep_newer: yes
2121

22-
cm_repo_tarball_url: "{{ definition.cm_repo_tarball_url | default('') }}"
23-
custom_repo_rehost_files: "{{ definition.custom_repo_rehost_files | default([]) }}"
22+
custom_repo_rehost_files: "{{ definition.custom_repo_rehost_files | default([]) }}"

roles/infrastructure/custom_repo/tasks/rehost_files_from_download.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,3 @@
6565
src: "/var/www/html{{ __tmp_unpack_item | urlsplit('path') }}"
6666
dest: "/var/www/html{{ __tmp_unpack_item | urlsplit('path') | regex_replace('^(.+)repo.+-(.+)\\.tar\\.gz$', '\\1\\2' + '/yum/') }}"
6767
keep_newer: "{{ keep_newer }}"
68-
69-
- name: Set Cloudera Manager Base Repo if included in rehosting list
70-
when: "{{ custom_repo_rehost_files | select('search', 'tar.gz') | list | select('search', '/cm') | list }} | length > 0"
71-
ansible.builtin.set_fact:
72-
cloudera_archive_base_url: "http://{{ groups['custom_repo'] | first }}"
73-
delegate_to: "{{ __play_host }}"
74-
delegate_facts: true
75-
loop: "{{ groups.cloudera_manager + groups.cluster + groups.ecs_nodes }}"
76-
loop_control:
77-
loop_var: __play_host
78-
label: __play_host

roles/infrastructure/krb5_client/tasks/freeipa_autodns.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
# limitations under the License.
1414

1515
---
16-
- name: Configure autodns on FreeIPA for el7
16+
- name: Configure autodns on FreeIPA for el7 or el8
1717
when:
18-
- ansible_distribution_major_version | int == 7
18+
- ansible_distribution_major_version | int > 6
1919
- ansible_os_family == 'RedHat'
2020
block:
2121
- name: Gather facts from KRB5 Server
@@ -51,4 +51,23 @@
5151
dest: /etc/NetworkManager/conf.d/disable-resolve.conf-managing.conf
5252
backup: yes
5353

54-
# TODO: Implement and test for el8
54+
- name: Disable nm-cloud-setup if present
55+
when:
56+
- ansible_distribution_major_version | int > 7
57+
- ansible_os_family == 'RedHat'
58+
block:
59+
- name: Disable nm-cloud-setup if present
60+
ignore_errors: yes
61+
loop_control:
62+
loop_var: __nm_cloud_setup_disable_item
63+
loop:
64+
- systemctl disable nm-cloud-setup.service nm-cloud-setup.timer
65+
- systemctl stop nm-cloud-setup.service nm-cloud-setup.timer
66+
- ip rule del prio 30400
67+
- rm -rf /etc/systemd/system/nm-cloud-setup.service.d
68+
ansible.builtin.command: "{{ __nm_cloud_setup_disable_item }}"
69+
70+
- name: Ensure NetworkManager is running to maintain DHCP
71+
ansible.builtin.service:
72+
name: NetworkManager
73+
state: restarted

roles/infrastructure/krb5_common/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ ipadm_password: "{{ cloudera_manager_admin_password }}"
2828
ipa_admin_user: admin
2929
ipaadmin_password: "{{ cloudera_manager_admin_password }}"
3030

31+
ipa_admins_group: admins
32+
3133
ipa_ldap_dc_suffix: "{% for i in krb5_realm.split('.') %}dc={{ i | lower }}{% if not loop.last %},{% endif %}{% endfor %}"
3234
ipa_ldap_user_bind_dn: "uid=admin,cn=users,cn=accounts,{{ ipa_ldap_dc_suffix }}"
3335
ipa_ldap_user_bind_password: "{{ cloudera_manager_admin_password }}"

roles/infrastructure/krb5_server/tasks/freeipa.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
include_tasks:
1818
file: fix_freeipa_collection.yml
1919

20+
- name: Disable SELinux to allow FreeIPA server setup on Rhel8
21+
when:
22+
- ansible_distribution_major_version | int >= 8
23+
selinux:
24+
policy: targeted
25+
state: permissive
26+
ignore_errors: yes
27+
2028
- name: Setup FreeIPA Server
2129
ansible.builtin.include_role:
2230
name: freeipa.ansible_freeipa.ipaserver
@@ -28,8 +36,35 @@
2836
ipaserver_setup_dns: "{{ freeipa_autodns | default(omit) }}"
2937
ipaserver_auto_forwarders: "{{ freeipa_autodns | default(omit) }}"
3038

39+
- name: Ensure FreeIPA Superuser if required
40+
when:
41+
- freeipa_superuser is defined
42+
- freeipa_superuser | length > 0
43+
block:
44+
- name: Create Superuser if not present
45+
community.general.ipa_user:
46+
name: "{{ freeipa_superuser }}"
47+
givenname: "{{ freeipa_superuser_gn | default('Cloudera') }}"
48+
sn: "{{ freeipa_superuser_sn | default('Labs') }}"
49+
password: "{{ freeipa_superuser_pw | default(cloudera_manager_admin_password) }}"
50+
update_password: on_create
51+
ipa_host: "{{ groups.krb5_server | first }}"
52+
ipa_pass: "{{ ipaadmin_password }}"
53+
ipa_user: "{{ ipa_admin_user }}"
54+
55+
- name: Ensure Superuser is added to admins group
56+
community.general.ipa_group:
57+
name: "{{ ipa_admins_group }}"
58+
user:
59+
- "{{ freeipa_superuser }}"
60+
append: true
61+
ipa_host: "{{ groups.krb5_server | first }}"
62+
ipa_pass: "{{ ipaadmin_password }}"
63+
ipa_user: "{{ ipa_admin_user }}"
64+
3165
- name: Create FreeIPA DNS records for PVC ECS
3266
when:
67+
- pvc_type is defined and freeipa_autodns is defined
3368
- pvc_type == 'ECS' | default(false)
3469
- freeipa_autodns | default(false)
3570
block:
@@ -50,13 +85,15 @@
5085
community.general.ipa_dnszone:
5186
ipa_host: "{{ groups.krb5_server | first }}"
5287
ipa_pass: "{{ ipaadmin_password }}"
88+
ipa_user: "{{ ipa_admin_user }}"
5389
state: present
5490
zone_name: "apps.{{ krb5_realm | lower }}"
5591

5692
- name: Ensure wildcard record is prepared for PvC ECS
5793
community.general.ipa_dnsrecord:
5894
ipa_host: "{{ groups.krb5_server | first }}"
5995
ipa_pass: "{{ ipaadmin_password }}"
96+
ipa_user: "{{ ipa_admin_user }}"
6097
state: present
6198
zone_name: "{{ __dns_record_item }}"
6299
record_name: "*"

0 commit comments

Comments
 (0)