From 3b3a6649c5cdabe6cec0bd36730e8bb1d44b0798 Mon Sep 17 00:00:00 2001 From: Alaa Bishtawi Date: Tue, 3 Oct 2023 15:25:45 +0300 Subject: [PATCH] imporve clone examples --- examples/ndb/create_clone.yml | 102 +++++++++++++++++++++++++++++++++ examples/ndb/refresh_clone.yml | 35 +++++++++++ 2 files changed, 137 insertions(+) create mode 100644 examples/ndb/create_clone.yml create mode 100644 examples/ndb/refresh_clone.yml diff --git a/examples/ndb/create_clone.yml b/examples/ndb/create_clone.yml new file mode 100644 index 000000000..80df45eb7 --- /dev/null +++ b/examples/ndb/create_clone.yml @@ -0,0 +1,102 @@ +--- +- name: Create clone + hosts: localhost + gather_facts: false + collections: + - nutanix.ncp + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_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}}" diff --git a/examples/ndb/refresh_clone.yml b/examples/ndb/refresh_clone.yml new file mode 100644 index 000000000..39f3936a8 --- /dev/null +++ b/examples/ndb/refresh_clone.yml @@ -0,0 +1,35 @@ +--- +- name: Create Refresh clone + hosts: localhost + gather_facts: false + collections: + - nutanix.ncp + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_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}}"