Skip to content

Commit bd5cd56

Browse files
authored
Add Edge Flow Manager Database role (#294)
* Add prereq_efm_database role for Edge Flow Manager setup * Fix formatting in EFM database role tasks * Update README.md Signed-off-by: rsuplina <[email protected]>
1 parent 98e5653 commit bd5cd56

File tree

11 files changed

+848
-0
lines changed

11 files changed

+848
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# prereq_efm_database
2+
3+
Set up database and user accounts for Edge Flow Manager
4+
5+
This role automates the setup of a database and its associated user accounts specifically for Apache Edge Flow Manager services. The role creates the database and a dedicated user with ownership privileges, using sensible defaults that can be easily overridden.
6+
7+
The role will:
8+
- Connect to the specified database server using administrative credentials.
9+
- Create a new database with the name specified by `efm_database`.
10+
- Create a new database user specified by `efm_username` with the password from `efm_password`.
11+
- Grant ownership and all necessary privileges to the `efm_username` for the new database.
12+
- Ensure the database is configured correctly for efm operations.
13+
14+
# Requirements
15+
16+
- A running and accessible database server of the specified `database_type`.
17+
- The `database_admin_user` must have sufficient administrative privileges to create new databases and users.
18+
19+
# Dependencies
20+
21+
None.
22+
23+
# Parameters
24+
25+
| Variable | Type | Required | Default | Description |
26+
| --- | --- | --- | --- | --- |
27+
| `database_type` | `str` | `True` | | Specifies the type of database to connect to. |
28+
| `database_host` | `str` | `True` | | The hostname or IP address of the database server. |
29+
| `database_admin_user` | `str` | `True` | | The username with administrative privileges used to manage the database. |
30+
| `database_admin_password` | `str` | `True` | | The password for the database administrative user. This variable is marked with `no_log: true` and will not be displayed in Ansible logs. |
31+
| `efm_username` | `str` | `False` | `efm` | The username for the efm database user. This user will also be the owner of the database. |
32+
| `efm_password` | `str` | `False` | `efm` | The password for the efm database user. It is highly recommended to override this default in production. |
33+
| `efm_database` | `str` | `False` | `efm` | The name of the database to be created for efm. |
34+
35+
# Example Playbook
36+
37+
```yaml
38+
- hosts: localhost
39+
tasks:
40+
- name: Set up efm database and user on PostgreSQL
41+
ansible.builtin.import_role:
42+
name: cloudera.exe.prereq_efm_database
43+
vars:
44+
database_type: "postgresql"
45+
database_host: "db-server.example.com"
46+
database_admin_user: "postgres"
47+
database_admin_password: "my_postgres_admin_password"
48+
```
49+
50+
# License
51+
52+
```
53+
Copyright 2025 Cloudera, Inc.
54+
55+
Licensed under the Apache License, Version 2.0 (the "License");
56+
you may not use this file except in compliance with the License.
57+
You may obtain a copy of the License at
58+
59+
https://www.apache.org/licenses/LICENSE-2.0
60+
61+
Unless required by applicable law or agreed to in writing, software
62+
distributed under the License is distributed on an "AS IS" BASIS,
63+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64+
See the License for the specific language governing permissions and
65+
limitations under the License.
66+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
# Copyright 2025 Cloudera, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
database_type: "{{ undef(hint='Please defined the database type.') }}"
16+
database_host: "{{ undef(hint='Please defined the database server hostname or IP address.') }}"
17+
# database_port:
18+
19+
database_admin_user: "{{ undef(hint='Please defined the adminstrator username for the database server.') }}"
20+
database_admin_password: "{{ undef(hint='Please defined the adminstrator password for the database server.') }}"
21+
22+
efm_username: "{{ undef(hint='Please defined the efm database username.') }}"
23+
efm_password: "{{ undef(hint='Please defined the efm database password.') }}"
24+
efm_database: efm
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
# Copyright 2025 Cloudera, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
argument_specs:
17+
main:
18+
short_description: Set up database and user accounts for efm
19+
description:
20+
- Set up the Apache efm database and its associated user accounts, ensuring proper configuration for efm operations.
21+
- Default values are used for the username, password, and database name, but these can be overwritten by setting the `efm_username`, `efm_password`,
22+
and `efm_database` variables.
23+
author: Cloudera Labs
24+
version_added: "3.1.0"
25+
options:
26+
database_type:
27+
description: Specifies the type of database to connect to.
28+
type: str
29+
required: true
30+
choices:
31+
- postgresql
32+
database_host:
33+
description: The hostname or IP address of the database server to establish the connection.
34+
type: str
35+
required: true
36+
database_admin_user:
37+
description: The username with administrative privileges to manage the database.
38+
type: str
39+
required: true
40+
database_admin_password:
41+
description: The password for the database administrative user.
42+
type: str
43+
required: true
44+
efm_username:
45+
description: The username for the efm database user and owner of the database.
46+
type: str
47+
required: true
48+
efm_password:
49+
description: The password for the efm database user.
50+
type: str
51+
required: true
52+
efm_database:
53+
description: The name of the database to be created for efm.
54+
type: str
55+
required: false
56+
default: efm
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
# Copyright 2025 Cloudera, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
- name: Converge
17+
hosts: all
18+
gather_facts: false
19+
become: true
20+
tasks:
21+
- name: Create efm database and configure its associated user account.
22+
ansible.builtin.import_role:
23+
name: cloudera.exe.prereq_efm_database

0 commit comments

Comments
 (0)