Skip to content

Commit

Permalink
imporve clone examples
Browse files Browse the repository at this point in the history
  • Loading branch information
alaa-bish committed Oct 3, 2023
1 parent 923e9c7 commit 3b3a664
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 0 deletions.
102 changes: 102 additions & 0 deletions examples/ndb/create_clone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
- name: Create clone
hosts: localhost
gather_facts: false
collections:
- nutanix.ncp
module_defaults:
group/nutanix.ncp.ntnx:
nutanix_host: <ndb-era-ip>
nutanix_username: <username>
nutanix_password: <password>
validate_certs: false

tasks:

- name: create clone using snapshot
ntnx_ndb_database_clones:
name: "{{clone_db1}}"
desc: "ansible-created-clone"

db_params_profile:
name: "{{db_params_profile.name}}"

db_vm:
create_new_server:
name: "{{ vm1_name }}"
desc: "vm for db server"
password: "{{ vm_password }}"
cluster:
name: "{{cluster.cluster1.name}}"
network_profile:
name: "{{ network_profile.name }}"
compute_profile:
name: "{{ compute_profile.name }}"
pub_ssh_key: "{{ public_ssh_key }}"

postgres:
db_password: "{{vm_password}}"

time_machine:
name: "{{tm1}}"
snapshot_uuid: "{{snapshot_uuid}}"

removal_schedule:
days: 2
timezone: "Asia/Calcutta"
remind_before_in_days: 1
delete_database: True

refresh_schedule:
days: 2
time: "12:00:00"
timezone: "Asia/Calcutta"

register: output

- debug:
msg: "{{output}}"

- name: create clone using point in time
ntnx_ndb_database_clones:
name: "{{clone_db1}}"
desc: "ansible-created-clone"

db_params_profile:
name: "{{db_params_profile.name}}"

db_vm:
create_new_server:
name: "{{ vm1_name }}"
desc: "vm for db server"
password: "{{ vm_password }}"
cluster:
name: "{{cluster.cluster1.name}}"
network_profile:
name: "{{ network_profile.name }}"
compute_profile:
name: "{{ compute_profile.name }}"
pub_ssh_key: "{{ public_ssh_key }}"

postgres:
db_password: "{{vm_password}}"

time_machine:
name: "{{tm1}}"
pitr_timestamp: "2023-02-28 12:00:00"
timestamp: "Asia/Calcutta"

removal_schedule:
days: 2
timezone: "Asia/Calcutta"
remind_before_in_days: 1
delete_database: True

refresh_schedule:
days: 2
time: "12:00:00"
timezone: "Asia/Calcutta"
register: output

- debug:
msg: "{{output}}"
35 changes: 35 additions & 0 deletions examples/ndb/refresh_clone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
- name: Create Refresh clone
hosts: localhost
gather_facts: false
collections:
- nutanix.ncp
module_defaults:
group/nutanix.ncp.ntnx:
nutanix_host: <ndb-era-ip>
nutanix_username: <username>
nutanix_password: <password>
validate_certs: false

tasks:

- name: create spec for refresh clone to a pitr timestamp
check_mode: yes
ntnx_ndb_database_clone_refresh:
uuid: "{{clone_uuid}}"
pitr_timestamp: "2023-02-04 07:29:36"
timezone: "UTC"
register: output


- debug:
msg: "{{output}}"

- name: refresh db clone
ntnx_ndb_database_clone_refresh:
uuid: "{{clone_uuid}}"
snapshot_uuid: "{{snapshot_uuid}}"
register: output

- debug:
msg: "{{output}}"

0 comments on commit 3b3a664

Please sign in to comment.