From d4996f93bb4750eb51c8e50ea186a0feb49ee666 Mon Sep 17 00:00:00 2001 From: George Ghawali Date: Sun, 15 Dec 2024 16:16:43 +0200 Subject: [PATCH 1/4] Adding Blog for V4 modules --- .../volume_groups_disks_v2.yml | 57 ++++ .../volume_groups_iscsi_clients_v2.yml | 47 ++++ .../Volume_groups_v2/volume_groups_v2.yml | 60 +++++ .../Volume_groups_v2/volume_groups_vms_v2.yml | 35 +++ examples/categories_v2/categories_v2.yml | 61 +++++ .../clusters_and_hosts_v2.yml | 243 ++++++++++++++++++ .../clusters_nodes_v2.yml | 225 ++++++++++++++++ examples/iam_v2/authorization_policies_v2.yml | 106 ++++++++ examples/iam_v2/directory_services_v2.yml | 91 +++++++ examples/iam_v2/operations_v2.yml | 30 +++ examples/iam_v2/roles_v2.yml | 69 +++++ examples/iam_v2/saml_identity_provider_v2.yml | 69 +++++ examples/iam_v2/user_groups_v2.yml | 58 +++++ examples/iam_v2/users_v2.yml | 103 ++++++++ examples/networks_v2/address_groups_v2.yml | 65 +++++ examples/networks_v2/floating_ip_v2.yml | 72 ++++++ examples/networks_v2/pbrs_v2.yml | 78 ++++++ examples/networks_v2/routes_v2.yml | 83 ++++++ examples/networks_v2/security_rules_v2.yml | 167 ++++++++++++ examples/networks_v2/service_groups_v2.yml | 77 ++++++ examples/networks_v2/subnets_v2 .yml | 106 ++++++++ examples/networks_v2/vpcs_v2.yml | 53 ++++ .../storage_container_v2.yml | 114 ++++++++ examples/vmm_v2/vms_categories_v2.yml | 38 +++ examples/vmm_v2/vms_cd_rom_v2.yml | 81 ++++++ examples/vmm_v2/vms_clone_v2 .yml | 36 +++ examples/vmm_v2/vms_disks_v2.yml | 144 +++++++++++ examples/vmm_v2/vms_ngt_v2.yml | 81 ++++++ examples/vmm_v2/vms_nics_v2.yml | 94 +++++++ examples/vmm_v2/vms_serial_ports_v2.yml | 55 ++++ .../vms_stage_guest_customization_v2.yml | 28 ++ examples/vmm_v2/vms_templates_v2.yml | 121 +++++++++ examples/vmm_v2/vms_v2.yml | 96 +++++++ 33 files changed, 2843 insertions(+) create mode 100644 examples/Volume_groups_v2/volume_groups_disks_v2.yml create mode 100644 examples/Volume_groups_v2/volume_groups_iscsi_clients_v2.yml create mode 100644 examples/Volume_groups_v2/volume_groups_v2.yml create mode 100644 examples/Volume_groups_v2/volume_groups_vms_v2.yml create mode 100644 examples/categories_v2/categories_v2.yml create mode 100644 examples/cluster_management_v2/clusters_and_hosts_v2.yml create mode 100644 examples/cluster_management_v2/clusters_nodes_v2.yml create mode 100644 examples/iam_v2/authorization_policies_v2.yml create mode 100644 examples/iam_v2/directory_services_v2.yml create mode 100644 examples/iam_v2/operations_v2.yml create mode 100644 examples/iam_v2/roles_v2.yml create mode 100644 examples/iam_v2/saml_identity_provider_v2.yml create mode 100644 examples/iam_v2/user_groups_v2.yml create mode 100644 examples/iam_v2/users_v2.yml create mode 100644 examples/networks_v2/address_groups_v2.yml create mode 100644 examples/networks_v2/floating_ip_v2.yml create mode 100644 examples/networks_v2/pbrs_v2.yml create mode 100644 examples/networks_v2/routes_v2.yml create mode 100644 examples/networks_v2/security_rules_v2.yml create mode 100644 examples/networks_v2/service_groups_v2.yml create mode 100644 examples/networks_v2/subnets_v2 .yml create mode 100644 examples/networks_v2/vpcs_v2.yml create mode 100644 examples/storage_container_v2/storage_container_v2.yml create mode 100644 examples/vmm_v2/vms_categories_v2.yml create mode 100644 examples/vmm_v2/vms_cd_rom_v2.yml create mode 100644 examples/vmm_v2/vms_clone_v2 .yml create mode 100644 examples/vmm_v2/vms_disks_v2.yml create mode 100644 examples/vmm_v2/vms_ngt_v2.yml create mode 100644 examples/vmm_v2/vms_nics_v2.yml create mode 100644 examples/vmm_v2/vms_serial_ports_v2.yml create mode 100644 examples/vmm_v2/vms_stage_guest_customization_v2.yml create mode 100644 examples/vmm_v2/vms_templates_v2.yml create mode 100644 examples/vmm_v2/vms_v2.yml diff --git a/examples/Volume_groups_v2/volume_groups_disks_v2.yml b/examples/Volume_groups_v2/volume_groups_disks_v2.yml new file mode 100644 index 00000000..53ed2a4c --- /dev/null +++ b/examples/Volume_groups_v2/volume_groups_disks_v2.yml @@ -0,0 +1,57 @@ +--- +# Summary: +# This playbook will do: +# 1. Create disks +# 2. Create disk from previously created vdisk +# 3. Delete disk + +- name: Volume groups disks playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + vg1_uuid: "d1b1b3b1-1b1b-1b1b-1b1b-1b1b1b1b1b1b1" + disk1_uuid: "12345678-1b1b-1b1b-1b1b-1b1b1b1b1b1b1" + storage_container: + name: "default" + uuid: "00000000-0000-0000-0000-000000000000" + + - name: Create disks + ntnx_volume_groups_disks_v2: + state: "present" + volume_group_ext_id: "{{ vg1_uuid }}" + disk_size_bytes: 21474836480 + disk_data_source_reference: + entity_type: "STORAGE_CONTAINER" + ext_id: "{{ storage_container.uuid }}" + register: result + ignore_errors: true + + - name: Create disk from previously created vdisk + ntnx_volume_groups_disks_v2: + state: "present" + volume_group_ext_id: "{{ vg1_uuid }}" + index: 2 + description: "ansible-created-disk-updated" + disk_storage_features: + flash_mode: + is_enabled: true + disk_data_source_reference: + entity_type: "VOLUME_DISK" + ext_id: "{{disk1_uuid}}" + register: result + ignore_errors: true + + - name: Delete disk + ntnx_volume_groups_disks_v2: + state: absent + volume_group_ext_id: "{{ vg1_uuid }}" + ext_id: "{{ result.ext_id }}" + register: result diff --git a/examples/Volume_groups_v2/volume_groups_iscsi_clients_v2.yml b/examples/Volume_groups_v2/volume_groups_iscsi_clients_v2.yml new file mode 100644 index 00000000..89413073 --- /dev/null +++ b/examples/Volume_groups_v2/volume_groups_iscsi_clients_v2.yml @@ -0,0 +1,47 @@ +--- +# Summary: +# This playbook will do: +# 1. Attach iscsi client to VG using initiator name +# 2. List all clients attached to VG +# 3. Fetch specific client +# 4. Detach client from VG + +- name: Volume groups iscsi clients playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + vg1_uuid: "d1b1b3b1-1b1b-1b1b-1b1b-1b1b1b1b1b1b1" + iscsi_client_name: "test-iscsi-client" + iscsi_client_uuid: "12345678-1b1b-1b1b-1b1b-1b1b1b1b1b1b1" + + - name: Attach iscsi client to VG using initiator name + ntnx_volume_groups_iscsi_clients_v2: + volume_group_ext_id: "{{ vg1_uuid }}" + iscsi_initiator_name: "{{ iscsi_client_name }}" + num_virtual_targets: 32 + register: result + + - name: List all clients attached to VG + ntnx_volume_groups_iscsi_clients_info_v2: + volume_group_ext_id: "{{ vg1_uuid }}" + register: result + + - name: Fetch specific client + ntnx_volume_groups_iscsi_clients_info_v2: + ext_id: "{{ iscsi_client_uuid }}" + register: result + + - name: Detach client from VG + ntnx_volume_groups_iscsi_clients_v2: + volume_group_ext_id: "{{ vg1_uuid }}" + ext_id: "{{ iscsi_client_uuid }}" + state: absent + register: result diff --git a/examples/Volume_groups_v2/volume_groups_v2.yml b/examples/Volume_groups_v2/volume_groups_v2.yml new file mode 100644 index 00000000..3a8a2cfa --- /dev/null +++ b/examples/Volume_groups_v2/volume_groups_v2.yml @@ -0,0 +1,60 @@ +--- +# Summary: +# This playbook will do: +# 1. Create Volume group +# 2. Fetch above created VG +# 3. Fetch all VGs using filters +# 4. Delete Volume group + +- name: Volume groups playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + name: "vg1" + cluster_reference: "00057b8b-1b1b-1b1b-1b1b-1b1b1b1b1b1b1" + vg1_uuid: "d1b1b3b1-1b1b-1b1b-1b1b-1b1b1b1b1b1b" + + - name: Create Volume group + ntnx_volume_groups_v2: + name: "{{ name }}" + description: "Volume group description" + should_load_balance_vm_attachments: true + sharing_status: "SHARED" + target_prefix: "vg1" + cluster_reference: "{{ cluster_reference }}" + usage_type: "USER" + storage_features: + flash_mode: + is_enabled: true + iscsi_features: + target_secret: "Secret1234567" + enabled_authentications: "CHAP" + register: result + ignore_errors: true + + - name: Fetch above created VG + ntnx_volume_groups_info_v2: + ext_id: "{{ vg1_uuid }}" + register: result + ignore_errors: true + + - name: Fetch all VGs using filters + ntnx_volume_groups_info_v2: + filter: "startswith(name, '{{name}}')" + register: result + ignore_errors: true + + - name: Delete Volume group + ntnx_volume_groups_v2: + state: absent + ext_id: "{{ vg1_uuid }}" + register: result + ignore_errors: true diff --git a/examples/Volume_groups_v2/volume_groups_vms_v2.yml b/examples/Volume_groups_v2/volume_groups_vms_v2.yml new file mode 100644 index 00000000..5f8b8b05 --- /dev/null +++ b/examples/Volume_groups_v2/volume_groups_vms_v2.yml @@ -0,0 +1,35 @@ +--- +# Summary: +# This playbook will do: +# 1. Attach VM to Volume Group +# 2. Detach VM from Volume Group + +- name: Volume groups vms playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + vg1_uuid: "f4b1b3b4-4b1b-4b1b-4b1b-4b1b4b1b4b1b" + vm1_uuid: "a1b2c3d4-e5f6-7g8h-9i0j-k1l2m3n4o5p6" + + - name: Attach VM1 to VG + ntnx_volume_groups_vms_v2: + state: present + volume_group_ext_id: "{{ vg1_uuid }}" + ext_id: "{{ vm1_uuid }}" + index: 1 + register: result + + - name: Detach VM1 from VG + ntnx_volume_groups_vms_v2: + state: absent + volume_group_ext_id: "{{ vg1_uuid }}" + ext_id: "{{ vm1_uuid }}" + register: result diff --git a/examples/categories_v2/categories_v2.yml b/examples/categories_v2/categories_v2.yml new file mode 100644 index 00000000..fe5ee74e --- /dev/null +++ b/examples/categories_v2/categories_v2.yml @@ -0,0 +1,61 @@ +--- +# Summary: +# This playbook will do: +# 1. Create a category key & value +# 2. Update the category value and description +# 3. List all categories +# 4. Fetch category using ext id & expand detailedAssociations +# 5. Delete Created category + +- name: Categories playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + key1: "ansible_category_key" + value1: "ansible_category_value" + value2: "ansible_category_value_updated" + category_ext_id: "11223344-1234-1111-2222-6788222f17b8" + + - name: Create category key & value + ntnx_categories_v2: + key: "{{key1}}" + value: "{{value1}}" + description: "ansible test" + register: output + ignore_errors: true + + - name: Update category value and description + ntnx_categories_v2: + ext_id: "{{category_ext_id}}" + key: "{{key1}}" + value: "{{value2}}" + description: "ansible test New value" + register: result + ignore_errors: true + + - name: List all categories + ntnx_categories_info_v2: + register: result + ignore_errors: true + + - name: Fetch category using ext id & expand detailedAssociations + ntnx_categories_info_v2: + ext_id: "{{category_ext_id}}" + expand: detailedAssociations + register: result + ignore_errors: true + + - name: Delete Created category + ntnx_categories_v2: + ext_id: "{{category_ext_id}}" + state: absent + register: result + ignore_errors: true diff --git a/examples/cluster_management_v2/clusters_and_hosts_v2.yml b/examples/cluster_management_v2/clusters_and_hosts_v2.yml new file mode 100644 index 00000000..8f2b1992 --- /dev/null +++ b/examples/cluster_management_v2/clusters_and_hosts_v2.yml @@ -0,0 +1,243 @@ +--- +# Summary: +# This playbook will do: +# 1. Create a cluster +# 2. Register the cluster to Prism Central +# 3. Fetch cluster using name +# 4. Fetch cluster info using external ID +# 5. Update ntp servers, dns servers and smtp servers in cluster +# 6. List all hosts +# 7. List all hosts using filter +# 8. Verify fetching host using external ID +# 9. Fetch hosts of particular cluster +# 10. Destroy the cluster + +- name: clusters CRUD playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + cluster_username: "username" + cluster_password: "password" + cluster_ext_id: "00061de6-4a87-6b06-185b-ac1f6b6f97e2" + host_ext_id: "0005f1e6-4a87-6b06-185b-ac1f6b6f97e2" + host_name: "host1" + clusters: + nodes: + - cvm_ip: "10.0.0.1" + name: "cluster1" + config: + cluster_functions: + - "function1" + auth_public_keys: + - name: "key1" + key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQ6" + redundancy_factor_cluster_crud: 2 + cluster_arch: "ARCH64" + fault_tolerance_state: + domain_awareness_level_cluster_crud: "DOMAIN_AWARE" + network: + virtual_ip: "10.0.0.2" + iscsi_ip: "10.0.0.6" + ntp_servers: + - "ntp1" + - "ntp2" + - "ntp3" + - "ntp4" + dns_servers: + - "dns1" + - "dns2" + smtp_server: + email_address: "test@test.com" + ip: "10.0.0.87" + port: 25 + username: "test" + password: "test" + type: "SMTP" + + # we use this to get prism central external ID to use it to register the cluster + - name: List all clusters to get prism central external ID + ntnx_clusters_info_v2: + filter: "config/clusterFunction/any(t:t eq Clustermgmt.Config.ClusterFunctionRef'PRISM_CENTRAL')" + register: result + ignore_errors: true + + # here we set the prism central external ID + - name: Get prism central external ID + ansible.builtin.set_fact: + prism_central_external_id: "{{ result.response[0].ext_id }}" + + # before creating cluster, we need to make sure that the cluster is not already created + - name: Discover unconfigured node + ntnx_discover_unconfigured_nodes_v2: + address_type: "IPV4" + ip_filter_list: + - ipv4: + value: "{{ clusters[0].nodes[0].cvm_ip }}" + register: result + ignore_errors: true + + - name: Run cluster create prechecks + ntnx_clusters_v2: + name: "{{ clusters[0].name }}" + nodes: + node_list: + - controller_vm_ip: + ipv4: + value: "{{ clusters[0].nodes[0].cvm_ip }}" + config: + cluster_function: "{{ clusters[0].config.cluster_functions }}" + authorized_public_key_list: + - name: "{{ clusters[0].config.auth_public_keys[0].name }}" + key: "{{ clusters[0].config.auth_public_keys[0].key }}" + redundancy_factor: "{{ clusters[0].config.redundancy_factor_cluster_crud }}" + cluster_arch: "{{ clusters[0].config.cluster_arch }}" + fault_tolerance_state: + domain_awareness_level: "{{ clusters[0].config.fault_tolerance_state.domain_awareness_level_cluster_crud }}" + network: + external_address: + ipv4: + value: "{{ clusters[0].network.virtual_ip }}" + external_data_service_ip: + ipv4: + value: "{{ clusters[0].network.iscsi_ip }}" + ntp_server_ip_list: + - fqdn: + value: "{{ clusters[0].network.ntp_servers[0] }}" + - fqdn: + value: "{{ clusters[0].network.ntp_servers[1] }}" + - fqdn: + value: "{{ clusters[0].network.ntp_servers[2] }}" + - fqdn: + value: "{{ clusters[0].network.ntp_servers[3] }}" + name_server_ip_list: + - ipv4: + value: "{{ clusters[0].network.dns_servers[0] }}" + - ipv4: + value: "{{ clusters[0].network.dns_servers[1] }}" + smtp_server: + email_address: "{{ clusters[0].network.smtp_server.email_address }}" + server: + ip_address: + ipv4: + value: "{{ clusters[0].network.smtp_server.ip }}" + port: "{{ clusters[0].network.smtp_server.port }}" + username: "{{ clusters[0].network.smtp_server.username }}" + password: "{{ clusters[0].network.smtp_server.password }}" + type: "{{ clusters[0].network.smtp_server.type }}" + dryrun: true + timeout: 1800 + register: result + ignore_errors: true + + - name: Create cluster + ntnx_clusters_v2: + name: "{{ clusters[0].name }}" + nodes: + node_list: + - controller_vm_ip: + ipv4: + value: "{{ clusters[0].nodes[0].cvm_ip }}" + config: + cluster_function: "{{ clusters[0].config.cluster_functions }}" + redundancy_factor: "{{ clusters[0].config.redundancy_factor_cluster_crud }}" + cluster_arch: "{{ clusters[0].config.cluster_arch }}" + fault_tolerance_state: + domain_awareness_level: "{{ clusters[0].config.fault_tolerance_state.domain_awareness_level_cluster_crud }}" + timeout: 1800 + register: result + ignore_errors: true + + # here we register the cluster to prism central + - name: Run PE PC registration + ntnx_pc_registration_v2: + ext_id: "{{ prism_central_external_id }}" + remote_cluster: + aos_remote_cluster: + remote_cluster: + address: + ipv4: + value: "{{ clusters[0].nodes[0].cvm_ip }}" + credentials: + authentication: + username: "{{ cluster_username }}" + password: "{{ cluster_password }}" + register: result + ignore_errors: true + + - name: Fetch cluster using name + ntnx_clusters_info_v2: + filter: name eq '{{ clusters[0].name }}' + register: result + ignore_errors: true + + - name: Fetch cluster info using external ID + ntnx_clusters_info_v2: + ext_id: "{{ cluster_ext_id }}" + register: result + ignore_errors: true + + - name: Update ntp servers, dns servers and smtp servers in cluster + ntnx_clusters_v2: + ext_id: "{{ cluster_ext_id }}" + network: + external_data_service_ip: + ipv4: + value: "{{ clusters[0].network.iscsi_ip1 }}" + ntp_server_ip_list: + - fqdn: + value: "{{ clusters[0].network.ntp_servers[0] }}" + name_server_ip_list: + - ipv4: + value: "{{ clusters[0].network.dns_servers[0] }}" + smtp_server: + email_address: "{{ clusters[0].network.smtp_server.email_address }}" + server: + ip_address: + ipv4: + value: "{{ clusters[0].network.smtp_server.ip }}" + port: "{{ clusters[0].network.smtp_server.port }}" + username: "{{ clusters[0].network.smtp_server.username }}" + password: "{{ clusters[0].network.smtp_server.password }}" + type: STARTTLS + timeout: 1200 + register: result + ignore_errors: true + + - name: List all hosts + ntnx_hosts_info_v2: + register: result + ignore_errors: true + + - name: List all hosts using filter + ntnx_hosts_info_v2: + filter: hostName eq '{{ host_name }}' + register: result + ignore_errors: true + + - name: Verify fetching host using external ID + ntnx_hosts_info_v2: + ext_id: "{{ host_ext_id }}" + cluster_ext_id: "{{ cluster_ext_id }}" + register: result + ignore_errors: true + + - name: Fetch hosts of particular cluster + ntnx_hosts_info_v2: + cluster_ext_id: "{{ cluster_ext_id }}" + register: result + ignore_errors: true + + - name: Destroy the cluster + ntnx_clusters_v2: + state: absent + ext_id: "{{ cluster_ext_id }}" + register: result + ignore_errors: true diff --git a/examples/cluster_management_v2/clusters_nodes_v2.yml b/examples/cluster_management_v2/clusters_nodes_v2.yml new file mode 100644 index 00000000..d4da3ffc --- /dev/null +++ b/examples/cluster_management_v2/clusters_nodes_v2.yml @@ -0,0 +1,225 @@ +--- +# Summary: +# This playbook will do: +# 1. Create a cluster with 3 nodes +# 2. Register the cluster with Prism Central +# 3. Expand the cluster by adding a node +# 4. Remove the node from the cluster +# 5. Destroy the cluster + +- name: cluster expanding playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + cluster_username: "username" + cluster_password: "password" + cluster_ext_id: "00061de6-4a87-6b06-185b-ac1f6b6f97e2" + host_ext_id: "0005f1e6-4a87-6b06-185b-ac1f6b6f97e2" + host_name: "host1" + clusters: + nodes: + - cvm_ip: "10.0.0.1" + - cvm_ip: "10.0.1.0" + - cvm_ip: "10.0.2.0" + - cvm_ip: "10.0.3.0" + name: "cluster1" + config: + cluster_functions: + - "function1" + auth_public_keys: + - name: "key1" + key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQ6" + redundancy_factor_cluster_crud: 2 + redundancy_factor_cluster_expanding: 3 + cluster_arch: "ARCH64" + fault_tolerance_state: + domain_awareness_level_cluster_crud: "DOMAIN_AWARE" + domain_awareness_level_cluster_expanding: "DOMAIN_AWARE" + network: + virtual_ip: "10.0.0.2" + iscsi_ip: "10.0.0.6" + ntp_servers: + - "ntp1" + - "ntp2" + - "ntp3" + - "ntp4" + dns_servers: + - "dns1" + - "dns2" + smtp_server: + email_address: "test@test.com" + ip: "10.0.0.87" + port: 25 + username: "test" + password: "test" + type: "SMTP" + + # to expand cluster, we need to create one with three nodes + - name: Create 3 nodes cluster with minimum spec + ntnx_clusters_v2: + name: "{{ clusters[0].name }}" + nodes: + node_list: + - controller_vm_ip: + ipv4: + value: "{{ clusters[0].nodes[0].cvm_ip }}" + - controller_vm_ip: + ipv4: + value: "{{ clusters[0].nodes[1].cvm_ip }}" + - controller_vm_ip: + ipv4: + value: "{{ clusters[0].nodes[2].cvm_ip }}" + config: + cluster_function: "{{ clusters[0].config.cluster_functions }}" + redundancy_factor: "{{ clusters[0].config.redundancy_factor_cluster_expanding }}" + cluster_arch: "{{ clusters[0].config.cluster_arch }}" + fault_tolerance_state: + domain_awareness_level: "{{ clusters[0].config.fault_tolerance_state.domain_awareness_level_cluster_expanding }}" + timeout: 1800 + register: result + ignore_errors: true + + # we use this to get prism central external ID to use it to register the cluster + - name: List all clusters to get prism central external ID + ntnx_clusters_info_v2: + filter: "config/clusterFunction/any(t:t eq Clustermgmt.Config.ClusterFunctionRef'PRISM_CENTRAL')" + register: result + ignore_errors: true + + # here we set the prism central external ID + - name: Get prism central external ID + ansible.builtin.set_fact: + prism_central_external_id: "{{ result.response[0].ext_id }}" + + - name: Run PE PC registration + ntnx_pc_registration_v2: + ext_id: "{{ prism_central_external_id }}" + remote_cluster: + aos_remote_cluster: + remote_cluster: + address: + ipv4: + value: "{{ clusters[0].nodes[0].cvm_ip }}" + credentials: + authentication: + username: "{{ username }}" + password: "{{ password }}" + register: result + ignore_errors: true + + # here we fetch the cluster using the name + - name: Fetch cluster using name + ntnx_clusters_info_v2: + filter: name eq '{{ cluster_name }}' + register: result + ignore_errors: true + + # here we set the cluster external ID + - name: Set cluster external ID + ansible.builtin.set_fact: + cluster_ext_id: "{{ result.response[0].ext_id }}" + + # here we discover the unconfigured node which we want to add to the cluster + - name: Discover unconfigured node + ntnx_discover_unconfigured_nodes_v2: + cluster_ext_id: "{{ cluster_ext_id }}" + address_type: "IPV4" + ip_filter_list: + - ipv4: + value: "{{ clusters[0].nodes[3].cvm_ip }}" + register: result_discover + ignore_errors: true + + # here we get the network info of the unconfigured node + - name: Get network info of unconfigured node + ntnx_nodes_network_info_v2: + cluster_ext_id: "{{ cluster_ext_id }}" + node_list: + - cvm_ip: + ipv4: + value: "{{ result_discover.response.response.node_list[0].cvm_ip.ipv4.value }}" + hypervisor_ip: + ipv4: + value: "{{ result_discover.response.response.node_list[0].hypervisor_ip.ipv4.value }}" + request_type: "expand_cluster" + register: result_network_info + ignore_errors: true + + # here we expand the cluster by adding the unconfigured node + - name: Expand cluster by adding a node + ntnx_clusters_nodes_v2: + cluster_ext_id: "{{ cluster_ext_id }}" + node_params: + node_list: + - node_uuid: "{{ result_discover.response.response.node_list[0].node_uuid }}" + block_id: "{{ result_discover.response.response.node_list[0].rackable_unit_serial }}" + node_position: "{{ result_discover.response.response.node_list[0].node_position }}" + nos_version: "{{ result_discover.response.response.node_list[0].nos_version }}" + hypervisor_type: "{{ result_discover.response.response.node_list[0].hypervisor_type }}" + hypervisor_version: "{{ result_discover.response.response.node_list[0].hypervisor_version }}" + is_light_compute: false + is_robo_mixed_hypervisor: true + hypervisor_hostname: test + model: "{{ result_discover.response.response.node_list[0].rackable_unit_model }}" + cvm_ip: + ipv4: + value: "{{ result_discover.response.response.node_list[0].cvm_ip.ipv4.value }}" + prefix_length: "{{ result_discover.response.response.node_list[0].cvm_ip.ipv4.prefix_length | int }}" + hypervisor_ip: + ipv4: + value: "{{ result_discover.response.response.node_list[0].hypervisor_ip.ipv4.value }}" + prefix_length: "{{ result_discover.response.response.node_list[0].hypervisor_ip.ipv4.prefix_length | int }}" + ipmi_ip: + ipv4: + value: "{{ result_discover.response.response.node_list[0].ipmi_ip.ipv4.value }}" + prefix_length: "{{ result_discover.response.response.node_list[0].ipmi_ip.ipv4.prefix_length | int }}" + current_network_interface: "{{ result_network_info.response.response.uplinks[0].uplink_list[0].name }}" + networks: + - name: "{{ result_network_info.response.response.network_info.hci[0].name }}" + networks: "{{ result_network_info.response.response.network_info.hci[0].networks }}" + uplinks: + active: + - mac: "{{ result_network_info.response.response.uplinks[0].uplink_list[0].mac }}" + name: "{{ result_network_info.response.response.uplinks[0].uplink_list[0].name }}" + value: "{{ result_network_info.response.response.uplinks[0].uplink_list[0].name }}" + standby: + - mac: "{{ result_network_info.response.response.uplinks[0].uplink_list[1].mac }}" + name: "{{ result_network_info.response.response.uplinks[0].uplink_list[1].name }}" + value: "{{ result_network_info.response.response.uplinks[0].uplink_list[1].name }}" + config_params: + should_skip_discovery: false + should_skip_imaging: true + should_validate_rack_awareness: false + is_nos_compatible: false + is_compute_only: false + is_never_scheduleable: false + target_hypervisor: "{{ result_discover.response.response.node_list[0].hypervisor_type }}" + should_skip_add_node: false + should_skip_pre_expand_checks: false + register: result_expand + ignore_errors: true + + # here we remove the node from the cluster + - name: Remove node from cluster + ntnx_clusters_nodes_v2: + state: absent + cluster_ext_id: "{{ cluster_ext_id }}" + node_uuids: + - "{{ result_discover.response.response.node_list[0].node_uuid }}" + register: result + ignore_errors: true + + - name: Destroy the cluster + ntnx_clusters_v2: + state: absent + ext_id: "{{ cluster_ext_id }}" + register: result + ignore_errors: true diff --git a/examples/iam_v2/authorization_policies_v2.yml b/examples/iam_v2/authorization_policies_v2.yml new file mode 100644 index 00000000..e4fec461 --- /dev/null +++ b/examples/iam_v2/authorization_policies_v2.yml @@ -0,0 +1,106 @@ +--- +# Summary: +# This playbook will do: +# 1. Create authorization policy +# 2. Update authorization policy +# 3. List all authorization policies +# 4. Get specific authorization policy +# 5. Fetch authorization policies using filters +# 6. Delete created authorization policy + +- name: authorization policies playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + auth_policy_name: "ansible_auth_policy" + role_uuid: "e2dee03b-aa1a-54dc-81b4-6788222f17b8" + directory_service_uuid: "e2dee03b-aa1a-54dc-81b4-6788222f17b8" + policy_ext_id: "33425890-8888-9999-5555-6788222f17b8" + users: + - "11111111-3333-5555-7777-6788222f17b8" + - "22222222-4444-6666-8888-6788222f17b8" + user_groups: + - "e2dee03b-1234-1111-2222-6788222f17b8" + project: + uuid: "12321232-0000-0909-0864-6788222f17b8" + + - name: Create auth policy + ntnx_authorization_policies_v2: + state: present + display_name: "{{ auth_policy_name }}" + description: ansible created acps + role: "{{ role_uuid }}" + authorization_policy_type: USER_DEFINED + entities: + - images: + "*": + eq: "*" + - directory_service: + uuid: + anyof: + - "{{ directory_service_uuid }}" + - marketplace_item: + owner_uuid: + eq: SELF_OWNED + identities: + - user: + uuid: + anyof: + - "{{ users[0] }}" + - "{{ users[1] }}" + - user: + group: + anyof: + - "{{ user_groups[0] }}" + register: result + ignore_errors: true + + - name: Update auth policy + ntnx_authorization_policies_v2: + state: present + ext_id: "{{ policy_ext_id }}" + entities: + - images: + "*": + eq: "*" + - marketplace_item: + owner_uuid: + eq: SELF_OWNED + - "*": + project_uuid: + anyof: + - "{{ project.uuid }}" + register: result + ignore_errors: true + + - name: Get all auth policies + ntnx_authorization_policies_info_v2: + register: result + ignore_errors: true + + - name: Get specific auth policy + ntnx_authorization_policies_info_v2: + ext_id: "{{ policy_ext_id }}" + register: result + ignore_errors: true + + - name: Fetch using filters + ntnx_authorization_policies_info_v2: + filter: displayName eq '{{ auth_policy_name }}' + register: result + ignore_errors: true + + - name: Delete created auth policy + ntnx_authorization_policies_v2: + state: absent + ext_id: "{{ policy_ext_id }}" + register: result + ignore_errors: true diff --git a/examples/iam_v2/directory_services_v2.yml b/examples/iam_v2/directory_services_v2.yml new file mode 100644 index 00000000..0adbb5e0 --- /dev/null +++ b/examples/iam_v2/directory_services_v2.yml @@ -0,0 +1,91 @@ +--- +# Summary: +# This playbook will do: +# 1. Create ACTIVE_DIRECTORY service +# 2. Update ACTIVE_DIRECTORY service +# 3. Fetch ACTIVE_DIRECTORY service info using ext id +# 4. List all directory services +# 5. List all directory services with filter +# 6. Delete ACTIVE_DIRECTORY service + +- name: Directory Services playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + name: "Directory Services" + url: "https://example.com" + url2: "https://example2.com" + domain_name: "example.com" + domain_name_updated: "example2.com" + username: "admin" + username_updated: "admin2" + password: "password" + password_updated: "password2" + white_listed_groups: + - "group1" + - "group2" + directory_service_ext_id: "12345678-1234-1234-1234-123456789012" + + - name: Create ACTIVE_DIRECTORY service + ntnx_directory_services_v2: + state: present + name: "{{ name }}" + url: "{{ url }}" + directory_type: ACTIVE_DIRECTORY + domain_name: "{{ domain_name }}" + service_account: + username: "{{ username }}" + password: "{{ password }}" + white_listed_groups: + - "{{ white_listed_groups[0] }}" + register: result + ignore_errors: true + + - name: Update directory service + ntnx_directory_services_v2: + state: present + ext_id: "{{ directory_service_ext_id }}" + name: "{{ name }}_updated" + url: "{{ url2 }}" + directory_type: ACTIVE_DIRECTORY + domain_name: "{{ domain_name_updated }}" + service_account: + username: "{{ username_updated }}" + password: "{{ password_updated }}" + group_search_type: RECURSIVE + white_listed_groups: + - "{{ white_listed_groups[1] }}" + register: result + ignore_errors: true + + - name: Fetch directory service info using ext id + ntnx_directory_services_info_v2: + ext_id: "{{ directory_service_ext_id }}" + register: result + ignore_errors: true + + - name: List all directory services + ntnx_directory_services_info_v2: + register: result + ignore_errors: true + + - name: List all directory services with filter + ntnx_directory_services_info_v2: + filter: name eq '{{ name }}' + register: result + ignore_errors: true + + - name: Delete directory service + ntnx_directory_services_v2: + state: absent + ext_id: "{{ directory_service_ext_id }}" + register: result + ignore_errors: true diff --git a/examples/iam_v2/operations_v2.yml b/examples/iam_v2/operations_v2.yml new file mode 100644 index 00000000..8ba0f8c5 --- /dev/null +++ b/examples/iam_v2/operations_v2.yml @@ -0,0 +1,30 @@ +--- +# Summary: +# This playbook will do: +# 1. List all operations +# 2. List permission using ext_id criteria + +- name: operations playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + test_permission_uuid: 00000000-0000-0000-0000-000000000001 + + - name: List all operations + ntnx_operations_info_v2: + register: result + ignore_errors: true + + - name: List permission using ext_id criteria + ntnx_operations_info_v2: + ext_id: "{{ test_permission_uuid }}" + register: result + ignore_errors: true diff --git a/examples/iam_v2/roles_v2.yml b/examples/iam_v2/roles_v2.yml new file mode 100644 index 00000000..f3acfd74 --- /dev/null +++ b/examples/iam_v2/roles_v2.yml @@ -0,0 +1,69 @@ +--- +# Summary: +# This playbook will do: +# 1. Create a role with operations +# 2. Update the role +# 3. List all roles +# 4. Fetch the role using external ID +# 5. Delete the role + +- name: Roles playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + role_name: test-ansible-role-1 + role_name_updated: test-ansible-role-2 + test_operation_1_uuid: 00000000-0000-0000-0000-000000000001 + test_operation_2_uuid: 00000000-0000-0000-0000-000000000002 + role_uuid: 00000000-0000-0000-0000-000000000003 + +- name: Create roles with operations + ntnx_roles_v2: + state: present + display_name: "{{ role_name }}" + description: test-ansible-role-1-desc + operations: + - "{{ test_operation_1_uuid }}" + - "{{ test_operation_2_uuid }}" + wait: true + register: result + ignore_errors: true + +- name: Update roles in check mode + ntnx_roles_v2: + state: present + ext_id: "{{ role_uuid }}" + display_name: "{{ role_name_updated }}" + description: test-ansible-role-2-desc + operations: + - "{{ test_operation_2_uuid }}" + wait: true + register: result + check_mode: true + ignore_errors: true + +- name: List all roles + ntnx_roles_info_v2: + register: result + ignore_errors: true + +- name: Fetch role using external ID + ntnx_roles_info_v2: + ext_id: "{{ role_uuid }}" + register: result + ignore_errors: true + +- name: Delete role + ntnx_roles_v2: + state: absent + ext_id: "{{ role_uuid }}" + register: result + ignore_errors: true diff --git a/examples/iam_v2/saml_identity_provider_v2.yml b/examples/iam_v2/saml_identity_provider_v2.yml new file mode 100644 index 00000000..07c4b3ad --- /dev/null +++ b/examples/iam_v2/saml_identity_provider_v2.yml @@ -0,0 +1,69 @@ +--- +# Summary: +# This playbook will do: +# 1. Create SAML identity provider +# 2. Update SAML identity provider +# 3. List all SAML identity providers +# 4. Get specific SAML identity provider +# 5. Fetch SAML identity providers using filters +# 6. Delete created SAML identity provider + +- name: SAML identity provider playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + name: "ansible_saml" + username_attribute: "username" + idp_metadata_xml: "" + saml_ext_id: "33425890-8888-9999-5555-6788222f17b8" + + - name: Create saml + ntnx_saml_identity_providers_v2: + name: "{{ name }}" + username_attribute: "{{ username_attribute }}1" + email_attribute: email + groups_attribute: groups + groups_delim: "," + idp_metadata_xml: "{{ idp_metadata_xml }}" + state: present + register: result + ignore_errors: true + + - name: Get saml using filter name + ntnx_saml_identity_providers_info_v2: + filter: name eq '{{ name }}' + register: result + ignore_errors: true + + - name: Update saml + ntnx_saml_identity_providers_v2: + state: present + ext_id: "{{ saml_ext_id }}" + name: "{{ name }}2" + username_attribute: "{{ username_attribute }}2" + email_attribute: new_email + groups_attribute: group_list + groups_delim: ; + is_signed_authn_req_enabled: true + register: result + ignore_errors: true + + - name: List all identity providers + ntnx_saml_identity_providers_info_v2: + register: result + ignore_errors: true + + - name: Delete the created SAML identity providers + ntnx_saml_identity_providers_v2: + state: absent + ext_id: "{{ saml_ext_id }}" + register: result + ignore_errors: true diff --git a/examples/iam_v2/user_groups_v2.yml b/examples/iam_v2/user_groups_v2.yml new file mode 100644 index 00000000..3ebf990a --- /dev/null +++ b/examples/iam_v2/user_groups_v2.yml @@ -0,0 +1,58 @@ +--- +# Summary: +# This playbook will do: +# 1. Create LDAP user group +# 2. Create SAML user group +# 3. List all user groups +# 4. List user groups using filter criteria +# 5. Delete created user group + +- name: user groups playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + distinguished_name: "cn=group_0876339e,ou=group,dc=devtest,dc=local" + directory_service_uuid: "e2dee03b-aa1a-54dc-81b4-6788222f17b8" + identity_provider_uuid: "2bfd579d-c5f4-5038-9127-4a46ab066f48" + new_saml_user_group: "245266admin" + user_group_ext_id: "e2dee03b-1234-1111-2222-6788222f17b8" + + - name: Create LDAP user group + ntnx_user_groups_v2: + group_type: LDAP + distinguished_name: "{{ distinguished_name }}" + idp_id: "{{ directory_service_uuid }}" + + - name: Create SAML user group + ntnx_user_groups_v2: + group_type: SAML + idp_id: "{{ identity_provider_uuid }}" + name: "{{ new_saml_user_group }}" + register: result + ignore_errors: true + + - name: List all user groups + ntnx_user_groups_info_v2: + register: user_groups + ignore_errors: true + + - name: List user groups using filter criteria + ntnx_user_groups_info_v2: + filter: name eq '{{ new_saml_user_group }}' + register: result + ignore_errors: true + + - name: Delete created user group + ntnx_user_groups_v2: + state: absent + ext_id: "{{ user_group_ext_id }}" + register: result + ignore_errors: true diff --git a/examples/iam_v2/users_v2.yml b/examples/iam_v2/users_v2.yml new file mode 100644 index 00000000..2c8a3637 --- /dev/null +++ b/examples/iam_v2/users_v2.yml @@ -0,0 +1,103 @@ +--- +# Summary: +# This playbook will do: +# 1. Create active local user +# 2. Create SAML user +# 3. Create LDAP user +# 4. Update local user +# 5. List all users +# 6. Fetch user info using user ext_id criteria +# 7. List users with specific username +# 8. Delete created user + +- name: users playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + username: test-ansible-user-1 + first_name: test-ansible-firstname-1 + last_name: test-ansible-lastname-1 + display_name: test-ansible-displayname-1 + middle_initial: test-ansible-middleinitial-1 + email_id: test@test.com + password: test.Password.123 + identity_provider_uuid: 00000000-0000-0000-0000-000000000001 + directory_service_uuid: 00000000-0000-0000-0000-000000000002 + user_ext_id: 00000000-0000-0000-0000-000000000003 + + - name: Create active local user + ntnx_users_v2: + user_type: LOCAL + username: "{{ username }}" + first_name: "{{ first_name }}" + last_name: "{{ last_name }}" + display_name: "{{ display_name }}" + password: "{{ password }}" + middle_initial: "{{ middle_initial }}" + email_id: "{{ email_id }}" + locale: en-US + status: ACTIVE + is_force_reset_password_enabled: true + register: result + ignore_errors: true + + - name: Create SAML user + ntnx_users_v2: + user_type: SAML + username: "{{ username }}" + idp_id: "{{ identity_provider_uuid }}" + register: result + ignore_errors: true + + - name: Create LDAP user + ntnx_users_v2: + user_type: LDAP + username: "{{ new_user }}" + idp_id: "{{ directory_service_uuid }}" + register: result + ignore_errors: true + + - name: Update local user + ntnx_users_v2: + ext_id: "{{ user_ext_id }}" + first_name: "{{ first_name }}_updated" + last_name: "{{ last_name }}_updated" + password: "{{ password }}" + display_name: "{{ display_name }}_updated" + middle_initial: "{{ middle_initial }}_updated" + email_id: "{{ email_id }}" + is_force_reset_password_enabled: true + register: result + ignore_errors: true + + - name: List all users + ntnx_users_info_v2: + register: users + ignore_errors: true + + - name: Fetch user info using user ext_id criteria + ntnx_users_info_v2: + ext_id: "{{ user_ext_id }}" + register: result + ignore_errors: true + + - name: List users with specific username + ntnx_users_info_v2: + filter: username eq '{{ username }}' + register: result + ignore_errors: true + + - name: Delete created user + ntnx_users: + state: absent + user_uuid: "{{ user_ext_id }}" + register: result + ignore_errors: true diff --git a/examples/networks_v2/address_groups_v2.yml b/examples/networks_v2/address_groups_v2.yml new file mode 100644 index 00000000..96660e0c --- /dev/null +++ b/examples/networks_v2/address_groups_v2.yml @@ -0,0 +1,65 @@ +--- +# Summary: +# This playbook will do: +# 1. Create an address group +# 2. Update the address group +# 3. Fetch the address group info +# 4. Delete the address group + +- name: address groups playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + address_group_name: "ansible_address_group" + address_group_uuid: "f1b1b1b1-1b1b-1b1b-1b1b-1b1b1b1b1b1b" + ipv4_addresses: + - value: 10.0.0.1 + prefix_length: 24 + - value: 10.0.0.2 + prefix_length: 24 + + - name: Create address group + ntnx_address_groups_v2: + state: present + name: "{{ address_group_name }}" + description: address group description + ipv4_addresses: + - value: "{{ ipv4_addresses[0].value }}" + prefix_length: "{{ ipv4_addresses[0].prefix_length }}" + - value: "{{ ipv4_addresses[1].value }}" + prefix_length: "{{ ipv4_addresses[1].prefix_length }}" + register: result + ignore_errors: true + + - name: Update address group with the given uuid + ntnx_address_groups_v2: + state: present + ext_id: "{{ address_group_uuid }}" + name: "{{ address_group_name }}_updated" + description: address group description updated + ipv4_addresses: + - value: "{{ ipv4_addresses[1].value }}" + prefix_length: "{{ ipv4_addresses[1].prefix_length }}" + register: result + ignore_errors: true + + - name: Fetch address group info + ntnx_address_groups_info_v2: + ext_id: "{{ address_group_uuid }}" + register: result + ignore_errors: true + + - name: Delete address group + ntnx_address_groups_v2: + state: absent + ext_id: "{{ address_group_uuid }}" + register: result + ignore_errors: true diff --git a/examples/networks_v2/floating_ip_v2.yml b/examples/networks_v2/floating_ip_v2.yml new file mode 100644 index 00000000..efc81396 --- /dev/null +++ b/examples/networks_v2/floating_ip_v2.yml @@ -0,0 +1,72 @@ +--- +# Summary: +# This playbook will do: +# 1. Create a floating IP with external subnet uuid +# 2. Update the floating IP name and private IP +# 3. Fetch the floating IP details using ext_id +# 4. Delete the floating IP + +- name: Floating IP playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + floating_ip_name: "fip1" + floating_ip_ext_id: "d7419d65-1254-9632-1122-ec1431516bbe" + external_nat_subnet_uuid: "e2dee03b-aa1a-54dc-81b4-6788222f17b8" + project_uuid: "d7419d65-100e-4c99-a666-ec1431516bbe" + user_uuid: "7c62834e-43f0-4c20-a5d4-cbf36b9a142b" + category_ext_id: "2dff5b0a-99c5-46d6-9002-d42439a8b6e5" + floating_ip: "10.0.0.1" + private_ip: "10.0.0.2" + vpc_uuid: "2dff5b0a-2368-3456-1236-d42439a8b6e5" + + - name: Create floating ip with external subnet uuid + ntnx_floating_ips_v2: + state: present + name: "{{ floating_ip_name }}" + external_subnet_reference: "{{ external_nat_subnet_uuid }}" + metadata: + project_reference_id: "{{ project_uuid }}" + owner_reference_id: "{{ user_uuid }}" + category_ids: + - "{{ category_ext_id }}" + floating_ip: + ipv4: + value: "{{ floating_ip }}" + register: result + ignore_errors: true + + - name: Update floating ip name and private IP + ntnx_floating_ips_v2: + state: present + name: "{{ floating_ip_name }}_updated" + ext_id: "{{ floating_ip_ext_id }}" + association: + private_ip_association: + private_ip: + ipv4: + value: "{{ private_ip }}" + vpc_reference: "{{ vpc_uuid }}" + register: result + ignore_errors: true + + - name: Get floating_ips using ext_id + ntnx_floating_ips_info_v2: + ext_id: "{{ floating_ip_ext_id }}" + register: result + ignore_errors: true + + - name: Delete floating ip + ntnx_floating_ips_v2: + state: absent + ext_id: "{{ floating_ip_ext_id }}" + register: result + ignore_errors: true diff --git a/examples/networks_v2/pbrs_v2.yml b/examples/networks_v2/pbrs_v2.yml new file mode 100644 index 00000000..35b7b778 --- /dev/null +++ b/examples/networks_v2/pbrs_v2.yml @@ -0,0 +1,78 @@ +--- +# Summary: +# This playbook will do: +# 1. Create a PBR with vpc, source network, external destination, with PERMIT action and icmp +# 2. Update the PBR name, description, and priority +# 3. Fetch the PBR details +# 4. Delete the PBR + +- name: PBRs playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + pbr_name: "pbr1" + pbr_uuid: "e2dee03b-aa1a-54dc-81b4-6788222f17b8" + priority: 2 + vpc_ext_id: "e2dee03b-aa1a-54dc-81b4-6788222f17b8" + network: + ip: "10.0.0.15" + prefix: 24 + + - name: Create PBR with vpc , source network, external destination, with PERMIT action and icmp + ntnx_pbrs_v2: + state: present + name: "{{ pbr_name }}" + priority: "{{ priority }}" + vpc_ext_id: "{{ vpc_ext_id }}" + description: "test description" + policies: + - policy_action: + action_type: PERMIT + policy_match: + source: + address_type: SUBNET + subnet_prefix: + ipv4: + ip: + value: "{{ network.ip }}" + prefix_length: "{{ network.prefix }}" + destination: + address_type: EXTERNAL + protocol_type: ICMP + protocol_parameters: + icmp: + icmp_type: 25 + icmp_code: 1 + register: result + ignore_errors: true + + - name: Update PBR name ,description, priority + ntnx_pbrs_v2: + state: present + ext_id: "{{ pbr_uuid }}" + priority: 3 + name: "Updated PBR" + description: "Updated description" + register: result + ignore_errors: true + + - name: Fetch PBR details + ntnx_pbrs_info_v2: + ext_id: "{{ pbr_uuid }}" + register: result + ignore_errors: true + + - name: Delete PBR + ntnx_pbrs_v2: + state: absent + ext_id: "{{ pbr_uuid }}" + register: result + ignore_errors: true diff --git a/examples/networks_v2/routes_v2.yml b/examples/networks_v2/routes_v2.yml new file mode 100644 index 00000000..5ba06e62 --- /dev/null +++ b/examples/networks_v2/routes_v2.yml @@ -0,0 +1,83 @@ +--- +# Summary: +# This playbook will do: +# 1. Create a static route +# 2. Update the static route +# 3. Fetch the static route details using ext_id +# 4. Delete the static route + +- name: Routes playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + route_name: "route1" + route_uuid: "14785236-aa1a-54dc-81b4-6788222f17b8" + route_table_external_id: "e2dee03b-aa1a-54dc-81b4-6788222f17b8" + vpc_uuid: "11223344-1234-1111-2222-6788222f17b8" + external_subnet_uuid: "78965412-1234-5555-9865-6788222f17b8" + user_uuid: "7c62834e-43f0-4c20-a5d4-cbf36b9a142b" + project_uuid: "d7419d65-100e-4c99-a666-ec1431516bbe" + ip1: "10.0.0.1" + ip2: "10.0.0.2" + +- name: Create static route + ntnx_routes_v2: + state: present + name: "{{ route_name }}" + description: "Route for testing" + vpc_reference: "{{ vpc_uuid }}" + route_table_ext_id: "{{ route_table_external_id }}" + route_type: STATIC + destination: + ipv4: + ip: + value: "{{ ip1 }}" + prefix_length: 32 + nexthop: + nexthop_type: "EXTERNAL_SUBNET" + nexthop_reference: "{{ external_subnet_uuid }}" + metadata: + owner_reference_id: "{{ user_uuid }}" + project_reference_id: "{{ project_uuid }}" + register: result + ignore_errors: true + +- name: Update route + ntnx_routes_v2: + state: present + name: "{{ route_name }}_updated" + description: "Route for testing updated" + vpc_reference: "{{ vpc_uuid }}" + route_table_ext_id: "{{ route_table_external_id }}" + ext_id: "{{ route_uuid }}" + route_type: STATIC + destination: + ipv4: + ip: + value: "{{ ip2 }}" + prefix_length: 32 + register: result + ignore_errors: true + +- name: Fetch route by external ID + ntnx_routes_info_v2: + ext_id: "{{ route_uuid }}" + route_table_ext_id: "{{ route_table_external_id }}" + register: result + ignore_errors: true + +- name: Delete static route + ntnx_routes_v2: + state: absent + ext_id: "{{ route_uuid }}" + route_table_ext_id: "{{ route_table_external_id }}" + register: result + ignore_errors: true diff --git a/examples/networks_v2/security_rules_v2.yml b/examples/networks_v2/security_rules_v2.yml new file mode 100644 index 00000000..357d29a4 --- /dev/null +++ b/examples/networks_v2/security_rules_v2.yml @@ -0,0 +1,167 @@ +--- +# Summary: +# This playbook will do: +# 1. Create a security rule +# 2. Update the security rule +# 3. Fetch the security rule info +# 4. Delete the security rule + +- name: security rules playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + security_rule_name: "ansible_security_rule" + security_rule_uuid: "f1b1b1b1-1b1b-1b1b-1b1b-1b1b1b1b1b1b" + service_group_id: "25412365-9999-9999-8888-1b1b1b1b1b1b" + address_group_ext_id: "78963254-1111-0000-0000-1b1b1b1b1b1b" + vpc_id: "f1b1b1b1-1b1b-1b1b-1b1b-1b1b1b1b1b1b" + category1_uuid: "12345678-1122-2233-4455-365478214587" + category2_uuid: "87654321-2211-3322-6655-963258741258" + category3: "11223355-9632-8520-4455-365478214587" + category4: "22113344-9632-8520-4455-365478214587" + + - name: Create basic application security rule for certain VPC scope with intra group traffic not allowed + ntnx_security_rules_v2: + name: "{{ security_rule_name }}" + description: Ansible created rule + type: APPLICATION + policy_state: ENFORCE + scope: VPC_LIST + vpc_references: + - "{{ vpc_id }}" + is_hitlog_enabled: true + is_ipv6_traffic_allowed: false + rules: + - description: inbound1 + type: INTRA_GROUP + spec: + intra_entity_group_rule_spec: + secured_group_category_references: + - "{{ category1_uuid }}" + - "{{ category2_uuid }}" + secured_group_action: DENY + - description: outbound1 + type: APPLICATION + spec: + application_rule_spec: + dest_allow_spec: ALL + secured_group_category_references: + - "{{ category1_uuid }}" + - "{{ category2_uuid }}" + is_all_protocol_allowed: true + - description: inbound2 + type: APPLICATION + spec: + application_rule_spec: + src_allow_spec: ALL + secured_group_category_references: + - "{{ category1_uuid }}" + - "{{ category2_uuid }}" + is_all_protocol_allowed: true + register: result + + - name: Update policy rules and config + ntnx_security_rules_v2: + ext_id: "{{ security_rule_uuid }}" + name: "{{ security_rule_name }}_updated" + description: Ansible updated rule + type: APPLICATION + policy_state: ENFORCE + scope: ALL_VLAN + is_hitlog_enabled: false + is_ipv6_traffic_allowed: false + rules: + - description: inbound1 + type: INTRA_GROUP + spec: + intra_entity_group_rule_spec: + secured_group_category_references: + - "{{ category3 }}" + secured_group_action: DENY + - description: inbound2_updated + type: APPLICATION + spec: + application_rule_spec: + secured_group_category_references: + - "{{ category3 }}" + src_category_references: + - "{{ category4 }}" + service_group_references: + - "{{ service_group_id }}" + - description: inbound3_updated + type: APPLICATION + spec: + application_rule_spec: + secured_group_category_references: + - "{{ category3 }}" + src_address_group_references: + - "{{ address_group_ext_id }}" + tcp_services: + - start_port: 85 + end_port: 90 + udp_services: + - start_port: 125 + end_port: 130 + icmp_services: + - type: 3 + code: 2 + - description: inbound4_updated + type: APPLICATION + spec: + application_rule_spec: + secured_group_category_references: + - "{{ category3 }}" + src_subnet: + value: 10.0.1.0 + prefix_length: 24 + service_group_references: + - "{{ service_group_id }}" + - description: outbound1 + type: APPLICATION + spec: + application_rule_spec: + secured_group_category_references: + - "{{ category3 }}" + dest_category_references: + - "{{ category4 }}" + service_group_references: + - "{{ service_group_id }}" + - description: outbound2_updated + type: APPLICATION + spec: + application_rule_spec: + secured_group_category_references: + - "{{ category3 }}" + dest_subnet: + value: 10.0.1.2 + prefix_length: 32 + is_all_protocol_allowed: true + - description: outbound3 + type: APPLICATION + spec: + application_rule_spec: + secured_group_category_references: + - "{{ category3 }}" + dest_address_group_references: + - "{{ address_group_ext_id }}" + is_all_protocol_allowed: true + register: result + + - name: Fetch security rule info + ntnx_security_rules_info_v2: + ext_id: "{{ security_rule_uuid }}" + register: result + + - name: Delete security rule + ntnx_security_rules_v2: + state: absent + ext_id: "{{ security_rule_uuid }}" + register: result diff --git a/examples/networks_v2/service_groups_v2.yml b/examples/networks_v2/service_groups_v2.yml new file mode 100644 index 00000000..f0bc30e6 --- /dev/null +++ b/examples/networks_v2/service_groups_v2.yml @@ -0,0 +1,77 @@ +--- +# Summary: +# This playbook will do: +# 1. Create a service group +# 2. Update the service group +# 3. Fetch the service group details using ext_id +# 4. Delete the service group + +- name: service groups playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + service_group_name: "service_group" + tcp_services: + - start_port: 10 + end_port: 50 + - start_port: 60 + end_port: 90 + - start_port: 98 + end_port: 98 + - start_port: 99 + end_port: 99 + icmp_services: + - type: 8 + code: 0 + service_group_uuid: "7c62834e-43f0-4c20-a5d4-cbf36b9a142b" + + - name: Create tcp service group + ntnx_service_groups_v2: + name: "{{ service_group_name }}" + description: "service group description" + tcp_services: + - start_port: "{{ tcp_services[0].start_port }}" + end_port: "{{ tcp_services[0].end_port }}" + - start_port: "{{ tcp_services[1].start_port }}" + end_port: "{{ tcp_services[1].end_port }}" + - start_port: "{{ tcp_services[2].start_port }}" + end_port: "{{ tcp_services[2].end_port }}" + - start_port: "{{ tcp_services[3].start_port }}" + end_port: "{{ tcp_services[3].end_port }}" + register: result + ignore_errors: true + + - name: Update tcp service group name and description and other protocols + ntnx_service_groups_v2: + ext_id: "{{ service_group_uuid }}" + name: "{{ service_group_name }}_updated" + description: "service group description updated" + tcp_services: + - start_port: "{{ tcp_services[2].start_port }}" + end_port: "{{ tcp_services[2].end_port }}" + icmp_services: + - type: "{{ icmp_services[0].type }}" + code: "{{ icmp_services[0].code }}" + register: result + ignore_errors: true + + - name: Getting particular service_group using uuid + ntnx_service_groups_info_v2: + ext_id: "{{ service_group_uuid }}" + register: result + ignore_errors: true + + - name: Delete service group + ntnx_service_groups_v2: + state: absent + ext_id: "{{ service_group_uuid }}" + register: result + ignore_errors: true diff --git a/examples/networks_v2/subnets_v2 .yml b/examples/networks_v2/subnets_v2 .yml new file mode 100644 index 00000000..a6ce9aed --- /dev/null +++ b/examples/networks_v2/subnets_v2 .yml @@ -0,0 +1,106 @@ +--- +# Summary: +# This playbook will do: +# 1. Create VLAN subnet without IPAM +# 2. Update VLAN subnet name and IP pools +# 3. Get subnet using ext_id +# 4. Create Overlay Subnet with minimum requirements +# 5. Delete subnet + +- name: Subnets playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + subnet_name: "integration_test_subnet" + subnet_uuid: "d7419d65-100e-4c99-a666-ec1431516bbe" + cluster_uuid: "00061663-9fa0-28ca-185b-ac1f6b6f97e1" + virtual_switch_uuid: "7c62834e-43f0-4c20-a5d4-cbf36b9a142b" + vpc_uuid: "2dff5b0a-99c5-46d6-9002-d42439a8b6e5" + network_id: 222 + ip_address_management: + network_ip: "10.0.0.1" + network_prefix: 24 + gateway_ip_address: "10.0.0.2" + dhcp_server_address: "10.0.0.3" + ip_address_pools: + start_address: "10.0.0.4" + end_address: "10.0.0.5" + start_address_2: "10.0.0.6" + end_address_2: "10.0.0.7" + + - name: Create VLAN subnet without IPAM + ntnx_subnets_v2: + state: present + wait: true + name: "{{ subnet_name }}" + subnet_type: VLAN + cluster_reference: "{{ cluster_uuid }}" + virtual_switch_reference: "{{ virtual_switch_uuid }}" + network_id: "{{ network_id }}" + register: result + ignore_errors: true + + - name: Update VLAN subnet name and IP pools + ntnx_subnets_v2: + state: present + name: "{{ subnet_name }}" + ext_id: "{{ subnet_uuid }}" + ip_config: + - ipv4: + ip_subnet: + ip: + value: "{{ ip_address_management.network_ip }}" + prefix_length: "{{ ip_address_management.network_prefix }}" + default_gateway_ip: + value: "{{ ip_address_management.gateway_ip_address }}" + dhcp_server_address: + value: "{{ ip_address_management.dhcp_server_address }}" + pool_list: + - start_ip: + value: "{{ ip_address_pools.start_address }}" + end_ip: + value: "{{ ip_address_pools.end_address }}" + - start_ip: + value: "{{ ip_address_pools.start_address_2 }}" + end_ip: + value: "{{ ip_address_pools.end_address_2 }}" + register: result + ignore_errors: true + + - name: Get subnet using ext_id + ntnx_subnets_info_v2: + ext_id: "{{ subnet_uuid }}" + register: result + ignore_errors: true + + - name: Create Overlay Subnet with minimum requirements + ntnx_subnets_v2: + state: present + name: "{{ subnet_name }}" + subnet_type: OVERLAY + vpc_reference: "{{ vpc_uuid }}" + ip_config: + - ipv4: + ip_subnet: + ip: + value: "{{ ip_address_management.network_ip }}" + prefix_length: "{{ ip_address_management.network_prefix }}" + default_gateway_ip: + value: "{{ ip_address_management.gateway_ip_address }}" + register: result + ignore_errors: true + + - name: Delete subnet + ntnx_subnets_v2: + state: absent + ext_id: "{{ subnet_uuid }}" + register: result + ignore_errors: true diff --git a/examples/networks_v2/vpcs_v2.yml b/examples/networks_v2/vpcs_v2.yml new file mode 100644 index 00000000..6876c508 --- /dev/null +++ b/examples/networks_v2/vpcs_v2.yml @@ -0,0 +1,53 @@ +--- +# Summary: +# This playbook will do: +# 1. Create a VPC with external_nat_subnet uuid +# 2. Update the VPC name +# 3. Fetch VPC info +# 4. Delete the VPC + +- name: VPCs playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + vpc_name: "integration_test_vpc" + vpc_uuid: "2dff5b0a-99c5-46d6-9002-d42439a8b6e5" + external_nat_subnet_uuid: "d7419d65-100e-4c99-a666-ec1431516bbe" + + - name: Create min VPC with external_nat_subnet uuid + ntnx_vpcs_v2: + state: present + wait: true + name: "{{vpc_name}}" + external_subnets: + - subnet_reference: "{{external_nat_subnet_uuid}}" + register: result + + - name: Update vpc name + ntnx_vpcs_v2: + state: present + ext_id: "{{vpc_uuid}}" + name: "{{vpc_name}}_updated" + register: result + ignore_errors: true + + - name: Fetch VPC info + ntnx_vpcs_info_v2: + ext_id: "{{vpc_uuid}}" + register: result + ignore_errors: true + + - name: Delete VPC + ntnx_vpcs_v2: + state: absent + ext_id: "{{vpc_uuid}}" + register: result + ignore_errors: true diff --git a/examples/storage_container_v2/storage_container_v2.yml b/examples/storage_container_v2/storage_container_v2.yml new file mode 100644 index 00000000..1fcb70ce --- /dev/null +++ b/examples/storage_container_v2/storage_container_v2.yml @@ -0,0 +1,114 @@ +--- +# Summary: +# This playbook will do: +# 1. Create a storage container +# 2. Update the storage container +# 3. Fetch storage container configurations +# 4. Fetch storage container stats +# 5. Fetch storage container stats with interval defined +# 6. Fetch all storage containers +# 7. Delete the storage container + +- name: storage container playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + storage_container_name: "ansible_storage_container" + cluster_ext_id: "00062899-4a29-0cf9-0000-000000028f57" + owner_uuid: "0005b6b4-0000-0000-0000-000000000000" + nfs_whitelist_address: + - ipv4: + value: "10.0.0.1" + - ipv4: + value: "10.0.0.2" + storage_container_ext_id: "0005b6b4-1234-1111-2222-000000000000" + + - name: Get current time minus 5 minutes in the required format + ansible.builtin.command: date -u -d "-300 seconds" +"%Y-%m-%dT%H:%M:%S.%3NZ" + register: start_time + changed_when: false + + - name: Get current time in the required format + ansible.builtin.command: date -u +"%Y-%m-%dT%H:%M:%S.%3NZ" + register: end_time + changed_when: false + + - name: Create storage container + ntnx_storage_containers_v2: + name: "{{ storage_container_name }}" + cluster_ext_id: "{{ cluster_ext_id }}" + owner_ext_id: "{{ owner_uuid }}" + logical_explicit_reserved_capacity_bytes: 20 + logical_advertised_capacity_bytes: 1073741824000 + on_disk_dedup: "OFF" + is_compression_enabled: true + compression_delay_secs: 3600 + is_internal: false + is_software_encryption_enabled: false + is_inline_ec_enabled: false + has_higher_ec_fault_domain_preference: true + nfs_whitelist_address: + - ipv4: + value: "{{ nfs_whitelist_address[0].ipv4.value }}" + register: result + ignore_errors: true + + - name: Update storage container + ntnx_storage_containers_v2: + state: present + ext_id: "{{ storage_container_ext_id }}" + name: "{{ storage_container_name }}_updated" + cluster_ext_id: "{{ cluster_ext_id }}" + owner_ext_id: "{{ owner_uuid }}" + logical_explicit_reserved_capacity_bytes: 25 + logical_advertised_capacity_bytes: 2147483648000 + nfs_whitelist_address: + - ipv4: + value: "{{ nfs_whitelist_address[1].ipv4.value }}" + register: result + ignore_errors: true + + - name: Fetch storage container configurations + ntnx_storage_containers_info_v2: + ext_id: "{{ storage_container_ext_id }}" + register: result + ignore_errors: true + + - name: Fetch storage container stats + ntnx_storage_containers_stats_v2: + ext_id: "{{ storage_container_ext_id }}" + start_time: "{{ start_time.stdout }}" + end_time: "{{ end_time.stdout }}" + register: result + ignore_errors: true + + - name: Fetch storage container stats with interval defined + ntnx_storage_containers_stats_v2: + ext_id: "{{ storage_container_ext_id }}" + start_time: "{{ start_time.stdout }}" + end_time: "{{ end_time.stdout }}" + sampling_interval: 30 + stat_type: SUM + register: result + ignore_errors: true + + - name: Fetch all storage containers + ntnx_storage_containers_info_v2: + register: result + ignore_errors: true + + - name: Delete storage container + ntnx_storage_containers_v2: + state: absent + ext_id: "{{ storage_container_ext_id }}" + ignore_small_files: true + register: result + ignore_errors: true diff --git a/examples/vmm_v2/vms_categories_v2.yml b/examples/vmm_v2/vms_categories_v2.yml new file mode 100644 index 00000000..bd4673c9 --- /dev/null +++ b/examples/vmm_v2/vms_categories_v2.yml @@ -0,0 +1,38 @@ +--- +# Summary: +# This playbook will do: +# 1. Associate a category to a VM +# 2. Disassociate a category from a VM + +- name: VM categories playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + vm_uuid: "a990cfaa-95a8-4861-bdf6-14060555442d" + category_ext_id: "d7419d65-100e-4c99-a666-ec1431516bbe" + + - name: Associate category to VM + ntnx_vms_categories_v2: + state: present + vm_ext_id: "{{ vm_uuid }}" + categories: + - ext_id: "{{ category_ext_id }}" + register: result + ignore_errors: true + + - name: Disassociate category from VM + ntnx_vms_categories_v2: + state: absent + vm_ext_id: "{{ vm_uuid }}" + categories: + - ext_id: "{{ category_ext_id }}" + register: result + ignore_errors: true diff --git a/examples/vmm_v2/vms_cd_rom_v2.yml b/examples/vmm_v2/vms_cd_rom_v2.yml new file mode 100644 index 00000000..34e9c140 --- /dev/null +++ b/examples/vmm_v2/vms_cd_rom_v2.yml @@ -0,0 +1,81 @@ +--- +# Summary: +# This playbook will do: +# 1. Create CD ROM for a VM +# 2. Inject ISO in CD ROM of a VM +# 3. Get CD ROM details +# 4. Eject ISO from CD ROM of a VM +# 5. Delete CD ROM + +- name: VM cd rom playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + vm_uuid: "a990cfaa-95a8-4861-bdf6-14060555442d" + category_ext_id: "d7419d65-100e-4c99-a666-ec1431516bbe" + image_uuid: "d7419d65-1234-4c99-4545-ec1431516bbe" + cd_rom_ext_id: "d7419d65-7896-3544-4545-ec1431516bbe" + + - name: Create CD ROM with all attributes + ntnx_vms_cd_rom_v2: + state: present + vm_ext_id: "{{ vm_uuid }}" + disk_address: + bus_type: "IDE" + index: 1 + backing_info: + data_source: + reference: + image_reference: + image_ext_id: "{{ image_uuid }}" + register: result + ignore_errors: true + + - name: Inject ISO in CD ROM of a VM + ntnx_vms_cd_rom_iso_v2: + state: present + vm_ext_id: "{{ vm_uuid }}" + ext_id: "{{ cd_rom_ext_id }}" + backing_info: + data_source: + reference: + image_reference: + image_ext_id: "{{ image_uuid }}" + register: result + ignore_errors: true + + - name: Get CD ROM details + ntnx_vms_cd_rom_info_v2: + vm_ext_id: "{{ vm_uuid }}" + ext_id: "{{ cd_rom_ext_id }}" + register: result + ignore_errors: true + + - name: Eject ISO from CD ROM of a VM + ntnx_vms_cd_rom_iso_v2: + state: absent + vm_ext_id: "{{ vm_uuid }}" + ext_id: "{{ cd_rom_ext_id }}" + backing_info: + data_source: + reference: + image_reference: + image_ext_id: "{{ image_uuid }}" + register: result + ignore_errors: true + + - name: Delete CD ROM + ntnx_vms_cd_rom_v2: + state: absent + vm_ext_id: "{{ vm_uuid }}" + ext_id: "{{ cd_rom_ext_id }}" + register: result + ignore_errors: true diff --git a/examples/vmm_v2/vms_clone_v2 .yml b/examples/vmm_v2/vms_clone_v2 .yml new file mode 100644 index 00000000..1b78b58d --- /dev/null +++ b/examples/vmm_v2/vms_clone_v2 .yml @@ -0,0 +1,36 @@ +--- +# Summary: +# This playbook will do: +# 1. Clone VM with same attributes values +# 2. Clone VM with different attributes values + +- name: VM clone playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + vm_uuid: "a990cfaa-95a8-4861-bdf6-14060555442d" + + - name: Clone VM with same attributes values + ntnx_vms_clone_v2: + ext_id: "{{ vm_uuid }}" + name: "integration_test_vm_clone1" + register: result + ignore_errors: true + + - name: Clone VM with different attributes values + ntnx_vms_clone_v2: + ext_id: "{{ vm_uuid }}" + name: "integration_test_vm_clone2" + num_sockets: 2 + num_cores_per_socket: 2 + num_threads_per_core: 2 + register: result + ignore_errors: true diff --git a/examples/vmm_v2/vms_disks_v2.yml b/examples/vmm_v2/vms_disks_v2.yml new file mode 100644 index 00000000..98af2849 --- /dev/null +++ b/examples/vmm_v2/vms_disks_v2.yml @@ -0,0 +1,144 @@ +--- +# Summary: +# This playbook will do: +# 1. Create Disk with storage container +# 2. Create Disk with image reference +# 3. Create Disk with disk reference +# 4. Create disk from volume group disk +# 5. Create Disk with VG reference +# 6. Update disk data source +# 7. Get disk info +# 8. Delete disk + +- name: VM disks playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + vm_name: "VM name" + storage_container_uuid: "223e4567-e89b-12d3-a456-426614174000" + vm_uuid: "323e4567-e89b-12d3-a456-426614174001" + image_uuid: "423e4567-e89b-12d3-a456-426614174002" + image_uuid_for_update: "523e4567-e89b-12d3-a456-426614174003" + disk_uuid: "623e4567-e89b-12d3-a456-426614174004" + volume_group_uuid: "723e4567-e89b-12d3-a456-426614174005" + + - name: Create Disk with storage container + ntnx_vms_disks_v2: + vm_ext_id: "{{ vm_uuid }}" + backing_info: + vm_disk: + disk_size_bytes: 26843545600 + storage_container: + ext_id: "{{ storage_container_uuid }}" + disk_address: + bus_type: "SCSI" + index: 1 + state: present + register: result + ignore_errors: true + + - name: Create Disk with image reference + ntnx_vms_disks_v2: + vm_ext_id: "{{ vm_uuid }}" + backing_info: + vm_disk: + disk_size_bytes: 26843545600 + storage_container: + ext_id: "{{ storage_container_uuid }}" + data_source: + reference: + image_reference: + image_ext_id: "{{ image_uuid }}" + disk_address: + bus_type: "SCSI" + index: 2 + state: present + register: result + ignore_errors: true + + - name: Create Disk with disk reference + ntnx_vms_disks_v2: + vm_ext_id: "{{ vm_uuid }}" + backing_info: + vm_disk: + disk_size_bytes: 26843545600 + data_source: + reference: + vm_disk_reference: + disk_ext_id: "{{ disk_uuid }}" + vm_reference: + ext_id: "{{ vm_uuid }}" + disk_address: + bus_type: "SCSI" + index: 2 + disk_address: + bus_type: "SCSI" + index: 3 + state: present + register: result + ignore_errors: true + + - name: Create disk from volume group disk + ntnx_volume_groups_disks_v2: + state: "present" + volume_group_ext_id: "{{ volume_group_uuid }}" + index: 6 + description: "Create disk from volume group disk description" + disk_data_source_reference: + entity_type: "STORAGE_CONTAINER" + ext_id: "{{ storage_container_uuid }}" + disk_size_bytes: 26843545600 + register: result + ignore_errors: true + + - name: Create Disk with VG reference + ntnx_vms_disks_v2: + vm_ext_id: "{{ vm_uuid }}" + backing_info: + adsf_volume_group: + volume_group_ext_id: "{{ volume_group_uuid }}" + disk_address: + bus_type: "SCSI" + index: 7 + state: present + register: result + ignore_errors: true + + - name: Update disk data source + ntnx_vms_disks_v2: + vm_ext_id: "{{ vm_uuid }}" + ext_id: "{{ disk_uuid }}" + backing_info: + vm_disk: + storage_container: + ext_id: "{{ storage_container_uuid }}" + data_source: + reference: + image_reference: + image_ext_id: "{{ image_uuid_for_update }}" + state: present + register: result + ignore_errors: true + + - name: Get disk info + ntnx_vms_disks_info_v2: + vm_ext_id: "{{ vm_uuid }}" + ext_id: "{{ disk_uuid }}" + register: result + ignore_errors: true + + - name: Delete disk + ntnx_vms_disks_v2: + vm_ext_id: "{{ vm_uuid }}" + ext_id: "{{ disk_uuid }}" + state: absent + register: result + ignore_errors: true diff --git a/examples/vmm_v2/vms_ngt_v2.yml b/examples/vmm_v2/vms_ngt_v2.yml new file mode 100644 index 00000000..3505db8e --- /dev/null +++ b/examples/vmm_v2/vms_ngt_v2.yml @@ -0,0 +1,81 @@ +--- +# Summary: +# This playbook will do: +# 1. Install NGT in VM with reboot preference set to IMMEDIATE +# 2. Fetch NGT config after installing NGT in VM with reboot preference set to IMMEDIATE +# 3. Update NGT in VM by disabling it and setting capabilities to VSS_SNAPSHOT +# 4. Upgrade NGT in VM +# 5. Insert ISO into CD ROM in VM +# 6. Uninstall NGT in VM + +- name: VM ngt playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + vm_uuid: "323e4567-e89b-12d3-a456-426614174001" + ngt_username: "username" + ngt_password: "password" + + - name: Install NGT in VM with reboot preference set to IMMEDIATE + ntnx_vms_ngt_v2: + state: present + ext_id: "{{ vm_uuid }}" + capabilities: + - VSS_SNAPSHOT + credential: + username: "{{ ngt_username }}" + password: "{{ ngt_password }}" + reboot_preference: + schedule_type: IMMEDIATE + register: result + ignore_errors: true + + - name: Fetch NGT config after installing NGT in VM with reboot preference set to IMMEDIATE + ntnx_vms_ngt_info_v2: + ext_id: "{{ vm_uuid }}" + register: result + ignore_errors: true + + - name: Update NGT in VM by disabling it and setting capabilities to VSS_SNAPSHOT + ntnx_vms_ngt_update_v2: + state: present + ext_id: "{{ vm_uuid }}" + is_enabled: false + capabilities: + - VSS_SNAPSHOT + register: result + ignore_errors: true + + - name: Upgrade NGT in VM + ntnx_vms_ngt_upgrade_v2: + state: present + ext_id: "{{ vm_uuid }}" + reboot_preference: + schedule_type: "SKIP" + register: result + ignore_errors: true + + - name: Insert ISO into CD ROM in VM + ntnx_vms_ngt_insert_iso_v2: + state: present + ext_id: "{{ vm_uuid }}" + capabilities: + - SELF_SERVICE_RESTORE + is_config_only: true + register: result + ignore_errors: true + + - name: Uninstall NGT in VM + ntnx_vms_ngt_v2: + state: absent + ext_id: "{{ vm_uuid }}" + register: result + ignore_errors: true diff --git a/examples/vmm_v2/vms_nics_v2.yml b/examples/vmm_v2/vms_nics_v2.yml new file mode 100644 index 00000000..14e9883d --- /dev/null +++ b/examples/vmm_v2/vms_nics_v2.yml @@ -0,0 +1,94 @@ +--- +# Summary: +# This playbook will do: +# 1. Create nic for a VM +# 2. Update nic for a VM +# 3. Migrate nic to another subnet +# 4. Retrieve nic info after migrating nic to another subnet +# 5. Assign IP address to nic +# 6. Release IP address from nic +# 7. Delete nic + +- name: VM nics playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + vm_uuid: "323e4567-8547-12d3-a456-426614174001" + subnet_uuid: "123e4567-e89b-12d3-a456-426614174000" + nic_ext_id: "123e4567-1324-12d3-a456-426614174002" + ip_address: "10.0.0.1" + + - name: Create nic + ntnx_vms_nics_v2: + vm_ext_id: "{{ vm_uuid }}" + state: present + network_info: + subnet: + ext_id: "{{ subnet_uuid }}" + register: result + ignore_errors: true + + - name: Update nic + ntnx_vms_nics_v2: + vm_ext_id: "{{ vm_uuid }}" + ext_id: "{{ nic_ext_id }}" + state: present + backing_info: + is_connected: false + register: result + ignore_errors: true + + - name: Migrate nic to another subnet - migrate type = ASSIGN_IP + ntnx_vms_nics_migrate_v2: + ext_id: "{{ nic_ext_id }}" + vm_ext_id: "{{ vm_uuid }}" + migrate_type: "ASSIGN_IP" + subnet: + ext_id: "{{ subnet_uuid }}" + ip_address: + value: "{{ ip_address }}" + register: result + ignore_errors: true + + - name: Retrieve nic info after migrating nic to another subnet + ntnx_vms_nics_info_v2: + ext_id: "{{ nic_ext_id }}" + vm_ext_id: "{{ vm_uuid }}" + register: result + ignore_errors: true + + - name: Assign IP address to nic + ntnx_vms_nics_ip_v2: + state: present + ext_id: "{{ nic_ext_id }}" + vm_ext_id: "{{ vm_uuid }}" + ip_address: + value: "{{ ip_address }}" + register: result + ignore_errors: true + + - name: Release IP address from nic + ntnx_vms_nics_ip_v2: + state: absent + ext_id: "{{ nic_ext_id }}" + vm_ext_id: "{{ vm_uuid }}" + ip_address: + value: "{{ ip_address }}" + register: result + ignore_errors: true + + - name: Delete nic + ntnx_vms_nics_v2: + vm_ext_id: "{{ vm_uuid }}" + ext_id: "{{ nic_ext_id }}" + state: absent + register: result + ignore_errors: true diff --git a/examples/vmm_v2/vms_serial_ports_v2.yml b/examples/vmm_v2/vms_serial_ports_v2.yml new file mode 100644 index 00000000..b64fbf2a --- /dev/null +++ b/examples/vmm_v2/vms_serial_ports_v2.yml @@ -0,0 +1,55 @@ +--- +# Summary: +# This playbook will do: +# 1. Create serial port for a VM +# 2. Get serial port details +# 3. Update serial port connection +# 4. Delete serial port + +- name: VM serial ports playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + vm_uuid: "323e4567-e89b-12d3-a456-426614174001" + subnet_uuid: "123e4567-e89b-12d3-a456-426614174000" + serial_port_uuid: "123e4567-1234-12d3-a456-426614174002" + + - name: Create Serial Port + ntnx_vms_serial_port_v2: + vm_ext_id: "{{ vm_uuid }}" + state: present + index: 0 + is_connected: true + register: result + ignore_errors: true + + - name: Fetch serial port information + ntnx_vms_serial_port_info_v2: + vm_ext_id: "{{ vm_uuid }}" + register: result + ignore_errors: true + + - name: Update Serial Port connection + ntnx_vms_serial_port_v2: + vm_ext_id: "{{ vm_uuid }}" + ext_id: "{{ serial_port_uuid }}" + state: present + is_connected: false + register: result + ignore_errors: true + + - name: Delete Serial Port + ntnx_vms_serial_port_v2: + vm_ext_id: "{{ vm_uuid }}" + ext_id: "{{ serial_port_uuid }}" + state: absent + register: result + ignore_errors: true diff --git a/examples/vmm_v2/vms_stage_guest_customization_v2.yml b/examples/vmm_v2/vms_stage_guest_customization_v2.yml new file mode 100644 index 00000000..4bbbc227 --- /dev/null +++ b/examples/vmm_v2/vms_stage_guest_customization_v2.yml @@ -0,0 +1,28 @@ +--- +# Summary: +# This playbook will update guest customization script for a VM + +- name: VM guest guest customization playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + vm_uuid: "323e4567-e89b-12d3-a456-426614174001" + + - name: Update guest script + ntnx_vms_stage_guest_customization_v2: + ext_id: "{{ vm_uuid }}" + config: + cloudinit: + datasource_type: CONFIG_DRIVE_V2 + cloud_init_script: + user_data: + value: I2Nsb3VkLWNvbmZpZwpkaXNhYmxlX3Jvb3Q6IGZhbHNlCnNzaF9wd2F1dGg6ICAgdHJ1ZQ== + register: result diff --git a/examples/vmm_v2/vms_templates_v2.yml b/examples/vmm_v2/vms_templates_v2.yml new file mode 100644 index 00000000..3f6dc79c --- /dev/null +++ b/examples/vmm_v2/vms_templates_v2.yml @@ -0,0 +1,121 @@ +--- +# Summary: +# This playbook will do: +# 1. Create new template from a vm +# 2. Fetch template info using ext id +# 3. Update template description & name +# 4. Retrieve the Template Version details for the given Template Version identifier. +# 5. Set the Active Version +# 6. Delete Template Version +# 7. Deploy VM +# 8. Initiate_guest_os_update +# 9. Finish guest_os_update +# 10. Delete Template + +- name: VM templates playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + vm_uuid: "323e4567-e89b-12d3-a456-426614174001" + template_name: "ansible_template" + template_ext_id: "00000000-0000-0000-0000-000000000000" + version_name: "ansible_template_version" + version_id: "00000000-0000-0000-0000-000000000000" + vm2_name: "ansible_template_vm" + cluster_uuid: "00062899-4a29-0cf9-0000-000000028f57" + + - name: Create new template from a vm + ntnx_templates_v2: + template_name: "{{ template_name }}" + template_description: ansible test + template_version_spec: + version_source: + template_vm_reference: + ext_id: "{{ vm_uuid }}" + register: result + ignore_errors: true + + - name: Fetch template info using ext id + ntnx_templates_info_v2: + ext_id: "{{ template_ext_id }}" + register: result + ignore_errors: true + + - name: Update template description & name + ntnx_templates_v2: + ext_id: "{{ template_ext_id }}" + template_version_spec: + version_name: "{{ version_name }}" + version_description: ansible_template_version_description New + version_source: + template_version_reference: + version_id: "{{ version_id }}" + override_vm_config: + num_sockets: 2 + num_cores_per_socket: 2 + num_threads_per_core: 2 + name: "{{ vm2_name }}" + register: result + ignore_errors: true + + - name: Retrieve the Template Version details for the given Template Version identifier. + ntnx_templates_versions_info_v2: + ext_id: "{{ version_id }}" + template_ext_id: "{{ template_ext_id }}" + register: result + ignore_errors: true + + - name: Set the Active Version + ntnx_templates_version_v2: + template_ext_id: "{{ template_ext_id }}" + version_id: "{{ version_id }}" + register: result + ignore_errors: true + + - name: Delete Template Version + ntnx_templates_version_v2: + state: absent + template_ext_id: "{{ template_ext_id }}" + version_id: "{{ version_id }}" + register: result + + - name: Deploy VM + ntnx_templates_deploy_v2: + ext_id: "{{ template_ext_id }}" + version_id: "{{ version_id }}" + cluster_reference: "{{ cluster_uuid }}" + register: result + ignore_errors: true + + - name: Initiate_guest_os_update + ntnx_templates_guest_os_v2: + template_ext_id: "{{ template_ext_id }}" + version_id: "{{ version_id }}" + state: start + register: result + ignore_errors: true + + - name: Finish guest_os_update + ntnx_templates_guest_os_v2: + template_ext_id: "{{ template_ext_id }}" + version_id: "{{ version_id }}" + state: finish + version_name: "{{ version_name }}" + version_description: finish guest os update + register: result + ignore_errors: true + + - name: Delete Template + ntnx_templates_v2: + state: absent + ext_id: "{{ template_ext_id }}" + register: result + ignore_errors: true diff --git a/examples/vmm_v2/vms_v2.yml b/examples/vmm_v2/vms_v2.yml new file mode 100644 index 00000000..639e961f --- /dev/null +++ b/examples/vmm_v2/vms_v2.yml @@ -0,0 +1,96 @@ +--- +# Summary: +# This playbook will do: +# 1. Create VM +# 2. Update VM +# 3. Fetch VM +# 4. Delete VM + +- name: VM crud playbook + hosts: localhost + gather_facts: false + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + tasks: + - name: Setting Variables + ansible.builtin.set_fact: + vm_name: "VM name" + cluster_uuid: "00062899-4a29-0cf9-0000-000000022f54" + vm_uuid: "a990cfaa-95a8-4861-bdf6-14060555442d" + + - name: Create VM + ntnx_vms_v2: + name: "{{ vm_name }}" + description: "vm description" + cluster: + ext_id: "{{ cluster_uuid }}" + num_sockets: 1 + num_cores_per_socket: 1 + num_threads_per_core: 1 + num_numa_nodes: 1 + memory_size_bytes: 4294967296 + is_vcpu_hard_pinning_enabled: false + is_cpu_passthrough_enabled: false + is_memory_overcommit_enabled: false + is_gpu_console_enabled: false + is_vga_console_enabled: false + machine_type: PC + hardware_clock_timezone: UTC + enabled_cpu_features: + - HARDWARE_VIRTUALIZATION + is_branding_enabled: false + is_agent_vm: false + apc_config: + is_apc_enabled: false + vtpm_config: + is_vtpm_enabled: false + register: result + ignore_errors: true + + - name: Update VM + ntnx_vms_v2: + state: present + ext_id: "{{ vm_uuid }}" + name: "{{ vm_name }}" + description: "vm description" + cluster: + ext_id: "{{ cluster_uuid }}" + num_sockets: 1 + num_cores_per_socket: 1 + num_threads_per_core: 1 + num_numa_nodes: 1 + memory_size_bytes: 4294967296 + is_vcpu_hard_pinning_enabled: false + is_cpu_passthrough_enabled: false + is_memory_overcommit_enabled: false + is_gpu_console_enabled: false + is_vga_console_enabled: false + machine_type: PC + hardware_clock_timezone: UTC + enabled_cpu_features: + - HARDWARE_VIRTUALIZATION + is_branding_enabled: false + is_agent_vm: false + apc_config: + is_apc_enabled: false + vtpm_config: + is_vtpm_enabled: false + register: result + ignore_errors: true + + - name: Fetch VM + ntnx_vms_info_v2.py: + ext_id: "{{ vm_uuid }}" + register: result + ignore_errors: true + + - name: Delete VM + ntnx_vms_v2: + state: absent + ext_id: "{{ vm_uuid }}" + register: result + ignore_errors: true From f3a4316f5b8189f58076ea9d4239de56ad671a63 Mon Sep 17 00:00:00 2001 From: George Ghawali Date: Sun, 15 Dec 2024 16:27:30 +0200 Subject: [PATCH 2/4] adding nutanix.ncp before modules names --- .../volume_groups_disks_v2.yml | 6 ++--- .../volume_groups_iscsi_clients_v2.yml | 8 +++--- .../Volume_groups_v2/volume_groups_v2.yml | 8 +++--- .../Volume_groups_v2/volume_groups_vms_v2.yml | 4 +-- examples/categories_v2/categories_v2.yml | 10 +++---- .../clusters_and_hosts_v2.yml | 26 +++++++++---------- .../clusters_nodes_v2.yml | 18 ++++++------- examples/iam_v2/authorization_policies_v2.yml | 12 ++++----- examples/iam_v2/directory_services_v2.yml | 12 ++++----- examples/iam_v2/operations_v2.yml | 4 +-- examples/iam_v2/roles_v2.yml | 10 +++---- examples/iam_v2/saml_identity_provider_v2.yml | 10 +++---- examples/iam_v2/user_groups_v2.yml | 10 +++---- examples/iam_v2/users_v2.yml | 16 ++++++------ examples/networks_v2/address_groups_v2.yml | 8 +++--- examples/networks_v2/floating_ip_v2.yml | 8 +++--- examples/networks_v2/pbrs_v2.yml | 8 +++--- examples/networks_v2/routes_v2.yml | 8 +++--- examples/networks_v2/security_rules_v2.yml | 8 +++--- examples/networks_v2/service_groups_v2.yml | 8 +++--- examples/networks_v2/subnets_v2 .yml | 10 +++---- examples/networks_v2/vpcs_v2.yml | 8 +++--- .../storage_container_v2.yml | 14 +++++----- examples/vmm_v2/vms_categories_v2.yml | 4 +-- examples/vmm_v2/vms_cd_rom_v2.yml | 10 +++---- examples/vmm_v2/vms_clone_v2 .yml | 4 +-- examples/vmm_v2/vms_disks_v2.yml | 16 ++++++------ examples/vmm_v2/vms_ngt_v2.yml | 12 ++++----- examples/vmm_v2/vms_nics_v2.yml | 14 +++++----- examples/vmm_v2/vms_serial_ports_v2.yml | 8 +++--- .../vms_stage_guest_customization_v2.yml | 2 +- examples/vmm_v2/vms_templates_v2.yml | 20 +++++++------- examples/vmm_v2/vms_v2.yml | 8 +++--- 33 files changed, 166 insertions(+), 166 deletions(-) diff --git a/examples/Volume_groups_v2/volume_groups_disks_v2.yml b/examples/Volume_groups_v2/volume_groups_disks_v2.yml index 53ed2a4c..e2daf7ef 100644 --- a/examples/Volume_groups_v2/volume_groups_disks_v2.yml +++ b/examples/Volume_groups_v2/volume_groups_disks_v2.yml @@ -24,7 +24,7 @@ uuid: "00000000-0000-0000-0000-000000000000" - name: Create disks - ntnx_volume_groups_disks_v2: + nutanix.ncp.ntnx_volume_groups_disks_v2: state: "present" volume_group_ext_id: "{{ vg1_uuid }}" disk_size_bytes: 21474836480 @@ -35,7 +35,7 @@ ignore_errors: true - name: Create disk from previously created vdisk - ntnx_volume_groups_disks_v2: + nutanix.ncp.ntnx_volume_groups_disks_v2: state: "present" volume_group_ext_id: "{{ vg1_uuid }}" index: 2 @@ -50,7 +50,7 @@ ignore_errors: true - name: Delete disk - ntnx_volume_groups_disks_v2: + nutanix.ncp.ntnx_volume_groups_disks_v2: state: absent volume_group_ext_id: "{{ vg1_uuid }}" ext_id: "{{ result.ext_id }}" diff --git a/examples/Volume_groups_v2/volume_groups_iscsi_clients_v2.yml b/examples/Volume_groups_v2/volume_groups_iscsi_clients_v2.yml index 89413073..8f4b3b5d 100644 --- a/examples/Volume_groups_v2/volume_groups_iscsi_clients_v2.yml +++ b/examples/Volume_groups_v2/volume_groups_iscsi_clients_v2.yml @@ -23,24 +23,24 @@ iscsi_client_uuid: "12345678-1b1b-1b1b-1b1b-1b1b1b1b1b1b1" - name: Attach iscsi client to VG using initiator name - ntnx_volume_groups_iscsi_clients_v2: + nutanix.ncp.ntnx_volume_groups_iscsi_clients_v2: volume_group_ext_id: "{{ vg1_uuid }}" iscsi_initiator_name: "{{ iscsi_client_name }}" num_virtual_targets: 32 register: result - name: List all clients attached to VG - ntnx_volume_groups_iscsi_clients_info_v2: + nutanix.ncp.ntnx_volume_groups_iscsi_clients_info_v2: volume_group_ext_id: "{{ vg1_uuid }}" register: result - name: Fetch specific client - ntnx_volume_groups_iscsi_clients_info_v2: + nutanix.ncp.ntnx_volume_groups_iscsi_clients_info_v2: ext_id: "{{ iscsi_client_uuid }}" register: result - name: Detach client from VG - ntnx_volume_groups_iscsi_clients_v2: + nutanix.ncp.ntnx_volume_groups_iscsi_clients_v2: volume_group_ext_id: "{{ vg1_uuid }}" ext_id: "{{ iscsi_client_uuid }}" state: absent diff --git a/examples/Volume_groups_v2/volume_groups_v2.yml b/examples/Volume_groups_v2/volume_groups_v2.yml index 3a8a2cfa..82612c47 100644 --- a/examples/Volume_groups_v2/volume_groups_v2.yml +++ b/examples/Volume_groups_v2/volume_groups_v2.yml @@ -23,7 +23,7 @@ vg1_uuid: "d1b1b3b1-1b1b-1b1b-1b1b-1b1b1b1b1b1b" - name: Create Volume group - ntnx_volume_groups_v2: + nutanix.ncp.ntnx_volume_groups_v2: name: "{{ name }}" description: "Volume group description" should_load_balance_vm_attachments: true @@ -41,19 +41,19 @@ ignore_errors: true - name: Fetch above created VG - ntnx_volume_groups_info_v2: + nutanix.ncp.ntnx_volume_groups_info_v2: ext_id: "{{ vg1_uuid }}" register: result ignore_errors: true - name: Fetch all VGs using filters - ntnx_volume_groups_info_v2: + nutanix.ncp.ntnx_volume_groups_info_v2: filter: "startswith(name, '{{name}}')" register: result ignore_errors: true - name: Delete Volume group - ntnx_volume_groups_v2: + nutanix.ncp.ntnx_volume_groups_v2: state: absent ext_id: "{{ vg1_uuid }}" register: result diff --git a/examples/Volume_groups_v2/volume_groups_vms_v2.yml b/examples/Volume_groups_v2/volume_groups_vms_v2.yml index 5f8b8b05..7efe386e 100644 --- a/examples/Volume_groups_v2/volume_groups_vms_v2.yml +++ b/examples/Volume_groups_v2/volume_groups_vms_v2.yml @@ -20,7 +20,7 @@ vm1_uuid: "a1b2c3d4-e5f6-7g8h-9i0j-k1l2m3n4o5p6" - name: Attach VM1 to VG - ntnx_volume_groups_vms_v2: + nutanix.ncp.ntnx_volume_groups_vms_v2: state: present volume_group_ext_id: "{{ vg1_uuid }}" ext_id: "{{ vm1_uuid }}" @@ -28,7 +28,7 @@ register: result - name: Detach VM1 from VG - ntnx_volume_groups_vms_v2: + nutanix.ncp.ntnx_volume_groups_vms_v2: state: absent volume_group_ext_id: "{{ vg1_uuid }}" ext_id: "{{ vm1_uuid }}" diff --git a/examples/categories_v2/categories_v2.yml b/examples/categories_v2/categories_v2.yml index fe5ee74e..6ac04509 100644 --- a/examples/categories_v2/categories_v2.yml +++ b/examples/categories_v2/categories_v2.yml @@ -25,7 +25,7 @@ category_ext_id: "11223344-1234-1111-2222-6788222f17b8" - name: Create category key & value - ntnx_categories_v2: + nutanix.ncp.ntnx_categories_v2: key: "{{key1}}" value: "{{value1}}" description: "ansible test" @@ -33,7 +33,7 @@ ignore_errors: true - name: Update category value and description - ntnx_categories_v2: + nutanix.ncp.ntnx_categories_v2: ext_id: "{{category_ext_id}}" key: "{{key1}}" value: "{{value2}}" @@ -42,19 +42,19 @@ ignore_errors: true - name: List all categories - ntnx_categories_info_v2: + nutanix.ncp.ntnx_categories_info_v2: register: result ignore_errors: true - name: Fetch category using ext id & expand detailedAssociations - ntnx_categories_info_v2: + nutanix.ncp.ntnx_categories_info_v2: ext_id: "{{category_ext_id}}" expand: detailedAssociations register: result ignore_errors: true - name: Delete Created category - ntnx_categories_v2: + nutanix.ncp.ntnx_categories_v2: ext_id: "{{category_ext_id}}" state: absent register: result diff --git a/examples/cluster_management_v2/clusters_and_hosts_v2.yml b/examples/cluster_management_v2/clusters_and_hosts_v2.yml index 8f2b1992..6969a3d1 100644 --- a/examples/cluster_management_v2/clusters_and_hosts_v2.yml +++ b/examples/cluster_management_v2/clusters_and_hosts_v2.yml @@ -64,7 +64,7 @@ # we use this to get prism central external ID to use it to register the cluster - name: List all clusters to get prism central external ID - ntnx_clusters_info_v2: + nutanix.ncp.ntnx_clusters_info_v2: filter: "config/clusterFunction/any(t:t eq Clustermgmt.Config.ClusterFunctionRef'PRISM_CENTRAL')" register: result ignore_errors: true @@ -76,7 +76,7 @@ # before creating cluster, we need to make sure that the cluster is not already created - name: Discover unconfigured node - ntnx_discover_unconfigured_nodes_v2: + nutanix.ncp.ntnx_discover_unconfigured_nodes_v2: address_type: "IPV4" ip_filter_list: - ipv4: @@ -85,7 +85,7 @@ ignore_errors: true - name: Run cluster create prechecks - ntnx_clusters_v2: + nutanix.ncp.ntnx_clusters_v2: name: "{{ clusters[0].name }}" nodes: node_list: @@ -138,7 +138,7 @@ ignore_errors: true - name: Create cluster - ntnx_clusters_v2: + nutanix.ncp.ntnx_clusters_v2: name: "{{ clusters[0].name }}" nodes: node_list: @@ -157,7 +157,7 @@ # here we register the cluster to prism central - name: Run PE PC registration - ntnx_pc_registration_v2: + nutanix.ncp.ntnx_pc_registration_v2: ext_id: "{{ prism_central_external_id }}" remote_cluster: aos_remote_cluster: @@ -173,19 +173,19 @@ ignore_errors: true - name: Fetch cluster using name - ntnx_clusters_info_v2: + nutanix.ncp.ntnx_clusters_info_v2: filter: name eq '{{ clusters[0].name }}' register: result ignore_errors: true - name: Fetch cluster info using external ID - ntnx_clusters_info_v2: + nutanix.ncp.ntnx_clusters_info_v2: ext_id: "{{ cluster_ext_id }}" register: result ignore_errors: true - name: Update ntp servers, dns servers and smtp servers in cluster - ntnx_clusters_v2: + nutanix.ncp.ntnx_clusters_v2: ext_id: "{{ cluster_ext_id }}" network: external_data_service_ip: @@ -212,31 +212,31 @@ ignore_errors: true - name: List all hosts - ntnx_hosts_info_v2: + nutanix.ncp.ntnx_hosts_info_v2: register: result ignore_errors: true - name: List all hosts using filter - ntnx_hosts_info_v2: + nutanix.ncp.ntnx_hosts_info_v2: filter: hostName eq '{{ host_name }}' register: result ignore_errors: true - name: Verify fetching host using external ID - ntnx_hosts_info_v2: + nutanix.ncp.ntnx_hosts_info_v2: ext_id: "{{ host_ext_id }}" cluster_ext_id: "{{ cluster_ext_id }}" register: result ignore_errors: true - name: Fetch hosts of particular cluster - ntnx_hosts_info_v2: + nutanix.ncp.ntnx_hosts_info_v2: cluster_ext_id: "{{ cluster_ext_id }}" register: result ignore_errors: true - name: Destroy the cluster - ntnx_clusters_v2: + nutanix.ncp.ntnx_clusters_v2: state: absent ext_id: "{{ cluster_ext_id }}" register: result diff --git a/examples/cluster_management_v2/clusters_nodes_v2.yml b/examples/cluster_management_v2/clusters_nodes_v2.yml index d4da3ffc..d94de0f4 100644 --- a/examples/cluster_management_v2/clusters_nodes_v2.yml +++ b/examples/cluster_management_v2/clusters_nodes_v2.yml @@ -64,7 +64,7 @@ # to expand cluster, we need to create one with three nodes - name: Create 3 nodes cluster with minimum spec - ntnx_clusters_v2: + nutanix.ncp.ntnx_clusters_v2: name: "{{ clusters[0].name }}" nodes: node_list: @@ -89,7 +89,7 @@ # we use this to get prism central external ID to use it to register the cluster - name: List all clusters to get prism central external ID - ntnx_clusters_info_v2: + nutanix.ncp.ntnx_clusters_info_v2: filter: "config/clusterFunction/any(t:t eq Clustermgmt.Config.ClusterFunctionRef'PRISM_CENTRAL')" register: result ignore_errors: true @@ -100,7 +100,7 @@ prism_central_external_id: "{{ result.response[0].ext_id }}" - name: Run PE PC registration - ntnx_pc_registration_v2: + nutanix.ncp.ntnx_pc_registration_v2: ext_id: "{{ prism_central_external_id }}" remote_cluster: aos_remote_cluster: @@ -117,7 +117,7 @@ # here we fetch the cluster using the name - name: Fetch cluster using name - ntnx_clusters_info_v2: + nutanix.ncp.ntnx_clusters_info_v2: filter: name eq '{{ cluster_name }}' register: result ignore_errors: true @@ -129,7 +129,7 @@ # here we discover the unconfigured node which we want to add to the cluster - name: Discover unconfigured node - ntnx_discover_unconfigured_nodes_v2: + nutanix.ncp.ntnx_discover_unconfigured_nodes_v2: cluster_ext_id: "{{ cluster_ext_id }}" address_type: "IPV4" ip_filter_list: @@ -140,7 +140,7 @@ # here we get the network info of the unconfigured node - name: Get network info of unconfigured node - ntnx_nodes_network_info_v2: + nutanix.ncp.ntnx_nodes_network_info_v2: cluster_ext_id: "{{ cluster_ext_id }}" node_list: - cvm_ip: @@ -155,7 +155,7 @@ # here we expand the cluster by adding the unconfigured node - name: Expand cluster by adding a node - ntnx_clusters_nodes_v2: + nutanix.ncp.ntnx_clusters_nodes_v2: cluster_ext_id: "{{ cluster_ext_id }}" node_params: node_list: @@ -209,7 +209,7 @@ # here we remove the node from the cluster - name: Remove node from cluster - ntnx_clusters_nodes_v2: + nutanix.ncp.ntnx_clusters_nodes_v2: state: absent cluster_ext_id: "{{ cluster_ext_id }}" node_uuids: @@ -218,7 +218,7 @@ ignore_errors: true - name: Destroy the cluster - ntnx_clusters_v2: + nutanix.ncp.ntnx_clusters_v2: state: absent ext_id: "{{ cluster_ext_id }}" register: result diff --git a/examples/iam_v2/authorization_policies_v2.yml b/examples/iam_v2/authorization_policies_v2.yml index e4fec461..6d3316dc 100644 --- a/examples/iam_v2/authorization_policies_v2.yml +++ b/examples/iam_v2/authorization_policies_v2.yml @@ -33,7 +33,7 @@ uuid: "12321232-0000-0909-0864-6788222f17b8" - name: Create auth policy - ntnx_authorization_policies_v2: + nutanix.ncp.ntnx_authorization_policies_v2: state: present display_name: "{{ auth_policy_name }}" description: ansible created acps @@ -64,7 +64,7 @@ ignore_errors: true - name: Update auth policy - ntnx_authorization_policies_v2: + nutanix.ncp.ntnx_authorization_policies_v2: state: present ext_id: "{{ policy_ext_id }}" entities: @@ -82,24 +82,24 @@ ignore_errors: true - name: Get all auth policies - ntnx_authorization_policies_info_v2: + nutanix.ncp.ntnx_authorization_policies_info_v2: register: result ignore_errors: true - name: Get specific auth policy - ntnx_authorization_policies_info_v2: + nutanix.ncp.ntnx_authorization_policies_info_v2: ext_id: "{{ policy_ext_id }}" register: result ignore_errors: true - name: Fetch using filters - ntnx_authorization_policies_info_v2: + nutanix.ncp.ntnx_authorization_policies_info_v2: filter: displayName eq '{{ auth_policy_name }}' register: result ignore_errors: true - name: Delete created auth policy - ntnx_authorization_policies_v2: + nutanix.ncp.ntnx_authorization_policies_v2: state: absent ext_id: "{{ policy_ext_id }}" register: result diff --git a/examples/iam_v2/directory_services_v2.yml b/examples/iam_v2/directory_services_v2.yml index 0adbb5e0..7a8e3534 100644 --- a/examples/iam_v2/directory_services_v2.yml +++ b/examples/iam_v2/directory_services_v2.yml @@ -35,7 +35,7 @@ directory_service_ext_id: "12345678-1234-1234-1234-123456789012" - name: Create ACTIVE_DIRECTORY service - ntnx_directory_services_v2: + nutanix.ncp.ntnx_directory_services_v2: state: present name: "{{ name }}" url: "{{ url }}" @@ -50,7 +50,7 @@ ignore_errors: true - name: Update directory service - ntnx_directory_services_v2: + nutanix.ncp.ntnx_directory_services_v2: state: present ext_id: "{{ directory_service_ext_id }}" name: "{{ name }}_updated" @@ -67,24 +67,24 @@ ignore_errors: true - name: Fetch directory service info using ext id - ntnx_directory_services_info_v2: + nutanix.ncp.ntnx_directory_services_info_v2: ext_id: "{{ directory_service_ext_id }}" register: result ignore_errors: true - name: List all directory services - ntnx_directory_services_info_v2: + nutanix.ncp.ntnx_directory_services_info_v2: register: result ignore_errors: true - name: List all directory services with filter - ntnx_directory_services_info_v2: + nutanix.ncp.ntnx_directory_services_info_v2: filter: name eq '{{ name }}' register: result ignore_errors: true - name: Delete directory service - ntnx_directory_services_v2: + nutanix.ncp.ntnx_directory_services_v2: state: absent ext_id: "{{ directory_service_ext_id }}" register: result diff --git a/examples/iam_v2/operations_v2.yml b/examples/iam_v2/operations_v2.yml index 8ba0f8c5..728362fc 100644 --- a/examples/iam_v2/operations_v2.yml +++ b/examples/iam_v2/operations_v2.yml @@ -19,12 +19,12 @@ test_permission_uuid: 00000000-0000-0000-0000-000000000001 - name: List all operations - ntnx_operations_info_v2: + nutanix.ncp.ntnx_operations_info_v2: register: result ignore_errors: true - name: List permission using ext_id criteria - ntnx_operations_info_v2: + nutanix.ncp.ntnx_operations_info_v2: ext_id: "{{ test_permission_uuid }}" register: result ignore_errors: true diff --git a/examples/iam_v2/roles_v2.yml b/examples/iam_v2/roles_v2.yml index f3acfd74..16e35755 100644 --- a/examples/iam_v2/roles_v2.yml +++ b/examples/iam_v2/roles_v2.yml @@ -26,7 +26,7 @@ role_uuid: 00000000-0000-0000-0000-000000000003 - name: Create roles with operations - ntnx_roles_v2: + nutanix.ncp.ntnx_roles_v2: state: present display_name: "{{ role_name }}" description: test-ansible-role-1-desc @@ -38,7 +38,7 @@ ignore_errors: true - name: Update roles in check mode - ntnx_roles_v2: + nutanix.ncp.ntnx_roles_v2: state: present ext_id: "{{ role_uuid }}" display_name: "{{ role_name_updated }}" @@ -51,18 +51,18 @@ ignore_errors: true - name: List all roles - ntnx_roles_info_v2: + nutanix.ncp.ntnx_roles_info_v2: register: result ignore_errors: true - name: Fetch role using external ID - ntnx_roles_info_v2: + nutanix.ncp.ntnx_roles_info_v2: ext_id: "{{ role_uuid }}" register: result ignore_errors: true - name: Delete role - ntnx_roles_v2: + nutanix.ncp.ntnx_roles_v2: state: absent ext_id: "{{ role_uuid }}" register: result diff --git a/examples/iam_v2/saml_identity_provider_v2.yml b/examples/iam_v2/saml_identity_provider_v2.yml index 07c4b3ad..e8b0ad8a 100644 --- a/examples/iam_v2/saml_identity_provider_v2.yml +++ b/examples/iam_v2/saml_identity_provider_v2.yml @@ -26,7 +26,7 @@ saml_ext_id: "33425890-8888-9999-5555-6788222f17b8" - name: Create saml - ntnx_saml_identity_providers_v2: + nutanix.ncp.ntnx_saml_identity_providers_v2: name: "{{ name }}" username_attribute: "{{ username_attribute }}1" email_attribute: email @@ -38,13 +38,13 @@ ignore_errors: true - name: Get saml using filter name - ntnx_saml_identity_providers_info_v2: + nutanix.ncp.ntnx_saml_identity_providers_info_v2: filter: name eq '{{ name }}' register: result ignore_errors: true - name: Update saml - ntnx_saml_identity_providers_v2: + nutanix.ncp.ntnx_saml_identity_providers_v2: state: present ext_id: "{{ saml_ext_id }}" name: "{{ name }}2" @@ -57,12 +57,12 @@ ignore_errors: true - name: List all identity providers - ntnx_saml_identity_providers_info_v2: + nutanix.ncp.ntnx_saml_identity_providers_info_v2: register: result ignore_errors: true - name: Delete the created SAML identity providers - ntnx_saml_identity_providers_v2: + nutanix.ncp.ntnx_saml_identity_providers_v2: state: absent ext_id: "{{ saml_ext_id }}" register: result diff --git a/examples/iam_v2/user_groups_v2.yml b/examples/iam_v2/user_groups_v2.yml index 3ebf990a..14cfe66a 100644 --- a/examples/iam_v2/user_groups_v2.yml +++ b/examples/iam_v2/user_groups_v2.yml @@ -26,13 +26,13 @@ user_group_ext_id: "e2dee03b-1234-1111-2222-6788222f17b8" - name: Create LDAP user group - ntnx_user_groups_v2: + nutanix.ncp.ntnx_user_groups_v2: group_type: LDAP distinguished_name: "{{ distinguished_name }}" idp_id: "{{ directory_service_uuid }}" - name: Create SAML user group - ntnx_user_groups_v2: + nutanix.ncp.ntnx_user_groups_v2: group_type: SAML idp_id: "{{ identity_provider_uuid }}" name: "{{ new_saml_user_group }}" @@ -40,18 +40,18 @@ ignore_errors: true - name: List all user groups - ntnx_user_groups_info_v2: + nutanix.ncp.ntnx_user_groups_info_v2: register: user_groups ignore_errors: true - name: List user groups using filter criteria - ntnx_user_groups_info_v2: + nutanix.ncp.ntnx_user_groups_info_v2: filter: name eq '{{ new_saml_user_group }}' register: result ignore_errors: true - name: Delete created user group - ntnx_user_groups_v2: + nutanix.ncp.ntnx_user_groups_v2: state: absent ext_id: "{{ user_group_ext_id }}" register: result diff --git a/examples/iam_v2/users_v2.yml b/examples/iam_v2/users_v2.yml index 2c8a3637..efe6d511 100644 --- a/examples/iam_v2/users_v2.yml +++ b/examples/iam_v2/users_v2.yml @@ -34,7 +34,7 @@ user_ext_id: 00000000-0000-0000-0000-000000000003 - name: Create active local user - ntnx_users_v2: + nutanix.ncp.ntnx_users_v2: user_type: LOCAL username: "{{ username }}" first_name: "{{ first_name }}" @@ -50,7 +50,7 @@ ignore_errors: true - name: Create SAML user - ntnx_users_v2: + nutanix.ncp.ntnx_users_v2: user_type: SAML username: "{{ username }}" idp_id: "{{ identity_provider_uuid }}" @@ -58,7 +58,7 @@ ignore_errors: true - name: Create LDAP user - ntnx_users_v2: + nutanix.ncp.ntnx_users_v2: user_type: LDAP username: "{{ new_user }}" idp_id: "{{ directory_service_uuid }}" @@ -66,7 +66,7 @@ ignore_errors: true - name: Update local user - ntnx_users_v2: + nutanix.ncp.ntnx_users_v2: ext_id: "{{ user_ext_id }}" first_name: "{{ first_name }}_updated" last_name: "{{ last_name }}_updated" @@ -79,24 +79,24 @@ ignore_errors: true - name: List all users - ntnx_users_info_v2: + nutanix.ncp.ntnx_users_info_v2: register: users ignore_errors: true - name: Fetch user info using user ext_id criteria - ntnx_users_info_v2: + nutanix.ncp.ntnx_users_info_v2: ext_id: "{{ user_ext_id }}" register: result ignore_errors: true - name: List users with specific username - ntnx_users_info_v2: + nutanix.ncp.ntnx_users_info_v2: filter: username eq '{{ username }}' register: result ignore_errors: true - name: Delete created user - ntnx_users: + nutanix.ncp.ntnx_users: state: absent user_uuid: "{{ user_ext_id }}" register: result diff --git a/examples/networks_v2/address_groups_v2.yml b/examples/networks_v2/address_groups_v2.yml index 96660e0c..ebfd0cbe 100644 --- a/examples/networks_v2/address_groups_v2.yml +++ b/examples/networks_v2/address_groups_v2.yml @@ -27,7 +27,7 @@ prefix_length: 24 - name: Create address group - ntnx_address_groups_v2: + nutanix.ncp.ntnx_address_groups_v2: state: present name: "{{ address_group_name }}" description: address group description @@ -40,7 +40,7 @@ ignore_errors: true - name: Update address group with the given uuid - ntnx_address_groups_v2: + nutanix.ncp.ntnx_address_groups_v2: state: present ext_id: "{{ address_group_uuid }}" name: "{{ address_group_name }}_updated" @@ -52,13 +52,13 @@ ignore_errors: true - name: Fetch address group info - ntnx_address_groups_info_v2: + nutanix.ncp.ntnx_address_groups_info_v2: ext_id: "{{ address_group_uuid }}" register: result ignore_errors: true - name: Delete address group - ntnx_address_groups_v2: + nutanix.ncp.ntnx_address_groups_v2: state: absent ext_id: "{{ address_group_uuid }}" register: result diff --git a/examples/networks_v2/floating_ip_v2.yml b/examples/networks_v2/floating_ip_v2.yml index efc81396..bab7d2d0 100644 --- a/examples/networks_v2/floating_ip_v2.yml +++ b/examples/networks_v2/floating_ip_v2.yml @@ -29,7 +29,7 @@ vpc_uuid: "2dff5b0a-2368-3456-1236-d42439a8b6e5" - name: Create floating ip with external subnet uuid - ntnx_floating_ips_v2: + nutanix.ncp.ntnx_floating_ips_v2: state: present name: "{{ floating_ip_name }}" external_subnet_reference: "{{ external_nat_subnet_uuid }}" @@ -45,7 +45,7 @@ ignore_errors: true - name: Update floating ip name and private IP - ntnx_floating_ips_v2: + nutanix.ncp.ntnx_floating_ips_v2: state: present name: "{{ floating_ip_name }}_updated" ext_id: "{{ floating_ip_ext_id }}" @@ -59,13 +59,13 @@ ignore_errors: true - name: Get floating_ips using ext_id - ntnx_floating_ips_info_v2: + nutanix.ncp.ntnx_floating_ips_info_v2: ext_id: "{{ floating_ip_ext_id }}" register: result ignore_errors: true - name: Delete floating ip - ntnx_floating_ips_v2: + nutanix.ncp.ntnx_floating_ips_v2: state: absent ext_id: "{{ floating_ip_ext_id }}" register: result diff --git a/examples/networks_v2/pbrs_v2.yml b/examples/networks_v2/pbrs_v2.yml index 35b7b778..850434e1 100644 --- a/examples/networks_v2/pbrs_v2.yml +++ b/examples/networks_v2/pbrs_v2.yml @@ -27,7 +27,7 @@ prefix: 24 - name: Create PBR with vpc , source network, external destination, with PERMIT action and icmp - ntnx_pbrs_v2: + nutanix.ncp.ntnx_pbrs_v2: state: present name: "{{ pbr_name }}" priority: "{{ priority }}" @@ -55,7 +55,7 @@ ignore_errors: true - name: Update PBR name ,description, priority - ntnx_pbrs_v2: + nutanix.ncp.ntnx_pbrs_v2: state: present ext_id: "{{ pbr_uuid }}" priority: 3 @@ -65,13 +65,13 @@ ignore_errors: true - name: Fetch PBR details - ntnx_pbrs_info_v2: + nutanix.ncp.ntnx_pbrs_info_v2: ext_id: "{{ pbr_uuid }}" register: result ignore_errors: true - name: Delete PBR - ntnx_pbrs_v2: + nutanix.ncp.ntnx_pbrs_v2: state: absent ext_id: "{{ pbr_uuid }}" register: result diff --git a/examples/networks_v2/routes_v2.yml b/examples/networks_v2/routes_v2.yml index 5ba06e62..62a4738e 100644 --- a/examples/networks_v2/routes_v2.yml +++ b/examples/networks_v2/routes_v2.yml @@ -29,7 +29,7 @@ ip2: "10.0.0.2" - name: Create static route - ntnx_routes_v2: + nutanix.ncp.ntnx_routes_v2: state: present name: "{{ route_name }}" description: "Route for testing" @@ -51,7 +51,7 @@ ignore_errors: true - name: Update route - ntnx_routes_v2: + nutanix.ncp.ntnx_routes_v2: state: present name: "{{ route_name }}_updated" description: "Route for testing updated" @@ -68,14 +68,14 @@ ignore_errors: true - name: Fetch route by external ID - ntnx_routes_info_v2: + nutanix.ncp.ntnx_routes_info_v2: ext_id: "{{ route_uuid }}" route_table_ext_id: "{{ route_table_external_id }}" register: result ignore_errors: true - name: Delete static route - ntnx_routes_v2: + nutanix.ncp.ntnx_routes_v2: state: absent ext_id: "{{ route_uuid }}" route_table_ext_id: "{{ route_table_external_id }}" diff --git a/examples/networks_v2/security_rules_v2.yml b/examples/networks_v2/security_rules_v2.yml index 357d29a4..55494554 100644 --- a/examples/networks_v2/security_rules_v2.yml +++ b/examples/networks_v2/security_rules_v2.yml @@ -29,7 +29,7 @@ category4: "22113344-9632-8520-4455-365478214587" - name: Create basic application security rule for certain VPC scope with intra group traffic not allowed - ntnx_security_rules_v2: + nutanix.ncp.ntnx_security_rules_v2: name: "{{ security_rule_name }}" description: Ansible created rule type: APPLICATION @@ -69,7 +69,7 @@ register: result - name: Update policy rules and config - ntnx_security_rules_v2: + nutanix.ncp.ntnx_security_rules_v2: ext_id: "{{ security_rule_uuid }}" name: "{{ security_rule_name }}_updated" description: Ansible updated rule @@ -156,12 +156,12 @@ register: result - name: Fetch security rule info - ntnx_security_rules_info_v2: + nutanix.ncp.ntnx_security_rules_info_v2: ext_id: "{{ security_rule_uuid }}" register: result - name: Delete security rule - ntnx_security_rules_v2: + nutanix.ncp.ntnx_security_rules_v2: state: absent ext_id: "{{ security_rule_uuid }}" register: result diff --git a/examples/networks_v2/service_groups_v2.yml b/examples/networks_v2/service_groups_v2.yml index f0bc30e6..1002a448 100644 --- a/examples/networks_v2/service_groups_v2.yml +++ b/examples/networks_v2/service_groups_v2.yml @@ -34,7 +34,7 @@ service_group_uuid: "7c62834e-43f0-4c20-a5d4-cbf36b9a142b" - name: Create tcp service group - ntnx_service_groups_v2: + nutanix.ncp.ntnx_service_groups_v2: name: "{{ service_group_name }}" description: "service group description" tcp_services: @@ -50,7 +50,7 @@ ignore_errors: true - name: Update tcp service group name and description and other protocols - ntnx_service_groups_v2: + nutanix.ncp.ntnx_service_groups_v2: ext_id: "{{ service_group_uuid }}" name: "{{ service_group_name }}_updated" description: "service group description updated" @@ -64,13 +64,13 @@ ignore_errors: true - name: Getting particular service_group using uuid - ntnx_service_groups_info_v2: + nutanix.ncp.ntnx_service_groups_info_v2: ext_id: "{{ service_group_uuid }}" register: result ignore_errors: true - name: Delete service group - ntnx_service_groups_v2: + nutanix.ncp.ntnx_service_groups_v2: state: absent ext_id: "{{ service_group_uuid }}" register: result diff --git a/examples/networks_v2/subnets_v2 .yml b/examples/networks_v2/subnets_v2 .yml index a6ce9aed..0e5326e8 100644 --- a/examples/networks_v2/subnets_v2 .yml +++ b/examples/networks_v2/subnets_v2 .yml @@ -37,7 +37,7 @@ end_address_2: "10.0.0.7" - name: Create VLAN subnet without IPAM - ntnx_subnets_v2: + nutanix.ncp.ntnx_subnets_v2: state: present wait: true name: "{{ subnet_name }}" @@ -49,7 +49,7 @@ ignore_errors: true - name: Update VLAN subnet name and IP pools - ntnx_subnets_v2: + nutanix.ncp.ntnx_subnets_v2: state: present name: "{{ subnet_name }}" ext_id: "{{ subnet_uuid }}" @@ -76,13 +76,13 @@ ignore_errors: true - name: Get subnet using ext_id - ntnx_subnets_info_v2: + nutanix.ncp.ntnx_subnets_info_v2: ext_id: "{{ subnet_uuid }}" register: result ignore_errors: true - name: Create Overlay Subnet with minimum requirements - ntnx_subnets_v2: + nutanix.ncp.ntnx_subnets_v2: state: present name: "{{ subnet_name }}" subnet_type: OVERLAY @@ -99,7 +99,7 @@ ignore_errors: true - name: Delete subnet - ntnx_subnets_v2: + nutanix.ncp.ntnx_subnets_v2: state: absent ext_id: "{{ subnet_uuid }}" register: result diff --git a/examples/networks_v2/vpcs_v2.yml b/examples/networks_v2/vpcs_v2.yml index 6876c508..a28d1c38 100644 --- a/examples/networks_v2/vpcs_v2.yml +++ b/examples/networks_v2/vpcs_v2.yml @@ -23,7 +23,7 @@ external_nat_subnet_uuid: "d7419d65-100e-4c99-a666-ec1431516bbe" - name: Create min VPC with external_nat_subnet uuid - ntnx_vpcs_v2: + nutanix.ncp.ntnx_vpcs_v2: state: present wait: true name: "{{vpc_name}}" @@ -32,7 +32,7 @@ register: result - name: Update vpc name - ntnx_vpcs_v2: + nutanix.ncp.ntnx_vpcs_v2: state: present ext_id: "{{vpc_uuid}}" name: "{{vpc_name}}_updated" @@ -40,13 +40,13 @@ ignore_errors: true - name: Fetch VPC info - ntnx_vpcs_info_v2: + nutanix.ncp.ntnx_vpcs_info_v2: ext_id: "{{vpc_uuid}}" register: result ignore_errors: true - name: Delete VPC - ntnx_vpcs_v2: + nutanix.ncp.ntnx_vpcs_v2: state: absent ext_id: "{{vpc_uuid}}" register: result diff --git a/examples/storage_container_v2/storage_container_v2.yml b/examples/storage_container_v2/storage_container_v2.yml index 1fcb70ce..4b741ad3 100644 --- a/examples/storage_container_v2/storage_container_v2.yml +++ b/examples/storage_container_v2/storage_container_v2.yml @@ -42,7 +42,7 @@ changed_when: false - name: Create storage container - ntnx_storage_containers_v2: + nutanix.ncp.ntnx_storage_containers_v2: name: "{{ storage_container_name }}" cluster_ext_id: "{{ cluster_ext_id }}" owner_ext_id: "{{ owner_uuid }}" @@ -62,7 +62,7 @@ ignore_errors: true - name: Update storage container - ntnx_storage_containers_v2: + nutanix.ncp.ntnx_storage_containers_v2: state: present ext_id: "{{ storage_container_ext_id }}" name: "{{ storage_container_name }}_updated" @@ -77,13 +77,13 @@ ignore_errors: true - name: Fetch storage container configurations - ntnx_storage_containers_info_v2: + nutanix.ncp.ntnx_storage_containers_info_v2: ext_id: "{{ storage_container_ext_id }}" register: result ignore_errors: true - name: Fetch storage container stats - ntnx_storage_containers_stats_v2: + nutanix.ncp.ntnx_storage_containers_stats_v2: ext_id: "{{ storage_container_ext_id }}" start_time: "{{ start_time.stdout }}" end_time: "{{ end_time.stdout }}" @@ -91,7 +91,7 @@ ignore_errors: true - name: Fetch storage container stats with interval defined - ntnx_storage_containers_stats_v2: + nutanix.ncp.ntnx_storage_containers_stats_v2: ext_id: "{{ storage_container_ext_id }}" start_time: "{{ start_time.stdout }}" end_time: "{{ end_time.stdout }}" @@ -101,12 +101,12 @@ ignore_errors: true - name: Fetch all storage containers - ntnx_storage_containers_info_v2: + nutanix.ncp.ntnx_storage_containers_info_v2: register: result ignore_errors: true - name: Delete storage container - ntnx_storage_containers_v2: + nutanix.ncp.ntnx_storage_containers_v2: state: absent ext_id: "{{ storage_container_ext_id }}" ignore_small_files: true diff --git a/examples/vmm_v2/vms_categories_v2.yml b/examples/vmm_v2/vms_categories_v2.yml index bd4673c9..2cab37ee 100644 --- a/examples/vmm_v2/vms_categories_v2.yml +++ b/examples/vmm_v2/vms_categories_v2.yml @@ -20,7 +20,7 @@ category_ext_id: "d7419d65-100e-4c99-a666-ec1431516bbe" - name: Associate category to VM - ntnx_vms_categories_v2: + nutanix.ncp.ntnx_vms_categories_v2: state: present vm_ext_id: "{{ vm_uuid }}" categories: @@ -29,7 +29,7 @@ ignore_errors: true - name: Disassociate category from VM - ntnx_vms_categories_v2: + nutanix.ncp.ntnx_vms_categories_v2: state: absent vm_ext_id: "{{ vm_uuid }}" categories: diff --git a/examples/vmm_v2/vms_cd_rom_v2.yml b/examples/vmm_v2/vms_cd_rom_v2.yml index 34e9c140..3594062d 100644 --- a/examples/vmm_v2/vms_cd_rom_v2.yml +++ b/examples/vmm_v2/vms_cd_rom_v2.yml @@ -25,7 +25,7 @@ cd_rom_ext_id: "d7419d65-7896-3544-4545-ec1431516bbe" - name: Create CD ROM with all attributes - ntnx_vms_cd_rom_v2: + nutanix.ncp.ntnx_vms_cd_rom_v2: state: present vm_ext_id: "{{ vm_uuid }}" disk_address: @@ -40,7 +40,7 @@ ignore_errors: true - name: Inject ISO in CD ROM of a VM - ntnx_vms_cd_rom_iso_v2: + nutanix.ncp.ntnx_vms_cd_rom_iso_v2: state: present vm_ext_id: "{{ vm_uuid }}" ext_id: "{{ cd_rom_ext_id }}" @@ -53,14 +53,14 @@ ignore_errors: true - name: Get CD ROM details - ntnx_vms_cd_rom_info_v2: + nutanix.ncp.ntnx_vms_cd_rom_info_v2: vm_ext_id: "{{ vm_uuid }}" ext_id: "{{ cd_rom_ext_id }}" register: result ignore_errors: true - name: Eject ISO from CD ROM of a VM - ntnx_vms_cd_rom_iso_v2: + nutanix.ncp.ntnx_vms_cd_rom_iso_v2: state: absent vm_ext_id: "{{ vm_uuid }}" ext_id: "{{ cd_rom_ext_id }}" @@ -73,7 +73,7 @@ ignore_errors: true - name: Delete CD ROM - ntnx_vms_cd_rom_v2: + nutanix.ncp.ntnx_vms_cd_rom_v2: state: absent vm_ext_id: "{{ vm_uuid }}" ext_id: "{{ cd_rom_ext_id }}" diff --git a/examples/vmm_v2/vms_clone_v2 .yml b/examples/vmm_v2/vms_clone_v2 .yml index 1b78b58d..a1a6a307 100644 --- a/examples/vmm_v2/vms_clone_v2 .yml +++ b/examples/vmm_v2/vms_clone_v2 .yml @@ -19,14 +19,14 @@ vm_uuid: "a990cfaa-95a8-4861-bdf6-14060555442d" - name: Clone VM with same attributes values - ntnx_vms_clone_v2: + nutanix.ncp.ntnx_vms_clone_v2: ext_id: "{{ vm_uuid }}" name: "integration_test_vm_clone1" register: result ignore_errors: true - name: Clone VM with different attributes values - ntnx_vms_clone_v2: + nutanix.ncp.ntnx_vms_clone_v2: ext_id: "{{ vm_uuid }}" name: "integration_test_vm_clone2" num_sockets: 2 diff --git a/examples/vmm_v2/vms_disks_v2.yml b/examples/vmm_v2/vms_disks_v2.yml index 98af2849..f86d00ee 100644 --- a/examples/vmm_v2/vms_disks_v2.yml +++ b/examples/vmm_v2/vms_disks_v2.yml @@ -31,7 +31,7 @@ volume_group_uuid: "723e4567-e89b-12d3-a456-426614174005" - name: Create Disk with storage container - ntnx_vms_disks_v2: + nutanix.ncp.ntnx_vms_disks_v2: vm_ext_id: "{{ vm_uuid }}" backing_info: vm_disk: @@ -46,7 +46,7 @@ ignore_errors: true - name: Create Disk with image reference - ntnx_vms_disks_v2: + nutanix.ncp.ntnx_vms_disks_v2: vm_ext_id: "{{ vm_uuid }}" backing_info: vm_disk: @@ -65,7 +65,7 @@ ignore_errors: true - name: Create Disk with disk reference - ntnx_vms_disks_v2: + nutanix.ncp.ntnx_vms_disks_v2: vm_ext_id: "{{ vm_uuid }}" backing_info: vm_disk: @@ -87,7 +87,7 @@ ignore_errors: true - name: Create disk from volume group disk - ntnx_volume_groups_disks_v2: + nutanix.ncp.ntnx_volume_groups_disks_v2: state: "present" volume_group_ext_id: "{{ volume_group_uuid }}" index: 6 @@ -100,7 +100,7 @@ ignore_errors: true - name: Create Disk with VG reference - ntnx_vms_disks_v2: + nutanix.ncp.ntnx_vms_disks_v2: vm_ext_id: "{{ vm_uuid }}" backing_info: adsf_volume_group: @@ -113,7 +113,7 @@ ignore_errors: true - name: Update disk data source - ntnx_vms_disks_v2: + nutanix.ncp.ntnx_vms_disks_v2: vm_ext_id: "{{ vm_uuid }}" ext_id: "{{ disk_uuid }}" backing_info: @@ -129,14 +129,14 @@ ignore_errors: true - name: Get disk info - ntnx_vms_disks_info_v2: + nutanix.ncp.ntnx_vms_disks_info_v2: vm_ext_id: "{{ vm_uuid }}" ext_id: "{{ disk_uuid }}" register: result ignore_errors: true - name: Delete disk - ntnx_vms_disks_v2: + nutanix.ncp.ntnx_vms_disks_v2: vm_ext_id: "{{ vm_uuid }}" ext_id: "{{ disk_uuid }}" state: absent diff --git a/examples/vmm_v2/vms_ngt_v2.yml b/examples/vmm_v2/vms_ngt_v2.yml index 3505db8e..5ae4d3e3 100644 --- a/examples/vmm_v2/vms_ngt_v2.yml +++ b/examples/vmm_v2/vms_ngt_v2.yml @@ -25,7 +25,7 @@ ngt_password: "password" - name: Install NGT in VM with reboot preference set to IMMEDIATE - ntnx_vms_ngt_v2: + nutanix.ncp.ntnx_vms_ngt_v2: state: present ext_id: "{{ vm_uuid }}" capabilities: @@ -39,13 +39,13 @@ ignore_errors: true - name: Fetch NGT config after installing NGT in VM with reboot preference set to IMMEDIATE - ntnx_vms_ngt_info_v2: + nutanix.ncp.ntnx_vms_ngt_info_v2: ext_id: "{{ vm_uuid }}" register: result ignore_errors: true - name: Update NGT in VM by disabling it and setting capabilities to VSS_SNAPSHOT - ntnx_vms_ngt_update_v2: + nutanix.ncp.ntnx_vms_ngt_update_v2: state: present ext_id: "{{ vm_uuid }}" is_enabled: false @@ -55,7 +55,7 @@ ignore_errors: true - name: Upgrade NGT in VM - ntnx_vms_ngt_upgrade_v2: + nutanix.ncp.ntnx_vms_ngt_upgrade_v2: state: present ext_id: "{{ vm_uuid }}" reboot_preference: @@ -64,7 +64,7 @@ ignore_errors: true - name: Insert ISO into CD ROM in VM - ntnx_vms_ngt_insert_iso_v2: + nutanix.ncp.ntnx_vms_ngt_insert_iso_v2: state: present ext_id: "{{ vm_uuid }}" capabilities: @@ -74,7 +74,7 @@ ignore_errors: true - name: Uninstall NGT in VM - ntnx_vms_ngt_v2: + nutanix.ncp.ntnx_vms_ngt_v2: state: absent ext_id: "{{ vm_uuid }}" register: result diff --git a/examples/vmm_v2/vms_nics_v2.yml b/examples/vmm_v2/vms_nics_v2.yml index 14e9883d..3dd8ba13 100644 --- a/examples/vmm_v2/vms_nics_v2.yml +++ b/examples/vmm_v2/vms_nics_v2.yml @@ -27,7 +27,7 @@ ip_address: "10.0.0.1" - name: Create nic - ntnx_vms_nics_v2: + nutanix.ncp.ntnx_vms_nics_v2: vm_ext_id: "{{ vm_uuid }}" state: present network_info: @@ -37,7 +37,7 @@ ignore_errors: true - name: Update nic - ntnx_vms_nics_v2: + nutanix.ncp.ntnx_vms_nics_v2: vm_ext_id: "{{ vm_uuid }}" ext_id: "{{ nic_ext_id }}" state: present @@ -47,7 +47,7 @@ ignore_errors: true - name: Migrate nic to another subnet - migrate type = ASSIGN_IP - ntnx_vms_nics_migrate_v2: + nutanix.ncp.ntnx_vms_nics_migrate_v2: ext_id: "{{ nic_ext_id }}" vm_ext_id: "{{ vm_uuid }}" migrate_type: "ASSIGN_IP" @@ -59,14 +59,14 @@ ignore_errors: true - name: Retrieve nic info after migrating nic to another subnet - ntnx_vms_nics_info_v2: + nutanix.ncp.ntnx_vms_nics_info_v2: ext_id: "{{ nic_ext_id }}" vm_ext_id: "{{ vm_uuid }}" register: result ignore_errors: true - name: Assign IP address to nic - ntnx_vms_nics_ip_v2: + nutanix.ncp.ntnx_vms_nics_ip_v2: state: present ext_id: "{{ nic_ext_id }}" vm_ext_id: "{{ vm_uuid }}" @@ -76,7 +76,7 @@ ignore_errors: true - name: Release IP address from nic - ntnx_vms_nics_ip_v2: + nutanix.ncp.ntnx_vms_nics_ip_v2: state: absent ext_id: "{{ nic_ext_id }}" vm_ext_id: "{{ vm_uuid }}" @@ -86,7 +86,7 @@ ignore_errors: true - name: Delete nic - ntnx_vms_nics_v2: + nutanix.ncp.ntnx_vms_nics_v2: vm_ext_id: "{{ vm_uuid }}" ext_id: "{{ nic_ext_id }}" state: absent diff --git a/examples/vmm_v2/vms_serial_ports_v2.yml b/examples/vmm_v2/vms_serial_ports_v2.yml index b64fbf2a..ae594827 100644 --- a/examples/vmm_v2/vms_serial_ports_v2.yml +++ b/examples/vmm_v2/vms_serial_ports_v2.yml @@ -23,7 +23,7 @@ serial_port_uuid: "123e4567-1234-12d3-a456-426614174002" - name: Create Serial Port - ntnx_vms_serial_port_v2: + nutanix.ncp.ntnx_vms_serial_port_v2: vm_ext_id: "{{ vm_uuid }}" state: present index: 0 @@ -32,13 +32,13 @@ ignore_errors: true - name: Fetch serial port information - ntnx_vms_serial_port_info_v2: + nutanix.ncp.ntnx_vms_serial_port_info_v2: vm_ext_id: "{{ vm_uuid }}" register: result ignore_errors: true - name: Update Serial Port connection - ntnx_vms_serial_port_v2: + nutanix.ncp.ntnx_vms_serial_port_v2: vm_ext_id: "{{ vm_uuid }}" ext_id: "{{ serial_port_uuid }}" state: present @@ -47,7 +47,7 @@ ignore_errors: true - name: Delete Serial Port - ntnx_vms_serial_port_v2: + nutanix.ncp.ntnx_vms_serial_port_v2: vm_ext_id: "{{ vm_uuid }}" ext_id: "{{ serial_port_uuid }}" state: absent diff --git a/examples/vmm_v2/vms_stage_guest_customization_v2.yml b/examples/vmm_v2/vms_stage_guest_customization_v2.yml index 4bbbc227..1aa3b7b0 100644 --- a/examples/vmm_v2/vms_stage_guest_customization_v2.yml +++ b/examples/vmm_v2/vms_stage_guest_customization_v2.yml @@ -17,7 +17,7 @@ vm_uuid: "323e4567-e89b-12d3-a456-426614174001" - name: Update guest script - ntnx_vms_stage_guest_customization_v2: + nutanix.ncp.ntnx_vms_stage_guest_customization_v2: ext_id: "{{ vm_uuid }}" config: cloudinit: diff --git a/examples/vmm_v2/vms_templates_v2.yml b/examples/vmm_v2/vms_templates_v2.yml index 3f6dc79c..a7a82400 100644 --- a/examples/vmm_v2/vms_templates_v2.yml +++ b/examples/vmm_v2/vms_templates_v2.yml @@ -33,7 +33,7 @@ cluster_uuid: "00062899-4a29-0cf9-0000-000000028f57" - name: Create new template from a vm - ntnx_templates_v2: + nutanix.ncp.ntnx_templates_v2: template_name: "{{ template_name }}" template_description: ansible test template_version_spec: @@ -44,13 +44,13 @@ ignore_errors: true - name: Fetch template info using ext id - ntnx_templates_info_v2: + nutanix.ncp.ntnx_templates_info_v2: ext_id: "{{ template_ext_id }}" register: result ignore_errors: true - name: Update template description & name - ntnx_templates_v2: + nutanix.ncp.ntnx_templates_v2: ext_id: "{{ template_ext_id }}" template_version_spec: version_name: "{{ version_name }}" @@ -67,28 +67,28 @@ ignore_errors: true - name: Retrieve the Template Version details for the given Template Version identifier. - ntnx_templates_versions_info_v2: + nutanix.ncp.ntnx_templates_versions_info_v2: ext_id: "{{ version_id }}" template_ext_id: "{{ template_ext_id }}" register: result ignore_errors: true - name: Set the Active Version - ntnx_templates_version_v2: + nutanix.ncp.ntnx_templates_version_v2: template_ext_id: "{{ template_ext_id }}" version_id: "{{ version_id }}" register: result ignore_errors: true - name: Delete Template Version - ntnx_templates_version_v2: + nutanix.ncp.ntnx_templates_version_v2: state: absent template_ext_id: "{{ template_ext_id }}" version_id: "{{ version_id }}" register: result - name: Deploy VM - ntnx_templates_deploy_v2: + nutanix.ncp.ntnx_templates_deploy_v2: ext_id: "{{ template_ext_id }}" version_id: "{{ version_id }}" cluster_reference: "{{ cluster_uuid }}" @@ -96,7 +96,7 @@ ignore_errors: true - name: Initiate_guest_os_update - ntnx_templates_guest_os_v2: + nutanix.ncp.ntnx_templates_guest_os_v2: template_ext_id: "{{ template_ext_id }}" version_id: "{{ version_id }}" state: start @@ -104,7 +104,7 @@ ignore_errors: true - name: Finish guest_os_update - ntnx_templates_guest_os_v2: + nutanix.ncp.ntnx_templates_guest_os_v2: template_ext_id: "{{ template_ext_id }}" version_id: "{{ version_id }}" state: finish @@ -114,7 +114,7 @@ ignore_errors: true - name: Delete Template - ntnx_templates_v2: + nutanix.ncp.ntnx_templates_v2: state: absent ext_id: "{{ template_ext_id }}" register: result diff --git a/examples/vmm_v2/vms_v2.yml b/examples/vmm_v2/vms_v2.yml index 639e961f..5591c5f1 100644 --- a/examples/vmm_v2/vms_v2.yml +++ b/examples/vmm_v2/vms_v2.yml @@ -23,7 +23,7 @@ vm_uuid: "a990cfaa-95a8-4861-bdf6-14060555442d" - name: Create VM - ntnx_vms_v2: + nutanix.ncp.ntnx_vms_v2: name: "{{ vm_name }}" description: "vm description" cluster: @@ -52,7 +52,7 @@ ignore_errors: true - name: Update VM - ntnx_vms_v2: + nutanix.ncp.ntnx_vms_v2: state: present ext_id: "{{ vm_uuid }}" name: "{{ vm_name }}" @@ -83,13 +83,13 @@ ignore_errors: true - name: Fetch VM - ntnx_vms_info_v2.py: + nutanix.ncp.ntnx_vms_info_v2.py: ext_id: "{{ vm_uuid }}" register: result ignore_errors: true - name: Delete VM - ntnx_vms_v2: + nutanix.ncp.ntnx_vms_v2: state: absent ext_id: "{{ vm_uuid }}" register: result From 16de58108a4f0d88b1d387f88de9f8682600fa89 Mon Sep 17 00:00:00 2001 From: George Ghawali Date: Mon, 16 Dec 2024 12:24:15 +0200 Subject: [PATCH 3/4] Adding ansible lint fixes for examples --- .../clusters_nodes_v2.yml | 2 +- examples/iam_v2/authorization_policies_v2.yml | 2 +- examples/iam_v2/operations_v2.yml | 2 +- examples/iam_v2/roles_v2.yml | 76 ++++++------- examples/iam_v2/user_groups_v2.yml | 2 +- examples/iam_v2/users_v2.yml | 2 +- examples/networks_v2/address_groups_v2.yml | 2 +- examples/networks_v2/routes_v2.yml | 100 +++++++++--------- examples/networks_v2/security_rules_v2.yml | 2 +- examples/networks_v2/service_groups_v2.yml | 2 +- .../storage_container_v2.yml | 2 +- examples/vmm_v2/vms_v2.yml | 2 +- 12 files changed, 98 insertions(+), 98 deletions(-) diff --git a/examples/cluster_management_v2/clusters_nodes_v2.yml b/examples/cluster_management_v2/clusters_nodes_v2.yml index d94de0f4..a963eef4 100644 --- a/examples/cluster_management_v2/clusters_nodes_v2.yml +++ b/examples/cluster_management_v2/clusters_nodes_v2.yml @@ -7,7 +7,7 @@ # 4. Remove the node from the cluster # 5. Destroy the cluster -- name: cluster expanding playbook +- name: Cluster expanding playbook hosts: localhost gather_facts: false module_defaults: diff --git a/examples/iam_v2/authorization_policies_v2.yml b/examples/iam_v2/authorization_policies_v2.yml index 6d3316dc..9f60a725 100644 --- a/examples/iam_v2/authorization_policies_v2.yml +++ b/examples/iam_v2/authorization_policies_v2.yml @@ -8,7 +8,7 @@ # 5. Fetch authorization policies using filters # 6. Delete created authorization policy -- name: authorization policies playbook +- name: Authorization policies playbook hosts: localhost gather_facts: false module_defaults: diff --git a/examples/iam_v2/operations_v2.yml b/examples/iam_v2/operations_v2.yml index 728362fc..1b902b12 100644 --- a/examples/iam_v2/operations_v2.yml +++ b/examples/iam_v2/operations_v2.yml @@ -4,7 +4,7 @@ # 1. List all operations # 2. List permission using ext_id criteria -- name: operations playbook +- name: Operations playbook hosts: localhost gather_facts: false module_defaults: diff --git a/examples/iam_v2/roles_v2.yml b/examples/iam_v2/roles_v2.yml index 16e35755..c33be5bc 100644 --- a/examples/iam_v2/roles_v2.yml +++ b/examples/iam_v2/roles_v2.yml @@ -25,45 +25,45 @@ test_operation_2_uuid: 00000000-0000-0000-0000-000000000002 role_uuid: 00000000-0000-0000-0000-000000000003 -- name: Create roles with operations - nutanix.ncp.ntnx_roles_v2: - state: present - display_name: "{{ role_name }}" - description: test-ansible-role-1-desc - operations: - - "{{ test_operation_1_uuid }}" - - "{{ test_operation_2_uuid }}" - wait: true - register: result - ignore_errors: true + - name: Create roles with operations + nutanix.ncp.ntnx_roles_v2: + state: present + display_name: "{{ role_name }}" + description: test-ansible-role-1-desc + operations: + - "{{ test_operation_1_uuid }}" + - "{{ test_operation_2_uuid }}" + wait: true + register: result + ignore_errors: true -- name: Update roles in check mode - nutanix.ncp.ntnx_roles_v2: - state: present - ext_id: "{{ role_uuid }}" - display_name: "{{ role_name_updated }}" - description: test-ansible-role-2-desc - operations: - - "{{ test_operation_2_uuid }}" - wait: true - register: result - check_mode: true - ignore_errors: true + - name: Update roles in check mode + nutanix.ncp.ntnx_roles_v2: + state: present + ext_id: "{{ role_uuid }}" + display_name: "{{ role_name_updated }}" + description: test-ansible-role-2-desc + operations: + - "{{ test_operation_2_uuid }}" + wait: true + register: result + check_mode: true + ignore_errors: true -- name: List all roles - nutanix.ncp.ntnx_roles_info_v2: - register: result - ignore_errors: true + - name: List all roles + nutanix.ncp.ntnx_roles_info_v2: + register: result + ignore_errors: true -- name: Fetch role using external ID - nutanix.ncp.ntnx_roles_info_v2: - ext_id: "{{ role_uuid }}" - register: result - ignore_errors: true + - name: Fetch role using external ID + nutanix.ncp.ntnx_roles_info_v2: + ext_id: "{{ role_uuid }}" + register: result + ignore_errors: true -- name: Delete role - nutanix.ncp.ntnx_roles_v2: - state: absent - ext_id: "{{ role_uuid }}" - register: result - ignore_errors: true + - name: Delete role + nutanix.ncp.ntnx_roles_v2: + state: absent + ext_id: "{{ role_uuid }}" + register: result + ignore_errors: true diff --git a/examples/iam_v2/user_groups_v2.yml b/examples/iam_v2/user_groups_v2.yml index 14cfe66a..9a6da55d 100644 --- a/examples/iam_v2/user_groups_v2.yml +++ b/examples/iam_v2/user_groups_v2.yml @@ -7,7 +7,7 @@ # 4. List user groups using filter criteria # 5. Delete created user group -- name: user groups playbook +- name: User groups playbook hosts: localhost gather_facts: false module_defaults: diff --git a/examples/iam_v2/users_v2.yml b/examples/iam_v2/users_v2.yml index efe6d511..c6683be4 100644 --- a/examples/iam_v2/users_v2.yml +++ b/examples/iam_v2/users_v2.yml @@ -10,7 +10,7 @@ # 7. List users with specific username # 8. Delete created user -- name: users playbook +- name: Users playbook hosts: localhost gather_facts: false module_defaults: diff --git a/examples/networks_v2/address_groups_v2.yml b/examples/networks_v2/address_groups_v2.yml index ebfd0cbe..a4b71b15 100644 --- a/examples/networks_v2/address_groups_v2.yml +++ b/examples/networks_v2/address_groups_v2.yml @@ -6,7 +6,7 @@ # 3. Fetch the address group info # 4. Delete the address group -- name: address groups playbook +- name: Address groups playbook hosts: localhost gather_facts: false module_defaults: diff --git a/examples/networks_v2/routes_v2.yml b/examples/networks_v2/routes_v2.yml index 62a4738e..1262fe1c 100644 --- a/examples/networks_v2/routes_v2.yml +++ b/examples/networks_v2/routes_v2.yml @@ -28,56 +28,56 @@ ip1: "10.0.0.1" ip2: "10.0.0.2" -- name: Create static route - nutanix.ncp.ntnx_routes_v2: - state: present - name: "{{ route_name }}" - description: "Route for testing" - vpc_reference: "{{ vpc_uuid }}" - route_table_ext_id: "{{ route_table_external_id }}" - route_type: STATIC - destination: - ipv4: - ip: - value: "{{ ip1 }}" - prefix_length: 32 - nexthop: - nexthop_type: "EXTERNAL_SUBNET" - nexthop_reference: "{{ external_subnet_uuid }}" - metadata: - owner_reference_id: "{{ user_uuid }}" - project_reference_id: "{{ project_uuid }}" - register: result - ignore_errors: true + - name: Create static route + nutanix.ncp.ntnx_routes_v2: + state: present + name: "{{ route_name }}" + description: "Route for testing" + vpc_reference: "{{ vpc_uuid }}" + route_table_ext_id: "{{ route_table_external_id }}" + route_type: STATIC + destination: + ipv4: + ip: + value: "{{ ip1 }}" + prefix_length: 32 + nexthop: + nexthop_type: "EXTERNAL_SUBNET" + nexthop_reference: "{{ external_subnet_uuid }}" + metadata: + owner_reference_id: "{{ user_uuid }}" + project_reference_id: "{{ project_uuid }}" + register: result + ignore_errors: true -- name: Update route - nutanix.ncp.ntnx_routes_v2: - state: present - name: "{{ route_name }}_updated" - description: "Route for testing updated" - vpc_reference: "{{ vpc_uuid }}" - route_table_ext_id: "{{ route_table_external_id }}" - ext_id: "{{ route_uuid }}" - route_type: STATIC - destination: - ipv4: - ip: - value: "{{ ip2 }}" - prefix_length: 32 - register: result - ignore_errors: true + - name: Update route + nutanix.ncp.ntnx_routes_v2: + state: present + name: "{{ route_name }}_updated" + description: "Route for testing updated" + vpc_reference: "{{ vpc_uuid }}" + route_table_ext_id: "{{ route_table_external_id }}" + ext_id: "{{ route_uuid }}" + route_type: STATIC + destination: + ipv4: + ip: + value: "{{ ip2 }}" + prefix_length: 32 + register: result + ignore_errors: true -- name: Fetch route by external ID - nutanix.ncp.ntnx_routes_info_v2: - ext_id: "{{ route_uuid }}" - route_table_ext_id: "{{ route_table_external_id }}" - register: result - ignore_errors: true + - name: Fetch route by external ID + nutanix.ncp.ntnx_routes_info_v2: + ext_id: "{{ route_uuid }}" + route_table_ext_id: "{{ route_table_external_id }}" + register: result + ignore_errors: true -- name: Delete static route - nutanix.ncp.ntnx_routes_v2: - state: absent - ext_id: "{{ route_uuid }}" - route_table_ext_id: "{{ route_table_external_id }}" - register: result - ignore_errors: true + - name: Delete static route + nutanix.ncp.ntnx_routes_v2: + state: absent + ext_id: "{{ route_uuid }}" + route_table_ext_id: "{{ route_table_external_id }}" + register: result + ignore_errors: true diff --git a/examples/networks_v2/security_rules_v2.yml b/examples/networks_v2/security_rules_v2.yml index 55494554..49e7674e 100644 --- a/examples/networks_v2/security_rules_v2.yml +++ b/examples/networks_v2/security_rules_v2.yml @@ -6,7 +6,7 @@ # 3. Fetch the security rule info # 4. Delete the security rule -- name: security rules playbook +- name: Security rules playbook hosts: localhost gather_facts: false module_defaults: diff --git a/examples/networks_v2/service_groups_v2.yml b/examples/networks_v2/service_groups_v2.yml index 1002a448..c4a41cd0 100644 --- a/examples/networks_v2/service_groups_v2.yml +++ b/examples/networks_v2/service_groups_v2.yml @@ -6,7 +6,7 @@ # 3. Fetch the service group details using ext_id # 4. Delete the service group -- name: service groups playbook +- name: Service groups playbook hosts: localhost gather_facts: false module_defaults: diff --git a/examples/storage_container_v2/storage_container_v2.yml b/examples/storage_container_v2/storage_container_v2.yml index 4b741ad3..6be56abe 100644 --- a/examples/storage_container_v2/storage_container_v2.yml +++ b/examples/storage_container_v2/storage_container_v2.yml @@ -9,7 +9,7 @@ # 6. Fetch all storage containers # 7. Delete the storage container -- name: storage container playbook +- name: Storage container playbook hosts: localhost gather_facts: false module_defaults: diff --git a/examples/vmm_v2/vms_v2.yml b/examples/vmm_v2/vms_v2.yml index 5591c5f1..3ba7a90d 100644 --- a/examples/vmm_v2/vms_v2.yml +++ b/examples/vmm_v2/vms_v2.yml @@ -83,7 +83,7 @@ ignore_errors: true - name: Fetch VM - nutanix.ncp.ntnx_vms_info_v2.py: + nutanix.ncp.ntnx_vms_info_v2: ext_id: "{{ vm_uuid }}" register: result ignore_errors: true From 62fa6bbea65918a9ff546a6810cd84208573ca0a Mon Sep 17 00:00:00 2001 From: George Ghawali Date: Mon, 16 Dec 2024 12:39:47 +0200 Subject: [PATCH 4/4] Minor ansible lint fix --- examples/cluster_management_v2/clusters_and_hosts_v2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/cluster_management_v2/clusters_and_hosts_v2.yml b/examples/cluster_management_v2/clusters_and_hosts_v2.yml index 6969a3d1..42446f37 100644 --- a/examples/cluster_management_v2/clusters_and_hosts_v2.yml +++ b/examples/cluster_management_v2/clusters_and_hosts_v2.yml @@ -12,7 +12,7 @@ # 9. Fetch hosts of particular cluster # 10. Destroy the cluster -- name: clusters CRUD playbook +- name: Clusters CRUD playbook hosts: localhost gather_facts: false module_defaults: