Skip to content

Commit

Permalink
Migrate rdbms roles from cloudera.cluster (#181)
Browse files Browse the repository at this point in the history
* Migrate rdbms roles from cloudera.cluster collection
* Add functions for RHEL9
* Test RHEL8 & 9 - Mariadb 10.6, Postgresql 14, MySQL 8.0; still untested - RHEL7, Debian
* Remove MySQL 5.7 support
* Fixe MySQL 8 AppStream module Errors from cloudera-labs/cloudera.cluster#186
* Update dependencies to support RHEL9 (geerlingguy.postgres 3.5.0, geerlingguy.mysql [patched], community.crypto: 2.17.1, community.mysql: 3.8.0, community.postgresql: 3.3.0)
* Update ansible-builder requirements

Signed-off-by: Chuck Levesque <[email protected]>
  • Loading branch information
clevesque authored Jun 26, 2024
1 parent 3feb151 commit 91bd3c1
Show file tree
Hide file tree
Showing 39 changed files with 1,205 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ See the [requirements for `cloudera-labs/cloudera.cluster`](https://github.com/w

| Name | Type | Version |
|------|------|---------|
| `community.mysql` | collection | `3.1.0` |
| `community.postgresql` | collection | `1.6.1` |
| `community.mysql` | collection | `3.8.0` |
| `community.postgresql` | collection | `3.3.0` |
| `freeipa.ansible_freeipa` | collection | `1.11.1` |
| `geerlingguy.postgresql` | role | `2.2.0` |
| `geerlingguy.postgresql` | role | `3.3.0` |
| `geerlingguy.mysql` (patched) | role | `master` |

**Terraform**
Expand Down
7 changes: 7 additions & 0 deletions builder/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@
collections:
- source: .
type: dir

roles:
- name: geerlingguy.postgresql
version: 3.5.0

- src: https://github.com/clevesque/ansible-role-mysql
version: master
8 changes: 4 additions & 4 deletions playbooks/pvc_base_prereqs_ext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
gather_facts: no
become: yes
roles:
- role: cloudera.cluster.prereqs.mysql_connector
- role: cloudera.exe.rdbms.client.mysql_connector
when: database_type == 'mysql' or database_type == 'mariadb'
tags:
- mysql_connector
Expand All @@ -142,7 +142,7 @@
gather_facts: no
become: yes
roles:
- role: cloudera.cluster.prereqs.oracle_connector
- role: cloudera.exe.rdbms.client.oracle_connector
when: database_type == 'oracle'
tags:
- oracle_connector
Expand All @@ -153,7 +153,7 @@
gather_facts: no
become: yes
roles:
- role: cloudera.cluster.prereqs.postgresql_connector
- role: cloudera.exe.rdbms.client.postgresql_connector
when: database_type == 'postgresql'
tags:
- postgresql_connector
Expand Down Expand Up @@ -260,7 +260,7 @@
hosts: "{{ target | default('db_server') }}"
become: yes
roles:
- cloudera.cluster.infrastructure.rdbms
- cloudera.exe.rdbms.server
tags:
- database
- default_cluster
Expand Down
10 changes: 5 additions & 5 deletions requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

roles:
- name: geerlingguy.postgresql
version: 2.2.0
version: 3.5.0

- src: https://github.com/dbeech/ansible-role-mysql
- src: https://github.com/clevesque/ansible-role-mysql
version: master

collections:
Expand All @@ -43,11 +43,11 @@ collections:
- name: ansible.posix
version: 1.3.0
- name: community.crypto
version: 2.2.1
version: 2.17.1
- name: community.mysql
version: 3.1.0
version: 3.8.0
- name: community.postgresql
version: 1.6.1
version: 3.3.0
- name: freeipa.ansible_freeipa
version: 1.11.1
- name: cloud.terraform
Expand Down
22 changes: 22 additions & 0 deletions roles/rdbms/client/mysql_connector/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2023 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.

---

local_temp_dir: '/tmp'
mysql_connector_url: https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.49.zip
mysql_connector_checksum: md5:5ecd588e13f14de07faa5c67f5caf3f1
mysql_connector_download_dir: "{{ local_temp_dir }}"
mysql_connector_extract_dir: "{{ local_temp_dir }}"
mysql_connector_local_path: "{{ mysql_connector_extract_dir }}/mysql-connector-java-5.1.49/mysql-connector-java-5.1.49-bin.jar"
15 changes: 15 additions & 0 deletions roles/rdbms/client/mysql_connector/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2023 Cloudera, Inc. All Rights Reserved.
#
# 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.

---
60 changes: 60 additions & 0 deletions roles/rdbms/client/mysql_connector/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Copyright 2023 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.

---

- name: Download MySQL Connector/J
get_url:
url: "{{ mysql_connector_url }}"
dest: "{{ mysql_connector_download_dir }}/mysql-connector-java.zip"
checksum: "{{ mysql_connector_checksum }}"
mode: 0644
become: no
run_once: true
delegate_to: localhost

- name: Create /usr/share/java directory
file:
path: /usr/share/java
state: directory
mode: 0755

- name: Install unzip package
ansible.builtin.package:
lock_timeout: "{{ (ansible_os_family == 'RedHat') | ternary(60, omit) }}"
name: unzip
state: present

- name: Extract MySQL Connector/J zip file
unarchive:
src: "{{ mysql_connector_download_dir }}/mysql-connector-java.zip"
dest: "{{ mysql_connector_extract_dir }}"
exclude:
- src

- name: Copy MySQL Connector/J jar file to correct location
copy:
src: "{{ mysql_connector_local_path }}"
dest: /usr/share/java/mysql-connector-java.jar
remote_src: yes
mode: 0644

## Fix for RHEL8,9
- name: Install Mysql packages for python - PyMySQL
when:
- ansible_distribution == "RedHat"
- ansible_distribution_major_version >= "8"
shell: /usr/local/bin/pip install PyMySQL --force-reinstall --ignore-installed
ignore_errors: true

Loading

0 comments on commit 91bd3c1

Please sign in to comment.