Skip to content

Commit 99780cd

Browse files
bhati-pradeepGevorg-Khachatryan-97alaa-bish
authored
New Modules for NDB features for 1.8.0-beta.1 release (#292)
* era basic spec design * database CRUD code * Handling new fields for era connection and fixing crud flows * Test automation for database instance crud * Minor fix * Feat/era info (#290) Info modules for NDB features Co-authored-by: alaa-bish <alaa.bishtawi@nutanix.com> Co-authored-by: Pradeepsingh Bhati <pradeep.bhati@nutanix.com> Co-authored-by: Gevorg-Khachatryaan <Gevorg1050.1> * Add option for version ID in software profile * Add info tests for database in crud tests * Minro update * Handling error cases * 1. Doc fixes. 2. Let entity class handle failed api errors then client code * Add example in docs * Doc fixes * Add examples * supress output for ndb tests * Minor doc update * fixing tests * Minor test fix * use nutanix_* based creds terms for ndb as well * Minor doc fix * formatting * Minor fix * ADD return Delete vms in between tests to free up space fix fix fix Doc fixes * Doc updates * Example for postgress database creation * read me changes * Docs and examples * minor fixes * Add soft delete example * Release docs update * Minor change log update Co-authored-by: Gevorg Khachatryan <95351366+Gevorg-Khachatryan-97@users.noreply.github.com> Co-authored-by: alaa-bish <alaa.bishtawi@nutanix.com>
1 parent 8566a90 commit 99780cd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+5407
-26
lines changed

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
## v1.8.0-beta.1 (20 Oct 2022)
2+
3+
**Features**
4+
5+
**Nutanix Database Service (Era)**
6+
- Ansible module for Single Instance Databases
7+
- Ansible info module for Database Instances
8+
- Ansible info module for NDB Clusters
9+
- Ansible info module for DB server VMs
10+
- Ansible info module for Profiles
11+
- Ansible info module for SLAs
12+
- Ansible info module for Time Machines
13+
- Ansible info module for Database Clones
14+
15+
**Full Changelog:** [here](https://github.com/nutanix/nutanix.ansible/compare/v1.7.0...v1.8.0-beta.1)
16+
117
## v1.7.0 (30 Sep 2022)
218

319
**Feature:**

CHANGELOG.rst

+15
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ Nutanix.Ncp Release Notes
55
.. contents:: Topics
66

77

8+
v1.8.0-beta.1
9+
=============
10+
11+
New Modules
12+
-----------
13+
14+
- ntnx_ndb_clones_info - info module for database clones
15+
- ntnx_ndb_clusters_info - info module for ndb clusters info
16+
- ntnx_ndb_databases - Module for create, update and delete of single instance database. Currently, postgres type database is officially supported.
17+
- ntnx_ndb_databases_info - info module for ndb database instances
18+
- ntnx_ndb_db_servers_info - info module for ndb db server vms info
19+
- ntnx_ndb_profiles_info - info module for ndb profiles
20+
- ntnx_ndb_slas_info - info module for ndb slas
21+
- ntnx_ndb_time_machines_info - info module for ndb time machines
22+
823
v1.7.0
924
======
1025

README.md

+23-13
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,14 @@ This collection requires Python 2.7 or greater
3333
3434
> For the 1.7.0 release of the ansible plugin it will have N-2 compatibility with the Prism Central APIs. This release was tested against Prism Central versions pc.2022.6, pc.2022.4 and pc2022.1.0.2.
3535
36+
> For the 1.8.0-beta.1 release of the ansible plugin it will have N compatibility with the Prism Central APIs. This release was tested against Prism Central version pc.2022.6 .
3637
### Notes:
3738
1. Static routes module (ntnx_static_routes) is supported for PC versions >= pc.2022.1
3839

3940
2. Adding cluster references in projects module (ntnx_projects) is supported for PC versions >= pc.2022.1
4041

4142
3. For Users and User Groups modules (ntnx_users and ntnx_user_groups), adding Identity Provider (IdP) & Organizational Unit (OU) based users/groups are supported for PC versions >= pc.2022.1
4243

43-
#### v1.7.0 additions:
44-
1. Added functionality to add cluster reference while using vlan subnet name in vms to pull subnet info from particular cluster. Checkout vm.yml example for same.
45-
46-
2. Added functionality to configure role mappings, collaboration, new user/user groups, vpcs and accounts in ntnx_projects. Checkout projects_with_role_mapping.yml example for same.
47-
48-
3. Added constructed inventory feature to inventory module to construct custom vars and groups based on existing inventory.
49-
50-
4. Now inventory module can fetch 500+ entities.
51-
5244
Prism Central based examples: https://github.com/nutanix/nutanix.ansible/tree/main/examples/
5345

5446
## Foundation
@@ -66,6 +58,16 @@ Foundation Central based examples : https://github.com/nutanix/nutanix.ansible/t
6658
6759
Karbon based examples : https://github.com/nutanix/nutanix.ansible/tree/main/examples/karbon
6860

61+
## Nutanix Database Service (ERA)
62+
> For the 1.8.0-beta.1 release of the ansible plugin, it will have N-1 compatibility with the Nutanix Database Service (ERA). This release was tested against era versions v2.4.1 and v2.4.0
63+
64+
NDB based examples : https://github.com/nutanix/nutanix.ansible/tree/main/examples/ndb
65+
66+
Nutanix Ansible support for Nutanix Database Service is currently at beta stage.
67+
68+
### Notes:
69+
1. Currently for ntnx_ndb_databases, creation of only postgres type database instance is tested and offically supported.
70+
6971
# Installing the collection
7072
**Prerequisite**
7173

@@ -150,6 +152,14 @@ ansible-playbook examples/iaas/iaas.yml
150152
| ntnx_karbon_clusters_info | Get clusters info. |
151153
| ntnx_karbon_registries | Create, Delete a karbon private registry entry |
152154
| ntnx_karbon_registries_info | Get karbon private registry registry info. |
155+
| ntnx_ndb_databases | Create, Update and Delete single instance database. |
156+
| ntnx_ndb_databases_info | Get database info. |
157+
| ntnx_ndb_db_servers_info | Get db servers vm info. |
158+
| ntnx_ndb_clusters_info | Get clusters info. |
159+
| ntnx_ndb_slas_info | Get slas info |
160+
| ntnx_ndb_profiles_info | Get profiles info. |
161+
| ntnx_ndb_time_machines_info | Get time machines info. |
162+
| ntnx_ndb_clones_info | Get database clones info. |
153163
| ntnx_pbrs | Create or delete a PBR. |
154164
| ntnx_pbrs_info | List existing PBRs. |
155165
| ntnx_permissions_info | List permissions info |
@@ -171,6 +181,10 @@ ansible-playbook examples/iaas/iaas.yml
171181
| ntnx_static_routes_info | List existing static routes of a vpc. |
172182
| ntnx_subnets | Create or delete a Subnet. |
173183
| ntnx_subnets_info | List existing Subnets. |
184+
| ntnx_user_groups | Create, Delete user_groups |
185+
| ntnx_user_groups_info | Get user groups info. |
186+
| ntnx_users | Create, Delete users |
187+
| ntnx_users_info | Get users info. |
174188
| ntnx_vms | Create or delete a VM. |
175189
| ntnx_vms_clone | Clone VM. |
176190
| ntnx_vms_ova | Create OVA image from VM. |
@@ -189,10 +203,6 @@ ansible-playbook examples/iaas/iaas.yml
189203
| ntnx_foundation_central_api_keys_info | List all the api keys created in Foundation Central. |
190204
| ntnx_foundation_central_imaged_clusters_info | List all the clusters created using Foundation Central. |
191205
| ntnx_foundation_central_imaged_nodes_info | List all the nodes registered with Foundation Central. |
192-
| ntnx_user_groups | Create, Delete user_groups |
193-
| ntnx_user_groups_info | Get user groups info. |
194-
| ntnx_users | Create, Delete users |
195-
| ntnx_users_info | Get users info. |
196206

197207
## Inventory Plugins
198208

changelogs/changelog.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -282,3 +282,31 @@ releases:
282282
- nutanix.ncp.ntnx_prism_vm_inventory - [Imprv] add functionality constructed
283283
to module inventory [\#235](https://github.com/nutanix/nutanix.ansible/issues/235)
284284
release_date: '2022-09-30'
285+
1.8.0-beta.1:
286+
modules:
287+
- description: info module for database clones
288+
name: ntnx_ndb_clones_info
289+
namespace: ''
290+
- description: info module for ndb clusters info
291+
name: ntnx_ndb_clusters_info
292+
namespace: ''
293+
- description: Module for create, update and delete of single instance database.
294+
Currently, postgres type database is officially supported.
295+
name: ntnx_ndb_databases
296+
namespace: ''
297+
- description: info module for ndb database instances
298+
name: ntnx_ndb_databases_info
299+
namespace: ''
300+
- description: info module for ndb db server vms info
301+
name: ntnx_ndb_db_servers_info
302+
namespace: ''
303+
- description: info module for ndb profiles
304+
name: ntnx_ndb_profiles_info
305+
namespace: ''
306+
- description: info module for ndb slas
307+
name: ntnx_ndb_slas_info
308+
namespace: ''
309+
- description: info module for ndb time machines
310+
name: ntnx_ndb_time_machines_info
311+
namespace: ''
312+
release_date: '2022-10-20'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
- name: Single instance postgres database creation on registered db server
3+
hosts: localhost
4+
gather_facts: false
5+
collections:
6+
- nutanix.ncp
7+
module_defaults:
8+
group/nutanix.ncp.ntnx:
9+
nutanix_host: <ndb-era-server-ip>
10+
nutanix_username: <username>
11+
nutanix_password: <password>
12+
validate_certs: false
13+
14+
tasks:
15+
16+
- name: Create single instance postgres database on registered db server vm
17+
ntnx_ndb_databases:
18+
19+
name: POSTGRES_DATABASE_ANSIBLE
20+
21+
db_params_profile:
22+
name: DEFAULT_POSTGRES_PARAMS
23+
24+
db_vm:
25+
use_registered_server:
26+
name: otiakmxh
27+
28+
postgres:
29+
listener_port: "5432"
30+
db_name: prad
31+
db_password: db_password
32+
db_size: 200
33+
34+
time_machine:
35+
name: POSTGRES_DATABASE_ANSIBLE_TM
36+
sla:
37+
name: DEFAULT_OOB_GOLD_SLA
38+
schedule:
39+
daily: "11:00:00"
40+
weekly: WEDNESDAY
41+
monthly: 4
42+
quaterly: JANUARY
43+
yearly: FEBRUARY
44+
log_catchup: 30
45+
snapshots_per_day: 2
46+
47+
register: output
48+
49+
- debug:
50+
msg: "{{output}}"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
- name: Single instance postgres database creation with new db server VM
3+
hosts: localhost
4+
gather_facts: false
5+
collections:
6+
- nutanix.ncp
7+
module_defaults:
8+
group/nutanix.ncp.ntnx:
9+
nutanix_host: <ndb-era-server-ip>
10+
nutanix_username: <username>
11+
nutanix_password: <password>
12+
validate_certs: false
13+
14+
tasks:
15+
16+
- name: Create single instance postgres database
17+
ntnx_ndb_databases:
18+
19+
name: POSTGRES_DATABASE_ANSIBLE
20+
21+
db_params_profile:
22+
name: DEFAULT_POSTGRES_PARAMS
23+
24+
db_vm:
25+
create_new_server:
26+
name: postgres_server_ansible
27+
password: temp_password
28+
cluster:
29+
name: EraCluster
30+
software_profile:
31+
name: POSTGRES_10.4_OOB
32+
network_profile:
33+
name: DEFAULT_OOB_POSTGRESQL_NETWORK
34+
compute_profile:
35+
name: DEFAULT_OOB_SMALL_COMPUTE
36+
pub_ssh_key: "<publickey-for-vm-access>"
37+
38+
postgres:
39+
listener_port: "5432"
40+
db_name: prad
41+
db_password: db_password
42+
db_size: 200
43+
44+
time_machine:
45+
name: POSTGRES_DATABASE_ANSIBLE_TM
46+
sla:
47+
name: DEFAULT_OOB_GOLD_SLA
48+
schedule:
49+
daily: "11:00:00"
50+
weekly: WEDNESDAY
51+
monthly: 4
52+
quaterly: JANUARY
53+
yearly: FEBRUARY
54+
log_catchup: 30
55+
snapshots_per_day: 2
56+
57+
register: output
58+
59+
- debug:
60+
msg: "{{output}}"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
- name: Soft delete single instance database and time machine associated
3+
hosts: localhost
4+
gather_facts: false
5+
collections:
6+
- nutanix.ncp
7+
module_defaults:
8+
group/nutanix.ncp.ntnx:
9+
nutanix_host: <ndb-era-ip>
10+
nutanix_username: <username>
11+
nutanix_password: <password>
12+
validate_certs: false
13+
14+
tasks:
15+
16+
- name: Soft delete single instance database and time machine associated
17+
ntnx_ndb_databases:
18+
state: "absent"
19+
db_uuid: c0a4433a-49f2-40f3-ae52-d88788d2824b
20+
soft_delete: true
21+
delete_time_machine: true
22+
register: output
23+
24+
- debug:
25+
msg: "{{output}}"

galaxy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace: "nutanix"
22
name: "ncp"
3-
version: "1.7.0"
3+
version: "1.8.0-beta.1"
44
readme: "README.md"
55
authors:
66
- "Abhishek Chaudhary (@abhimutant)"

meta/runtime.yml

+8
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,11 @@ action_groups:
6363
- ntnx_karbon_clusters_info
6464
- ntnx_karbon_registries
6565
- ntnx_karbon_registries_info
66+
- ntnx_ndb_databases_info
67+
- ntnx_ndb_clones_info
68+
- ntnx_ndb_time_machines_info
69+
- ntnx_ndb_profiles_info
70+
- ntnx_ndb_db_servers_info
71+
- ntnx_ndb_slas_info
72+
- ntnx_ndb_databases
73+
- ntnx_ndb_clusters_info
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Copyright: (c) 2017, Ansible Project
4+
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5+
6+
from __future__ import absolute_import, division, print_function
7+
8+
__metaclass__ = type
9+
10+
11+
class ModuleDocFragment(object):
12+
13+
# Plugin options for ntnx ndb
14+
DOCUMENTATION = r"""
15+
options:
16+
nutanix_host:
17+
description:
18+
- ndb era server IP address
19+
- C(nutanix_host). If not set then the value of the C(NUTANIX_HOST), environment variable is used.
20+
type: str
21+
required: true
22+
nutanix_password:
23+
description:
24+
- ndb era server password
25+
- C(nutanix_password). If not set then the value of the C(NUTANIX_PASSWORD), environment variable is used.
26+
type: str
27+
required: true
28+
nutanix_username:
29+
description:
30+
- ndb era server username
31+
- C(nutanix_username). If not set then the value of the C(NUTANIX_USERNAME), environment variable is used.
32+
type: str
33+
required: true
34+
validate_certs:
35+
description:
36+
- Set value to C(False) to skip validation for self signed certificates
37+
- This is not recommended for production setup
38+
- C(validate_certs). If not set then the value of the C(VALIDATE_CERTS), environment variable is used.
39+
type: bool
40+
default: true
41+
"""

plugins/module_utils/constants.py

+12
Original file line numberDiff line numberDiff line change
@@ -277,3 +277,15 @@ class EntityFilterExpressionList:
277277
"right_hand_side": {"collection": "SELF_OWNED"},
278278
},
279279
}
280+
281+
282+
class NDB:
283+
284+
OPERATIONS_POLLING_DELAY = 30
285+
286+
class DatabaseTypes:
287+
POSTGRES = "postgres_database"
288+
289+
class StatusCodes:
290+
SUCCESS = "5"
291+
FAILURE = "4"

0 commit comments

Comments
 (0)