Skip to content

Commit

Permalink
Copy cloudera.exe.rdbms.server to cloudera.exe.rdbms_server
Browse files Browse the repository at this point in the history
Signed-off-by: Webster Mudge <[email protected]>
  • Loading branch information
wmudge committed Sep 9, 2024
1 parent 612df37 commit 5506850
Show file tree
Hide file tree
Showing 26 changed files with 779 additions and 0 deletions.
17 changes: 17 additions & 0 deletions roles/rdbms_server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--
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.
-->

# rdbms server
29 changes: 29 additions & 0 deletions roles/rdbms_server/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2024 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.

---

database_tls: false
database_type: postgresql
database_version: 14

skip_rdbms_repo_setup: false

# MYSQL
mysql_require_secure_transport: "OFF" # If TLS-enabled, honor or not

base_dir_security_pki: "/opt/cloudera/security/pki"
tls_chain_path: "{{ base_dir_security_pki }}/chain.pem"
tls_cert_path_generic: "{{ base_dir_security_pki }}/host.pem"
tls_key_path_plaintext_generic: "{{ base_dir_security_pki }}/host.key.unenc"
18 changes: 18 additions & 0 deletions roles/rdbms_server/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 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.

---

- name: yum clean metadata
ansible.builtin.command: yum clean metadata
75 changes: 75 additions & 0 deletions roles/rdbms_server/meta/argument_specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# 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.

---

argument_specs:
main:
short_description: Install standalone RDBMS instance
description:
- Install and configure a standalone RDBMS instance for use with Cloudera Manager.
- Database options include PostgreSQL, MySQL, and MariaDB.
- Supports TLS connections.
options:
database_tls:
description: Flag to enable TLS configuration.
type: bool
default: false
database_type:
description: Database product to install.
type: str
required: false
default: postgresql
choices:
- postgresql
- mysql
- mariadb
database_version:
description: Database product version to install.
type: str
required: false
default: 14
skip_rdbms_repo_setup:
description: Flag to enable RDBMS repository set up on target host.
type: bool
required: false
default: false
mysql_require_secure_transport:
description: Value for the C(require_secure_transport) parameter in the C([mysqld]) configuration. (MySQL only)
type: str
required: false
default: "OFF"
base_dir_security_pki:
description:
- Directory on target host housing typical PKI files.
- Used to establish a base directory for the other TLS options.
type: path
required: false
default: "/opt/cloudera/security/pki"
tls_chain_path:
description: File on the target host consisting of an ordered list of certificates, including TLS certificates and Certificate Authority (CA) certificates.
type: path
required: false
default: "C(base_dir_security_pki)/chain.pem"
tls_cert_path_generic:
description: File on the target host consisting of the TLS certificate for the server.
type: path
required: false
default: "C(base_dir_security_pki)/host.pem"
tls_key_path_plaintext_generic:
description: File on the target host consisting of the unencrypted TLS private key for the server.
type: path
required: false
default: "C(base_dir_security_pki)/host.key.unenc"

22 changes: 22 additions & 0 deletions roles/rdbms_server/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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.

---

galaxy_info:
description: >
Set up single database to support Cloudera Data Platform (CDP) Private Cloud
deployments.
company: Cloudera
license: Apache-2.0
33 changes: 33 additions & 0 deletions roles/rdbms_server/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2024 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.

---

- name: Include database type variables
ansible.builtin.include_vars:
file: "{{ database_type }}/common.yml"

- name: Include database type and OS specific variables
ansible.builtin.include_vars:
file: "{{ item }}"
with_first_found:
- "{{ database_type }}/{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
- "{{ database_type }}/{{ ansible_os_family }}.yml"

- name: Install database
ansible.builtin.include_tasks:
file: "{{ item }}"
with_first_found:
- "{{ database_type }}/{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
- "{{ database_type }}/{{ ansible_os_family }}.yml"
29 changes: 29 additions & 0 deletions roles/rdbms_server/tasks/mariadb/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2024 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.

- name: Install MariaDB apt key
ansible.builtin.apt_key:
url: https://mariadb.org/mariadb_release_signing_key.asc
state: present
when: not skip_rdbms_repo_setup

- name: Install MariaDB apt repository
ansible.builtin.apt_repository:
repo: deb [arch=amd64,arm64,ppc64el] https://downloads.mariadb.com/MariaDB/mariadb-{{ database_version }}/repo/ubuntu/ bionic main
state: present
when: not skip_rdbms_repo_setup

- name: Install MariaDB
ansible.builtin.include_role:
name: ansible-role-mysql
31 changes: 31 additions & 0 deletions roles/rdbms_server/tasks/mariadb/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2024 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.

- name: Install MariaDB repository
ansible.builtin.yum_repository:
name: MariaDB
description: MariaDB {{ database_version }} repository for RHEL
baseurl: https://yum.mariadb.org/{{ database_version }}/rhel{{ ansible_distribution_major_version }}-amd64
gpgkey: https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
when: not skip_rdbms_repo_setup

- name: Disable modularity appstream, when RHEL 8
ansible.builtin.command: yum -y module disable mysql mariadb
when:
- not skip_rdbms_repo_setup
- ansible_distribution_major_version == "8"

- name: Install Mariadb
ansible.builtin.include_role:
name: ansible-role-mysql
37 changes: 37 additions & 0 deletions roles/rdbms_server/tasks/mysql/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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.

- name: Import MySQL repository GPG Key
ansible.builtin.rpm_key:
key: "{{ mysql_repo_key }}"
state: present
when: not skip_rdbms_repo_setup

- name: Install MySQL repository
ansible.builtin.yum:
name: "{{ mysql_repo }}"
update_cache: true
lock_timeout: 180
state: present
when: not skip_rdbms_repo_setup

- name: Disable modularity appstream, when RHEL 8
ansible.builtin.command: yum -y module disable mysql mariadb
when:
- not skip_rdbms_repo_setup
- ansible_distribution_major_version == "8"

- name: Install MySQL
ansible.builtin.include_role:
name: ansible-role-mysql
43 changes: 43 additions & 0 deletions roles/rdbms_server/tasks/postgresql/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2024 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.

- name: Install keyrings directory
ansible.builtin.file:
path: /etc/apt/keyrings
state: directory

- name: Install PostgreSQL repository key
ansible.builtin.get_url:
url: https://www.postgresql.org/media/keys/ACCC4CF8.asc
dest: /etc/apt/keyrings/postgresql.asc
when: not skip_rdbms_repo_setup

- name: Install PostgreSQL repository
ansible.builtin.apt_repository:
repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/postgresql.asc] https://apt.postgresql.org/pub/repos/apt {{ ansible_distribution_release }}-pgdg main"
state: present
when: not skip_rdbms_repo_setup

- name: Install PostgreSQL
ansible.builtin.include_role:
name: geerlingguy.postgresql

- name: Install python-psycopg2
ansible.builtin.pip:
name: psycopg2-binary
state: latest

- name: Fix UTF-8 template
ansible.builtin.include_tasks:
file: template_fix.yml
Loading

0 comments on commit 5506850

Please sign in to comment.