diff --git a/plugins/module_utils/prism/projects.py b/plugins/module_utils/prism/projects.py index faf409c7..0610ffe9 100644 --- a/plugins/module_utils/prism/projects.py +++ b/plugins/module_utils/prism/projects.py @@ -67,9 +67,9 @@ def _build_spec_default_subnet(self, payload, subnet_ref): if err: return None, err - payload["spec"]["resources"][ - "default_subnet_reference" - ] = Subnet.build_subnet_reference_spec(uuid) + payload["spec"]["resources"]["default_subnet_reference"] = ( + Subnet.build_subnet_reference_spec(uuid) + ) return payload, None def _build_spec_subnets(self, payload, subnet_ref_list): diff --git a/plugins/module_utils/prism/projects_internal.py b/plugins/module_utils/prism/projects_internal.py index 4c7ced08..9209efa0 100644 --- a/plugins/module_utils/prism/projects_internal.py +++ b/plugins/module_utils/prism/projects_internal.py @@ -133,9 +133,9 @@ def _build_spec_default_subnet(self, payload, subnet_ref): if err: return None, err - payload["spec"]["project_detail"]["resources"][ - "default_subnet_reference" - ] = Subnet.build_subnet_reference_spec(uuid) + payload["spec"]["project_detail"]["resources"]["default_subnet_reference"] = ( + Subnet.build_subnet_reference_spec(uuid) + ) return payload, None def _build_spec_subnets(self, payload, subnet_ref_list): @@ -393,13 +393,11 @@ def _build_spec_role_mappings(self, payload, role_mappings): acp["acp"]["resources"]["user_reference_list"] = role_user_groups_map[ acp["acp"]["resources"]["role_reference"]["uuid"] ]["users"] - acp["acp"]["resources"][ - "user_group_reference_list" - ] = role_user_groups_map[ - acp["acp"]["resources"]["role_reference"]["uuid"] - ][ - "user_groups" - ] + acp["acp"]["resources"]["user_group_reference_list"] = ( + role_user_groups_map[ + acp["acp"]["resources"]["role_reference"]["uuid"] + ]["user_groups"] + ) # pop the role uuid entry once used for acp update role_user_groups_map.pop( diff --git a/plugins/module_utils/prism/protection_rules.py b/plugins/module_utils/prism/protection_rules.py index 5808eaae..9ec5e978 100644 --- a/plugins/module_utils/prism/protection_rules.py +++ b/plugins/module_utils/prism/protection_rules.py @@ -91,13 +91,13 @@ def _build_spec_schedules(self, payload, schedules): az_connection_spec = {} spec = {} if schedule.get("source"): - az_connection_spec[ - "source_availability_zone_index" - ] = ordered_az_list.index(schedule["source"]) + az_connection_spec["source_availability_zone_index"] = ( + ordered_az_list.index(schedule["source"]) + ) if schedule.get("destination"): - az_connection_spec[ - "destination_availability_zone_index" - ] = ordered_az_list.index(schedule["destination"]) + az_connection_spec["destination_availability_zone_index"] = ( + ordered_az_list.index(schedule["destination"]) + ) if schedule["protection_type"] == "ASYNC": if ( diff --git a/plugins/module_utils/prism/recovery_plans.py b/plugins/module_utils/prism/recovery_plans.py index 10039dcb..61006a41 100644 --- a/plugins/module_utils/prism/recovery_plans.py +++ b/plugins/module_utils/prism/recovery_plans.py @@ -312,9 +312,9 @@ def _build_spec_floating_ip_assignments(self, payload, floating_ip_assignments): vm_ip_assignment_specs.append(ip_assignment_spec) - floating_ip_assignment_spec[ - "vm_ip_assignment_list" - ] = vm_ip_assignment_specs + floating_ip_assignment_spec["vm_ip_assignment_list"] = ( + vm_ip_assignment_specs + ) floating_ip_assignment_specs.append(floating_ip_assignment_spec) payload["spec"]["resources"]["parameters"][ diff --git a/plugins/modules/ntnx_acps.py b/plugins/modules/ntnx_acps.py index 6ca41148..64398d43 100644 --- a/plugins/modules/ntnx_acps.py +++ b/plugins/modules/ntnx_acps.py @@ -119,7 +119,7 @@ EXAMPLES = r""" - name: Create min ACP ntnx_acps: - validate_certs: False + validate_certs: false state: present nutanix_host: "{{ IP }}" nutanix_username: "{{ username }}" @@ -131,7 +131,7 @@ - name: Create ACP with user reference ntnx_acps: - validate_certs: False + validate_certs: false state: present nutanix_host: "{{ IP }}" nutanix_username: "{{ username }}" @@ -144,7 +144,7 @@ - name: Create ACP with user ad user group reference ntnx_acps: - validate_certs: False + validate_certs: false state: present nutanix_host: "{{ IP }}" nutanix_username: "{{ username }}" @@ -159,7 +159,7 @@ - name: Create ACP with all specfactions ntnx_acps: - validate_certs: False + validate_certs: false state: present nutanix_host: "{{ IP }}" nutanix_username: "{{ username }}" diff --git a/plugins/modules/ntnx_acps_info.py b/plugins/modules/ntnx_acps_info.py index 02362e3d..78ad8438 100644 --- a/plugins/modules/ntnx_acps_info.py +++ b/plugins/modules/ntnx_acps_info.py @@ -39,28 +39,28 @@ - Alaa Bishtawi (@alaa-bish) """ EXAMPLES = r""" - - name: List acp using name filter criteria - ntnx_acps_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - filter: - name: "{{ acp.name }}" - kind: access_control_policy - register: result - - - name: List acp using length, offset, sort order and name sort attribute - ntnx_acps_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - length: 1 - offset: 1 - sort_order: "ASCENDING" - sort_attribute: "name" - register: result +- name: List acp using name filter criteria + ntnx_acps_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filter: + name: "{{ acp.name }}" + kind: access_control_policy + register: result + +- name: List acp using length, offset, sort order and name sort attribute + ntnx_acps_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + length: 1 + offset: 1 + sort_order: "ASCENDING" + sort_attribute: "name" + register: result """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_categories.py b/plugins/modules/ntnx_categories.py index 9b01609d..1d91b529 100644 --- a/plugins/modules/ntnx_categories.py +++ b/plugins/modules/ntnx_categories.py @@ -56,7 +56,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false state: "present" name: "{{first_category.name}}" desc: "{{first_category.desc}}" @@ -66,7 +66,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false state: "present" name: "{{first_category.name}}" desc: "{{first_category.update_desc}}" @@ -79,7 +79,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false state: "absent" name: "{{first_category.name}}" desc: "{{first_category.update_desc}}" @@ -91,7 +91,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false state: "absent" name: "{{first_category.name}}" remove_values: true @@ -101,7 +101,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false state: "absent" name: "{{first_category.name}}" register: result @@ -110,7 +110,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false state: "present" name: "{{second_category.name}}" desc: test description diff --git a/plugins/modules/ntnx_categories_info.py b/plugins/modules/ntnx_categories_info.py index 7cf558af..3f10621d 100644 --- a/plugins/modules/ntnx_categories_info.py +++ b/plugins/modules/ntnx_categories_info.py @@ -36,10 +36,10 @@ EXAMPLES = r""" - name: test getting all categories ntnx_categories_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false register: result ignore_errors: true @@ -48,18 +48,18 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false filter: - name: "{{category_name}}" + name: "{{category_name}}" register: result - name: test getting the category by it's name ntnx_categories_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - name: "{{category_name}}" + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + name: "{{category_name}}" register: result """ RETURN = r""" diff --git a/plugins/modules/ntnx_clusters_info.py b/plugins/modules/ntnx_clusters_info.py index 33b100eb..a6065306 100644 --- a/plugins/modules/ntnx_clusters_info.py +++ b/plugins/modules/ntnx_clusters_info.py @@ -32,23 +32,23 @@ - Alaa Bishtawi (@alaa-bish) """ EXAMPLES = r""" - - name: List clusterss - ntnx_clusters_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - kind: cluster - register: result - - - name: test getting particular cluster using uuid - ntnx_clusters_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - cluster_uuid: cluster_uuid - register: result +- name: List clusterss + ntnx_clusters_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + kind: cluster + register: result + +- name: test getting particular cluster using uuid + ntnx_clusters_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + cluster_uuid: cluster_uuid + register: result """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_floating_ips.py b/plugins/modules/ntnx_floating_ips.py index 3986b73e..d1ac8926 100644 --- a/plugins/modules/ntnx_floating_ips.py +++ b/plugins/modules/ntnx_floating_ips.py @@ -76,7 +76,7 @@ EXAMPLES = r""" - name: create Floating IP with External Subnet Name ntnx_floating_ips: - validate_certs: False + validate_certs: false state: present nutanix_host: "{{ IP }}" nutanix_username: "{{ username }}" @@ -86,7 +86,7 @@ - name: create Floating IP with vpc Name with external subnet uuid ntnx_floating_ips: - validate_certs: False + validate_certs: false state: present nutanix_host: "{{ IP }}" nutanix_username: "{{ username }}" @@ -94,12 +94,12 @@ external_subnet: uuid: "{{external_subnet.subnet_uuiid}}" vpc: - name: "{{vpc.vpc_name}}" + name: "{{vpc.vpc_name}}" private_ip: "{{private_ip}}" - name: create Floating IP with External Subnet with vm ntnx_floating_ips: - validate_certs: False + validate_certs: false state: present nutanix_host: "{{ IP }}" nutanix_username: "{{ username }}" diff --git a/plugins/modules/ntnx_floating_ips_info.py b/plugins/modules/ntnx_floating_ips_info.py index 1ac7b081..22ee5546 100644 --- a/plugins/modules/ntnx_floating_ips_info.py +++ b/plugins/modules/ntnx_floating_ips_info.py @@ -32,29 +32,28 @@ - Alaa Bishtawi (@alaa-bish) """ EXAMPLES = r""" - - name: List Floating ip using ip starts with 10 filter criteria - ntnx_floating_ips_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - filter: - floating_ip: "10." - kind: floating_ip - register: result - - - name: List Floating ip using length, offset, sort order and floating_ip sort attribute - ntnx_floating_ips_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - length: 3 - offset: 0 - sort_order: "DESCENDING" - sort_attribute: "floating_ip" - register: result - +- name: List Floating ip using ip starts with 10 filter criteria + ntnx_floating_ips_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filter: + floating_ip: "10." + kind: floating_ip + register: result + +- name: List Floating ip using length, offset, sort order and floating_ip sort attribute + ntnx_floating_ips_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + length: 3 + offset: 0 + sort_order: "DESCENDING" + sort_attribute: "floating_ip" + register: result """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_foundation.py b/plugins/modules/ntnx_foundation.py index 8c373fcb..8f7519a4 100644 --- a/plugins/modules/ntnx_foundation.py +++ b/plugins/modules/ntnx_foundation.py @@ -938,60 +938,57 @@ - name: Image nodes hosts: localhost gather_facts: false - collections: - - nutanix.ncp tasks: - - name: Image nodes - ntnx_foundation: - timeout : 3660 - nutanix_host: "10.xx.xx.xx" - cvm_gateway: "10.xx.xx.xx" - cvm_netmask: "xx.xx.xx.xx" - hypervisor_gateway: "10.xx.xx.xx" - hypervisor_netmask: "xx.xx.xx.xx" - default_ipmi_user: "username" - nos_package: "nutanix_aos_installer.tar.gz" - blocks: - - block_id: "" - nodes: - # manually added node / baremetal - - manual_mode : - current_cvm_vlan_tag: xx - cvm_gb_ram: 50 - ipmi_password: "password" - ipmi_ip: "10.xx.xx.xx" - cvm_ip: "10.xx.xx.xx" - hypervisor: "kvm" - hypervisor_ip: "10.xx.xx.xx" - hypervisor_hostname: "superman-1" - node_position: "D" - # dos based node - - discovery_mode: - cvm_gb_ram: 50 - ipmi_password : "password" - node_serial : "node_serial" - discovery_override: - hypervisor_hostname: "superman-2" - hypervisor_ip: "10.xx.xx.xx" + - name: Image nodes + ntnx_foundation: + timeout: 3660 + nutanix_host: "10.xx.xx.xx" + cvm_gateway: "10.xx.xx.xx" + cvm_netmask: "xx.xx.xx.xx" + hypervisor_gateway: "10.xx.xx.xx" + hypervisor_netmask: "xx.xx.xx.xx" + default_ipmi_user: "username" + nos_package: "nutanix_aos_installer.tar.gz" + blocks: + - block_id: "" + nodes: + # manually added node / baremetal + - manual_mode: + current_cvm_vlan_tag: xx + cvm_gb_ram: 50 + ipmi_password: "password" + ipmi_ip: "10.xx.xx.xx" cvm_ip: "10.xx.xx.xx" hypervisor: "kvm" - # aos based node - - discovery_mode: - cvm_gb_ram: 50 - ipmi_password : "password" - node_serial : "node_serial" - discovery_override: - hypervisor_hostname: "superman-3" - cvm_ip : "10.xx.xx.xx" - - clusters: - - name : "superman" - redundancy_factor: 2 - cluster_members: - - "10.xx.xx.xx" - - "10.xx.xx.xx" - - "10.xx.xx.xx" + hypervisor_ip: "10.xx.xx.xx" + hypervisor_hostname: "superman-1" + node_position: "D" + # dos based node + - discovery_mode: + cvm_gb_ram: 50 + ipmi_password: "password" + node_serial: "node_serial" + discovery_override: + hypervisor_hostname: "superman-2" + hypervisor_ip: "10.xx.xx.xx" + cvm_ip: "10.xx.xx.xx" + hypervisor: "kvm" + # aos based node + - discovery_mode: + cvm_gb_ram: 50 + ipmi_password: "password" + node_serial: "node_serial" + discovery_override: + hypervisor_hostname: "superman-3" + cvm_ip: "10.xx.xx.xx" + clusters: + - name: "superman" + redundancy_factor: 2 + cluster_members: + - "10.xx.xx.xx" + - "10.xx.xx.xx" + - "10.xx.xx.xx" """ RETURN = r""" diff --git a/plugins/modules/ntnx_foundation_aos_packages_info.py b/plugins/modules/ntnx_foundation_aos_packages_info.py index e5f030b8..ac152e17 100644 --- a/plugins/modules/ntnx_foundation_aos_packages_info.py +++ b/plugins/modules/ntnx_foundation_aos_packages_info.py @@ -24,9 +24,9 @@ """ EXAMPLES = r""" - - name: List packages - ntnx_foundation_aos_packages_info: - nutanix_host: "{{ ip }}" +- name: List packages + ntnx_foundation_aos_packages_info: + nutanix_host: "{{ ip }}" """ RETURN = r""" diff --git a/plugins/modules/ntnx_foundation_bmc_ipmi_config.py b/plugins/modules/ntnx_foundation_bmc_ipmi_config.py index 3c1a921d..2e8c7602 100644 --- a/plugins/modules/ntnx_foundation_bmc_ipmi_config.py +++ b/plugins/modules/ntnx_foundation_bmc_ipmi_config.py @@ -78,12 +78,11 @@ """ EXAMPLES = r""" - """ RETURN = r""" - """ + from ..module_utils.foundation.base_module import FoundationBaseModule # noqa: E402 from ..module_utils.foundation.bmc_ipmi_config import BMC # noqa: E402 from ..module_utils.utils import remove_param_with_none_value # noqa: E402 diff --git a/plugins/modules/ntnx_foundation_central.py b/plugins/modules/ntnx_foundation_central.py index 7e30db41..e9ba441b 100644 --- a/plugins/modules/ntnx_foundation_central.py +++ b/plugins/modules/ntnx_foundation_central.py @@ -299,67 +299,67 @@ """ EXAMPLES = r""" - - name: image nodes and create cluster - ntnx_foundation_central: - state: present - nutanix_host: "{{ pc }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - cluster_name: "test-cls" - common_network_settings: - cvm_dns_servers: - - xx.xx.xx.xx - hypervisor_dns_servers: - - xx.xx.xx.xx - cvm_ntp_servers: - - xx.x.x.xx - hypervisor_ntp_servers: - - xx.x.x.xx - nodes_list: +- name: image nodes and create cluster + ntnx_foundation_central: + state: present + nutanix_host: "{{ pc }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + cluster_name: "test-cls" + common_network_settings: + cvm_dns_servers: + - xx.xx.xx.xx + hypervisor_dns_servers: + - xx.xx.xx.xx + cvm_ntp_servers: + - xx.x.x.xx + hypervisor_ntp_servers: + - xx.x.x.xx + nodes_list: # manual based nodes - - manual_mode: - cvm_gateway: "10.xx.xx.xx" - cvm_netmask: "xx.xx.xx.xx" - cvm_ip: "10.x.xx.xx" - hypervisor_gateway: "10.x.xx.xxx" - hypervisor_netmask: "xx.xx.xx.xx" - hypervisor_ip: "10.x.x.xx" - hypervisor_hostname: "Host-1" - imaged_node_uuid: "" - use_existing_network_settings: false - ipmi_gateway: "10.x.xx.xx" - ipmi_netmask: "xx.xx.xx.xx" - ipmi_ip: "10.x.xx.xx" - image_now: true - hypervisor_type: "kvm" - - manual_mode: - cvm_gateway: "10.xx.xx.xx" - cvm_netmask: "xx.xx.xx.xx" - cvm_ip: "10.x.xx.xx" - hypervisor_gateway: "10.x.xx.xxx" - hypervisor_netmask: "xx.xx.xx.xx" - hypervisor_ip: "10.x.x.xx" - hypervisor_hostname: "Host-2" - imaged_node_uuid: "" - use_existing_network_settings: false - ipmi_gateway: "10.x.xx.xx" - ipmi_netmask: "xx.xx.xx.xx" - ipmi_ip: "10.x.xx.xx" - image_now: true - hypervisor_type: "kvm" - # discovery nodes based on node serial - - discovery_mode: - node_serial: "" - - discovery_mode: - node_serial: "" - discovery_override: - hypervisor_hostname: "" - cvm_ip: "" - ipmi_ip: "" - redundancy_factor: 2 - skip_cluster_creation: true - aos_package_url: "" + - manual_mode: + cvm_gateway: "10.xx.xx.xx" + cvm_netmask: "xx.xx.xx.xx" + cvm_ip: "10.x.xx.xx" + hypervisor_gateway: "10.x.xx.xxx" + hypervisor_netmask: "xx.xx.xx.xx" + hypervisor_ip: "10.x.x.xx" + hypervisor_hostname: "Host-1" + imaged_node_uuid: "" + use_existing_network_settings: false + ipmi_gateway: "10.x.xx.xx" + ipmi_netmask: "xx.xx.xx.xx" + ipmi_ip: "10.x.xx.xx" + image_now: true + hypervisor_type: "kvm" + - manual_mode: + cvm_gateway: "10.xx.xx.xx" + cvm_netmask: "xx.xx.xx.xx" + cvm_ip: "10.x.xx.xx" + hypervisor_gateway: "10.x.xx.xxx" + hypervisor_netmask: "xx.xx.xx.xx" + hypervisor_ip: "10.x.x.xx" + hypervisor_hostname: "Host-2" + imaged_node_uuid: "" + use_existing_network_settings: false + ipmi_gateway: "10.x.xx.xx" + ipmi_netmask: "xx.xx.xx.xx" + ipmi_ip: "10.x.xx.xx" + image_now: true + hypervisor_type: "kvm" + # discovery nodes based on node serial + - discovery_mode: + node_serial: "" + - discovery_mode: + node_serial: "" + discovery_override: + hypervisor_hostname: "" + cvm_ip: "" + ipmi_ip: "" + redundancy_factor: 2 + skip_cluster_creation: true + aos_package_url: "" """ RETURN = r""" diff --git a/plugins/modules/ntnx_foundation_central_api_keys.py b/plugins/modules/ntnx_foundation_central_api_keys.py index d8d9056d..76a56b73 100644 --- a/plugins/modules/ntnx_foundation_central_api_keys.py +++ b/plugins/modules/ntnx_foundation_central_api_keys.py @@ -30,13 +30,13 @@ """ EXAMPLES = r""" - - name: Create API key - ntnx_foundation_central_api_keys_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - alias: "test" +- name: Create API key + ntnx_foundation_central_api_keys_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + alias: "test" """ RETURN = r""" diff --git a/plugins/modules/ntnx_foundation_central_api_keys_info.py b/plugins/modules/ntnx_foundation_central_api_keys_info.py index a083706c..ae027cd5 100644 --- a/plugins/modules/ntnx_foundation_central_api_keys_info.py +++ b/plugins/modules/ntnx_foundation_central_api_keys_info.py @@ -36,28 +36,28 @@ """ EXAMPLES = r""" - - name: Get API key with alias filter - ntnx_foundation_central_api_keys_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - alias: "test" - - - name: Get API key with key_uuid filter - ntnx_foundation_central_api_keys_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - key_uuid : "{{ uuid of key }}" - - - name: List all the API key within FC - ntnx_foundation_central_api_keys_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False +- name: Get API key with alias filter + ntnx_foundation_central_api_keys_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + alias: "test" + +- name: Get API key with key_uuid filter + ntnx_foundation_central_api_keys_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + key_uuid: "{{ uuid of key }}" + +- name: List all the API key within FC + ntnx_foundation_central_api_keys_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false """ RETURN = r""" diff --git a/plugins/modules/ntnx_foundation_central_imaged_clusters_info.py b/plugins/modules/ntnx_foundation_central_imaged_clusters_info.py index deae2d70..c53aab03 100644 --- a/plugins/modules/ntnx_foundation_central_imaged_clusters_info.py +++ b/plugins/modules/ntnx_foundation_central_imaged_clusters_info.py @@ -58,24 +58,24 @@ """ EXAMPLES = r""" - - name: Get cluster details using uuid - ntnx_foundation_central_imaged_nodes_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - imaged_cluster_uuid: "{{node_uuid}}" +- name: Get cluster details using uuid + ntnx_foundation_central_imaged_nodes_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + imaged_cluster_uuid: "{{node_uuid}}" - - name: Get imaged clusters list based on filters - ntnx_foundation_central_imaged_nodes_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - filters: - archived: false - length: 5 - offset: 1 +- name: Get imaged clusters list based on filters + ntnx_foundation_central_imaged_nodes_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filters: + archived: false + length: 5 + offset: 1 """ RETURN = r""" diff --git a/plugins/modules/ntnx_foundation_central_imaged_nodes_info.py b/plugins/modules/ntnx_foundation_central_imaged_nodes_info.py index 4a62ec52..62fbfcf6 100644 --- a/plugins/modules/ntnx_foundation_central_imaged_nodes_info.py +++ b/plugins/modules/ntnx_foundation_central_imaged_nodes_info.py @@ -62,24 +62,24 @@ """ EXAMPLES = r""" - - name: Get node details using uuid - ntnx_foundation_central_imaged_nodes_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - imaged_node_uuid: "{{node_uuid}}" - - - name: Get imaged node list based on filters - ntnx_foundation_central_imaged_nodes_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - filters: - node_state: STATE_AVAILABLE - length: 5 - offset: 1 +- name: Get node details using uuid + ntnx_foundation_central_imaged_nodes_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + imaged_node_uuid: "{{node_uuid}}" + +- name: Get imaged node list based on filters + ntnx_foundation_central_imaged_nodes_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filters: + node_state: STATE_AVAILABLE + length: 5 + offset: 1 """ RETURN = r""" diff --git a/plugins/modules/ntnx_foundation_discover_nodes_info.py b/plugins/modules/ntnx_foundation_discover_nodes_info.py index 74091786..f91008c4 100644 --- a/plugins/modules/ntnx_foundation_discover_nodes_info.py +++ b/plugins/modules/ntnx_foundation_discover_nodes_info.py @@ -34,18 +34,19 @@ """ EXAMPLES = r""" - - name: Discover nodes - ntnx_foundation_discover_nodes_info: - nutanix_host: "{{ ip }}" - - - name: Discover all nodes - ntnx_foundation_discover_nodes_info: - nutanix_host: "{{ ip }}" - include_configured: true - - name: Discover nodes and include network info - ntnx_foundation_discover_nodes_info: - nutanix_host: "{{ ip }}" - include_network_details: true +- name: Discover nodes + ntnx_foundation_discover_nodes_info: + nutanix_host: "{{ ip }}" + +- name: Discover all nodes + ntnx_foundation_discover_nodes_info: + nutanix_host: "{{ ip }}" + include_configured: true + +- name: Discover nodes and include network info + ntnx_foundation_discover_nodes_info: + nutanix_host: "{{ ip }}" + include_network_details: true """ RETURN = r""" diff --git a/plugins/modules/ntnx_foundation_hypervisor_images_info.py b/plugins/modules/ntnx_foundation_hypervisor_images_info.py index b5404f52..0c21f73b 100644 --- a/plugins/modules/ntnx_foundation_hypervisor_images_info.py +++ b/plugins/modules/ntnx_foundation_hypervisor_images_info.py @@ -24,9 +24,9 @@ """ EXAMPLES = r""" - - name: List hypervisor images - ntnx_foundation_hypervisor_images_info: - nutanix_host: "{{ ip }}" +- name: List hypervisor images + ntnx_foundation_hypervisor_images_info: + nutanix_host: "{{ ip }}" """ RETURN = r""" diff --git a/plugins/modules/ntnx_foundation_image_upload.py b/plugins/modules/ntnx_foundation_image_upload.py index bd77547e..de85df5a 100644 --- a/plugins/modules/ntnx_foundation_image_upload.py +++ b/plugins/modules/ntnx_foundation_image_upload.py @@ -53,7 +53,7 @@ - name: Delete Image with esx installer_type ntnx_foundation_image_upload: nutanix_host: "{{ ip }}" - state : "absent" + state: "absent" filename: "temptar_dont_use.iso" installer_type: "esx" """ diff --git a/plugins/modules/ntnx_foundation_node_network_info.py b/plugins/modules/ntnx_foundation_node_network_info.py index 2feef029..e807c701 100644 --- a/plugins/modules/ntnx_foundation_node_network_info.py +++ b/plugins/modules/ntnx_foundation_node_network_info.py @@ -29,15 +29,13 @@ """ EXAMPLES = r""" - - name: Get node network info - ntnx_foundation_node_network_info: - nutanix_host: "{{ ip }}" - nodes: - - node_1_ipv6 - - node_2_ipv6 - - node_3_ipv6 - - +- name: Get node network info + ntnx_foundation_node_network_info: + nutanix_host: "{{ ip }}" + nodes: + - node_1_ipv6 + - node_2_ipv6 + - node_3_ipv6 """ RETURN = r""" diff --git a/plugins/modules/ntnx_hosts_info.py b/plugins/modules/ntnx_hosts_info.py index 8b733167..68abf2bf 100644 --- a/plugins/modules/ntnx_hosts_info.py +++ b/plugins/modules/ntnx_hosts_info.py @@ -32,23 +32,23 @@ - Alaa Bishtawi (@alaa-bish) """ EXAMPLES = r""" - - name: List hosts - ntnx_hosts_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - kind: host - register: result - - - name: test getting particular host using uuid - ntnx_hosts_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - host_uuid: - register: result +- name: List hosts + ntnx_hosts_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + kind: host + register: result + +- name: test getting particular host using uuid + ntnx_hosts_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + host_uuid: + register: result """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_image_placement_policies_info.py b/plugins/modules/ntnx_image_placement_policies_info.py index 4e0644c9..7e4a33a2 100644 --- a/plugins/modules/ntnx_image_placement_policies_info.py +++ b/plugins/modules/ntnx_image_placement_policies_info.py @@ -31,36 +31,36 @@ - Pradeepsingh Bhati (@bhati-pradeep) """ EXAMPLES = r""" - - name: Get image placement policy using policy_uuid - ntnx_image_placement_policies_info: - policy_uuid: "" - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - filter: - - name: test_policy - register: result +- name: Get image placement policy using policy_uuid + ntnx_image_placement_policies_info: + policy_uuid: "" + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filter: + - name: test_policy + register: result - - name: List image placement policies using name filter criteria - ntnx_image_placement_policies_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - filter: - - name: test_policy - register: result +- name: List image placement policies using name filter criteria + ntnx_image_placement_policies_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filter: + - name: test_policy + register: result - - name: List image placement policies using length, offset - ntnx_image_placement_policies_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - length: 2 - offset: 1 - register: result +- name: List image placement policies using length, offset + ntnx_image_placement_policies_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + length: 2 + offset: 1 + register: result """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_image_placement_policy.py b/plugins/modules/ntnx_image_placement_policy.py index 2d7da6e3..d520b9ef 100644 --- a/plugins/modules/ntnx_image_placement_policy.py +++ b/plugins/modules/ntnx_image_placement_policy.py @@ -103,7 +103,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false name: "test_policy_1" placement_type: soft image_categories: @@ -120,7 +120,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false name: "test_policy_2" desc: "test_policy_2_desc" placement_type: hard @@ -145,7 +145,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false name: "test_policy_2-uodated" desc: "test_policy_2_desc-updated" placement_type: hard @@ -167,8 +167,8 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False - remove_categories: True + validate_certs: false + remove_categories: true register: result - name: Delete image placement policy @@ -177,7 +177,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false policy_uuid: "" register: result """ diff --git a/plugins/modules/ntnx_images.py b/plugins/modules/ntnx_images.py index 0d3d64b5..4df66451 100644 --- a/plugins/modules/ntnx_images.py +++ b/plugins/modules/ntnx_images.py @@ -133,89 +133,89 @@ """ EXAMPLES = r""" - - name: create image from local workstation - ntnx_images: - state: "present" - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - source_path: "/Users/ubuntu/Downloads/alpine-virt-3.8.1-x86_64.iso" - clusters: - - name: "temp_cluster" - categories: - AppFamily: - - Backup - checksum: - checksum_algorithm: SHA_1 - checksum_value: 44610efd741a3ab4a548a81ea94869bb8b692977 - name: "ansible-test-with-categories-mapping" - desc: "description" - image_type: "ISO_IMAGE" - version: - product_name: "test" - product_version: "1.2.0" - wait: true - - - name: create image from with source as remote server file location - ntnx_images: - state: "present" - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - source_uri: "https://cloud-images.ubuntu.com/releases/xenial/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img" - clusters: - - name: "temp_cluster" - categories: - AppFamily: - - Backup - checksum: - checksum_algorithm: SHA_1 - checksum_value: 44610efd741a3ab4a548a81ea94869bb8b692977 - name: "ansible-test-with-categories-mapping" - desc: "description" - image_type: "DISK_IMAGE" - version: - product_name: "test" - product_version: "1.2.0" - wait: true - - - name: override categories of existing image - ntnx_images: - state: "present" - image_uuid: "" - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - categories: - AppTier: - - Default - AppFamily: - - Backup - wait: true - - - name: detach all categories from existing image - ntnx_images: - state: "present" - image_uuid: "00000000-0000-0000-0000-000000000000" - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - remove_categories: true - wait: true - - - name: delete existing image - ntnx_images: - state: "absent" - image_uuid: "00000000-0000-0000-0000-000000000000" - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - wait: true +- name: create image from local workstation + ntnx_images: + state: "present" + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + source_path: "/Users/ubuntu/Downloads/alpine-virt-3.8.1-x86_64.iso" + clusters: + - name: "temp_cluster" + categories: + AppFamily: + - Backup + checksum: + checksum_algorithm: SHA_1 + checksum_value: 44610efd741a3ab4a548a81ea94869bb8b692977 + name: "ansible-test-with-categories-mapping" + desc: "description" + image_type: "ISO_IMAGE" + version: + product_name: "test" + product_version: "1.2.0" + wait: true + +- name: create image from with source as remote server file location + ntnx_images: + state: "present" + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + source_uri: "https://cloud-images.ubuntu.com/releases/xenial/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img" + clusters: + - name: "temp_cluster" + categories: + AppFamily: + - Backup + checksum: + checksum_algorithm: SHA_1 + checksum_value: 44610efd741a3ab4a548a81ea94869bb8b692977 + name: "ansible-test-with-categories-mapping" + desc: "description" + image_type: "DISK_IMAGE" + version: + product_name: "test" + product_version: "1.2.0" + wait: true + +- name: override categories of existing image + ntnx_images: + state: "present" + image_uuid: "" + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + categories: + AppTier: + - Default + AppFamily: + - Backup + wait: true + +- name: dettach all categories from existing image + ntnx_images: + state: "present" + image_uuid: "00000000-0000-0000-0000-000000000000" + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + remove_categories: true + wait: true + +- name: delete existing image + ntnx_images: + state: "absent" + image_uuid: "00000000-0000-0000-0000-000000000000" + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + wait: true """ RETURN = r""" diff --git a/plugins/modules/ntnx_images_info.py b/plugins/modules/ntnx_images_info.py index 96fbd78f..95ae0476 100644 --- a/plugins/modules/ntnx_images_info.py +++ b/plugins/modules/ntnx_images_info.py @@ -31,15 +31,15 @@ - Pradeepsingh Bhati (@bhati-pradeep) """ EXAMPLES = r""" - - name: List images using name filter criteria - ntnx_images_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - filter: - name: Ubuntu - register: result +- name: List images using name filter criteria + ntnx_images_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filter: + name: Ubuntu + register: result """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_karbon_clusters.py b/plugins/modules/ntnx_karbon_clusters.py index aeb1b64e..d8ff684f 100644 --- a/plugins/modules/ntnx_karbon_clusters.py +++ b/plugins/modules/ntnx_karbon_clusters.py @@ -185,121 +185,121 @@ """ EXAMPLES = r""" - - name: create DEV cluster with Flannel network provider - ntnx_karbon_clusters: - cluster: - uuid: "00000000-0000-0000-0000-000000000000" - name: test-module21 - k8s_version: "1.19.8-0" - host_os: "ntnx-1.0" - node_subnet: - name: "vlan.800" - cluster_type: DEV - cni: - node_cidr_mask_size: 24 - service_ipv4_cidr: "172.19.0.0/16" - pod_ipv4_cidr: "172.20.0.0/16" - network_provider: Flannel - storage_class: - nutanix_cluster_password: "{{nutanix_cluster_password}}" - nutanix_cluster_username: "{{nutanix_cluster_username}}" - default_storage_class: True - name: test-storage-class - reclaim_policy: Delete - storage_container: "default-container-48394901932577" - file_system: ext4 - flash_mode: False - register: result - - - name: delete cluster - ntnx_karbon_clusters: - state: absent - name: "{{cluster_name}" - register: result - - - name: create DEV cluster with Calico network provider - ntnx_karbon_clusters: - cluster: - name: auto_cluster_prod_f34ce3677ecf - name: test-module21 - k8s_version: "1.19.8-0" - host_os: "ntnx-1.0" - node_subnet: - uuid: "00000000-0000-0000-0000-000000000000" - cni: - node_cidr_mask_size: 24 - service_ipv4_cidr: "172.19.0.0/16" - pod_ipv4_cidr: "172.20.0.0/16" - network_provider: Calico - custom_node_configs: - etcd: - num_instances: 1 - cpu: 4 - memory_gb: 8 - disk_gb: 120 - masters: - num_instances: 1 - cpu: 4 - memory_gb: 8 - disk_gb: 120 - workers: - num_instances: 1 - cpu: 8 - memory_gb: 8 - disk_gb: 120 - storage_class: - nutanix_cluster_password: "{{nutanix_cluster_password}}" - nutanix_cluster_username: "{{nutanix_cluster_username}}" - default_storage_class: True - name: test-storage-class - reclaim_policy: Retain - storage_container: "default-container-48394901932577" - file_system: xfs - flash_mode: true - register: result - - - name: create prod cluster - ntnx_karbon_clusters: - cluster: - uuid: "{{cluster.uuid}}" - name: "{{karbon_name}}" - k8s_version: "{{k8s_version}}" - host_os: "{{host_os}}" - node_subnet: - name: "{{node_subnet.name}}" - cluster_type: PROD - cni: - node_cidr_mask_size: 24 - service_ipv4_cidr: "172.19.0.0/16" - pod_ipv4_cidr: "172.20.0.0/16" - network_provider: Flannel - storage_class: - nutanix_cluster_password: "{{nutanix_cluster_password}}" - nutanix_cluster_username: "{{nutanix_cluster_username}}" - default_storage_class: True - name: test-storage-class - reclaim_policy: Delete - storage_container: "{{storage_container.name}}" - file_system: ext4 - flash_mode: False - control_plane_virtual_ip: "{{control_plane_virtual_ip}}" - custom_node_configs: - etcd: - num_instances: 1 - cpu: 4 - memory_gb: 8 - disk_gb: 240 - masters: - num_instances: 1 - cpu: 4 - memory_gb: 8 - disk_gb: 240 - workers: - num_instances: 1 - cpu: 8 - memory_gb: 8 - disk_gb: 240 - register: result +- name: create DEV cluster with Flannel network provider + ntnx_karbon_clusters: + cluster: + uuid: "00000000-0000-0000-0000-000000000000" + name: test-module21 + k8s_version: "1.19.8-0" + host_os: "ntnx-1.0" + node_subnet: + name: "vlan.800" + cluster_type: DEV + cni: + node_cidr_mask_size: 24 + service_ipv4_cidr: "172.19.0.0/16" + pod_ipv4_cidr: "172.20.0.0/16" + network_provider: Flannel + storage_class: + nutanix_cluster_password: "{{nutanix_cluster_password}}" + nutanix_cluster_username: "{{nutanix_cluster_username}}" + default_storage_class: true + name: test-storage-class + reclaim_policy: Delete + storage_container: "default-container-48394901932577" + file_system: ext4 + flash_mode: false + register: result + +- name: delete cluster + ntnx_karbon_clusters: + state: absent + name: "{{cluster_name}" + register: result + +- name: create DEV cluster with Calico network provider + ntnx_karbon_clusters: + cluster: + name: auto_cluster_prod_f34ce3677ecf + name: test-module21 + k8s_version: "1.19.8-0" + host_os: "ntnx-1.0" + node_subnet: + uuid: "00000000-0000-0000-0000-000000000000" + cni: + node_cidr_mask_size: 24 + service_ipv4_cidr: "172.19.0.0/16" + pod_ipv4_cidr: "172.20.0.0/16" + network_provider: Calico + custom_node_configs: + etcd: + num_instances: 1 + cpu: 4 + memory_gb: 8 + disk_gb: 120 + masters: + num_instances: 1 + cpu: 4 + memory_gb: 8 + disk_gb: 120 + workers: + num_instances: 1 + cpu: 8 + memory_gb: 8 + disk_gb: 120 + storage_class: + nutanix_cluster_password: "{{nutanix_cluster_password}}" + nutanix_cluster_username: "{{nutanix_cluster_username}}" + default_storage_class: true + name: test-storage-class + reclaim_policy: Retain + storage_container: "default-container-48394901932577" + file_system: xfs + flash_mode: true + register: result + +- name: create prod cluster + ntnx_karbon_clusters: + cluster: + uuid: "{{cluster.uuid}}" + name: "{{karbon_name}}" + k8s_version: "{{k8s_version}}" + host_os: "{{host_os}}" + node_subnet: + name: "{{node_subnet.name}}" + cluster_type: PROD + cni: + node_cidr_mask_size: 24 + service_ipv4_cidr: "172.19.0.0/16" + pod_ipv4_cidr: "172.20.0.0/16" + network_provider: Flannel + storage_class: + nutanix_cluster_password: "{{nutanix_cluster_password}}" + nutanix_cluster_username: "{{nutanix_cluster_username}}" + default_storage_class: true + name: test-storage-class + reclaim_policy: Delete + storage_container: "{{storage_container.name}}" + file_system: ext4 + flash_mode: false + control_plane_virtual_ip: "{{control_plane_virtual_ip}}" + custom_node_configs: + etcd: + num_instances: 1 + cpu: 4 + memory_gb: 8 + disk_gb: 240 + masters: + num_instances: 1 + cpu: 4 + memory_gb: 8 + disk_gb: 240 + workers: + num_instances: 1 + cpu: 8 + memory_gb: 8 + disk_gb: 240 + register: result """ RETURN = r""" diff --git a/plugins/modules/ntnx_karbon_clusters_info.py b/plugins/modules/ntnx_karbon_clusters_info.py index c5c9f14d..2db925de 100644 --- a/plugins/modules/ntnx_karbon_clusters_info.py +++ b/plugins/modules/ntnx_karbon_clusters_info.py @@ -32,42 +32,42 @@ - Alaa Bishtawi (@alaa-bish) """ EXAMPLES = r""" - - name: List clusters - ntnx_karbon_clusters_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - register: result - - - name: Get clusters using name - ntnx_clusters_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - cluster_name: "cluster-name" - register: result - - - name: Get clusters with ssh credential - ntnx_karbon_clusters_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - cluster_name: "cluster-name" - fetch_ssh_credentials: true - register: result - - - name: Get clusters with kubeconfig - ntnx_karbon_clusters_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - cluster_name: "cluster-name" - fetch_kubeconfig: true - register: result +- name: List clusters + ntnx_karbon_clusters_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + register: result + +- name: Get clusters using name + ntnx_clusters_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + cluster_name: "cluster-name" + register: result + +- name: Get clusters with ssh credential + ntnx_karbon_clusters_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + cluster_name: "cluster-name" + fetch_ssh_credentials: true + register: result + +- name: Get clusters with kubeconfig + ntnx_karbon_clusters_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + cluster_name: "cluster-name" + fetch_kubeconfig: true + register: result """ RETURN = r""" cni_config: diff --git a/plugins/modules/ntnx_karbon_clusters_node_pools.py b/plugins/modules/ntnx_karbon_clusters_node_pools.py index bb51d6ba..4e5221b2 100644 --- a/plugins/modules/ntnx_karbon_clusters_node_pools.py +++ b/plugins/modules/ntnx_karbon_clusters_node_pools.py @@ -98,8 +98,8 @@ ntnx_karbon_clusters_node_pools: node_subnet: uuid: "" - node_pool_name: "node_pool_name" - cluster_name: "cluster_name" + node_pool_name: "node_pool_name" + cluster_name: "cluster_name" pool_config: num_instances: 2 cpu: 4 @@ -110,14 +110,14 @@ - name: update pool by increasing cpu,memory_gb,num_instances and add labels ntnx_karbon_clusters_node_pools: - wait: True - node_pool_name: "node_name" - cluster_name: "cluster_name" + wait: true + node_pool_name: "node_name" + cluster_name: "cluster_name" pool_config: - cpu: 6 - memory_gb: 10 - disk_gb: 150 - num_instances: 4 + cpu: 6 + memory_gb: 10 + disk_gb: 150 + num_instances: 4 add_labels: property1: "test-property1" register: result diff --git a/plugins/modules/ntnx_karbon_registries.py b/plugins/modules/ntnx_karbon_registries.py index 9be9f76c..a94d055f 100644 --- a/plugins/modules/ntnx_karbon_registries.py +++ b/plugins/modules/ntnx_karbon_registries.py @@ -44,26 +44,26 @@ """ EXAMPLES = r""" - - name: create registry - ntnx_karbon_registries: - name: "{{registry_name}}" - url: "{{url}}" - port: "{{port_number}}" - register: result - - - name: delete registry - ntnx_karbon_registries: - name: "{{registry_name}}" - state: absent - register: result - - - name: create registry with username and password - ntnx_karbon_registries: - name: "{{registry_name}}" - url: "{{url}}" - username: "{{username}}" - password: "{{password}}" - register: result +- name: create registry + ntnx_karbon_registries: + name: "{{registry_name}}" + url: "{{url}}" + port: "{{port_number}}" + register: result + +- name: delete registry + ntnx_karbon_registries: + name: "{{registry_name}}" + state: absent + register: result + +- name: create registry with username and password + ntnx_karbon_registries: + name: "{{registry_name}}" + url: "{{url}}" + username: "{{username}}" + password: "{{password}}" + register: result """ RETURN = r""" diff --git a/plugins/modules/ntnx_karbon_registries_info.py b/plugins/modules/ntnx_karbon_registries_info.py index ae280f41..e863ea3c 100644 --- a/plugins/modules/ntnx_karbon_registries_info.py +++ b/plugins/modules/ntnx_karbon_registries_info.py @@ -26,23 +26,22 @@ - Alaa Bishtawi (@alaa-bish) """ EXAMPLES = r""" - - name: List registries - ntnx_karbon_registries_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - register: result - - - name: Get registries using name - ntnx_registries_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - registry_name: "registry-name" - register: result - +- name: List registries + ntnx_karbon_registries_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + register: result + +- name: Get registries using name + ntnx_registries_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + registry_name: "registry-name" + register: result """ RETURN = r""" name: diff --git a/plugins/modules/ntnx_ndb_clones_info.py b/plugins/modules/ntnx_ndb_clones_info.py index 77017344..9fd39931 100644 --- a/plugins/modules/ntnx_ndb_clones_info.py +++ b/plugins/modules/ntnx_ndb_clones_info.py @@ -55,7 +55,6 @@ validate_certs: false uuid: "" register: result - """ RETURN = r""" response: diff --git a/plugins/modules/ntnx_ndb_clusters.py b/plugins/modules/ntnx_ndb_clusters.py index 24a3b6a4..016fb034 100644 --- a/plugins/modules/ntnx_ndb_clusters.py +++ b/plugins/modules/ntnx_ndb_clusters.py @@ -141,53 +141,53 @@ """ EXAMPLES = r""" - - name: Register Cluster with prisim_vlan - ntnx_ndb_clusters: - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false - name: "cluster_name" - desc: "cluster_desc" - name_prefix: "cluster_name_prefix" - cluster_ip: "cluster_ip" - cluster_credentials: - username: "{{cluster_info.cluster_credentials.username}}" - password: "{{cluster_info.cluster_credentials.password}}" - agent_network: - dns_servers: - - "{{cluster_info.agent_network.dns_servers[0]}}" - - "{{cluster_info.agent_network.dns_servers[1]}}" - ntp_servers: - - "{{cluster_info.agent_network.ntp_servers[0]}}" - - "{{cluster_info.agent_network.ntp_servers[1]}}" - vlan_access: - prism_vlan: - vlan_name: "{{cluster_info.vlan_access.prism_vlan.vlan_name}}" - vlan_type: "{{cluster_info.vlan_access.prism_vlan.vlan_type}}" - static_ip: "{{cluster_info.vlan_access.prism_vlan.static_ip}}" - gateway: "{{cluster_info.vlan_access.prism_vlan.gateway}}" - subnet_mask: "{{cluster_info.vlan_access.prism_vlan.subnet_mask}}" - storage_container: "{{cluster_info.storage_container}}" - - - name: update cluster name , desc - ntnx_ndb_clusters: - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false - uuid: "cluster_uuid" - name: newname - desc: newdesc - - - name: delete cluster - ntnx_ndb_clusters: - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false - uuid: "cluster_uuid" - state: absent +- name: Register Cluster with prisim_vlan + ntnx_ndb_clusters: + nutanix_host: "" + nutanix_username: "" + nutanix_password: "" + validate_certs: false + name: "cluster_name" + desc: "cluster_desc" + name_prefix: "cluster_name_prefix" + cluster_ip: "cluster_ip" + cluster_credentials: + username: "{{cluster_info.cluster_credentials.username}}" + password: "{{cluster_info.cluster_credentials.password}}" + agent_network: + dns_servers: + - "{{cluster_info.agent_network.dns_servers[0]}}" + - "{{cluster_info.agent_network.dns_servers[1]}}" + ntp_servers: + - "{{cluster_info.agent_network.ntp_servers[0]}}" + - "{{cluster_info.agent_network.ntp_servers[1]}}" + vlan_access: + prism_vlan: + vlan_name: "{{cluster_info.vlan_access.prism_vlan.vlan_name}}" + vlan_type: "{{cluster_info.vlan_access.prism_vlan.vlan_type}}" + static_ip: "{{cluster_info.vlan_access.prism_vlan.static_ip}}" + gateway: "{{cluster_info.vlan_access.prism_vlan.gateway}}" + subnet_mask: "{{cluster_info.vlan_access.prism_vlan.subnet_mask}}" + storage_container: "{{cluster_info.storage_container}}" + +- name: update cluster name , desc + ntnx_ndb_clusters: + nutanix_host: "" + nutanix_username: "" + nutanix_password: "" + validate_certs: false + uuid: "cluster_uuid" + name: newname + desc: newdesc + +- name: delete cluster + ntnx_ndb_clusters: + nutanix_host: "" + nutanix_username: "" + nutanix_password: "" + validate_certs: false + uuid: "cluster_uuid" + state: absent """ RETURN = r""" diff --git a/plugins/modules/ntnx_ndb_clusters_info.py b/plugins/modules/ntnx_ndb_clusters_info.py index d27527d6..4ce54be5 100644 --- a/plugins/modules/ntnx_ndb_clusters_info.py +++ b/plugins/modules/ntnx_ndb_clusters_info.py @@ -66,7 +66,6 @@ validate_certs: false uuid: "" register: result - """ RETURN = r""" response: diff --git a/plugins/modules/ntnx_ndb_database_clone_refresh.py b/plugins/modules/ntnx_ndb_database_clone_refresh.py index d7bbf67a..6e3c681c 100644 --- a/plugins/modules/ntnx_ndb_database_clone_refresh.py +++ b/plugins/modules/ntnx_ndb_database_clone_refresh.py @@ -45,7 +45,7 @@ """ EXAMPLES = r""" - name: create spec for refresh clone to a pitr timestamp - check_mode: yes + check_mode: true ntnx_ndb_database_clone_refresh: uuid: "{{clone_uuid}}" pitr_timestamp: "2023-02-04 07:29:36" @@ -57,7 +57,6 @@ uuid: "{{clone_uuid}}" snapshot_uuid: "{{snapshot_uuid}}" register: result - """ RETURN = r""" response: diff --git a/plugins/modules/ntnx_ndb_database_clones.py b/plugins/modules/ntnx_ndb_database_clones.py index c7277b46..db301665 100644 --- a/plugins/modules/ntnx_ndb_database_clones.py +++ b/plugins/modules/ntnx_ndb_database_clones.py @@ -312,7 +312,7 @@ days: 2 timezone: "Asia/Calcutta" remind_before_in_days: 1 - delete_database: True + delete_database: true refresh_schedule: days: 2 @@ -356,7 +356,7 @@ days: 2 timezone: "Asia/Calcutta" remind_before_in_days: 1 - delete_database: True + delete_database: true refresh_schedule: days: 2 @@ -366,7 +366,6 @@ tags: ansible-clones: ansible-test-db-clones register: result - """ RETURN = r""" diff --git a/plugins/modules/ntnx_ndb_database_snapshots.py b/plugins/modules/ntnx_ndb_database_snapshots.py index 210e64a8..bdb35ad9 100644 --- a/plugins/modules/ntnx_ndb_database_snapshots.py +++ b/plugins/modules/ntnx_ndb_database_snapshots.py @@ -264,6 +264,7 @@ def get_module_spec(): # Notes: # 1. Currently we only poll for source snapshot create. Replication task is not polled. + # Create snapshot def create_snapshot(module, result): time_machine_uuid = module.params.get("time_machine_uuid") diff --git a/plugins/modules/ntnx_ndb_databases_info.py b/plugins/modules/ntnx_ndb_databases_info.py index a9e5430b..6a168e19 100644 --- a/plugins/modules/ntnx_ndb_databases_info.py +++ b/plugins/modules/ntnx_ndb_databases_info.py @@ -98,7 +98,7 @@ - name: Get era databases using its id and detailed response ntnx_ndb_databases_info: filters: - detailed: True + detailed: true uuid: "" register: result no_log: true diff --git a/plugins/modules/ntnx_ndb_maintenance_window.py b/plugins/modules/ntnx_ndb_maintenance_window.py index f8299636..d08d679d 100644 --- a/plugins/modules/ntnx_ndb_maintenance_window.py +++ b/plugins/modules/ntnx_ndb_maintenance_window.py @@ -91,9 +91,7 @@ day_of_week: "tuesday" week_of_month: 2 timezone: "UTC" - register: result - """ RETURN = r""" response: diff --git a/plugins/modules/ntnx_ndb_profiles.py b/plugins/modules/ntnx_ndb_profiles.py index d0a3de9e..c9231dac 100644 --- a/plugins/modules/ntnx_ndb_profiles.py +++ b/plugins/modules/ntnx_ndb_profiles.py @@ -370,7 +370,7 @@ autovacuum_vacuum_scale_factor: "{{autovacuum_vacuum_scale_factor}}" autovacuum_work_mem: "{{autovacuum_work_mem}}" autovacuum_max_workers: "{{autovacuum_max_workers}}" - autovacuum_vacuum_cost_delay: "{{autovacuum_vacuum_cost_delay}}" + autovacuum_vacuum_cost_delay: "{{autovacuum_vacuum_cost_delay}}" wal_buffers: "{{wal_buffers}}" synchronous_commit: "{{synchronous_commit}}" random_page_cost: "{{random_page_cost}}" @@ -385,8 +385,7 @@ network: topology: single vlans: - - - cluster: + - cluster: name: "{{network_profile.single.cluster.name}}" vlan_name: "{{network_profile.single.vlan_name}}" enable_ip_address_selection: true @@ -401,12 +400,10 @@ network: topology: cluster vlans: - - - cluster: + - cluster: name: "{{network_profile.HA.cluster1.name}}" vlan_name: "{{network_profile.HA.cluster1.vlan_name}}" - - - cluster: + - cluster: name: "{{network_profile.HA.cluster2.name}}" vlan_name: "{{network_profile.HA.cluster2.vlan_name}}" @@ -416,9 +413,9 @@ desc: "testdesc" type: compute compute: - vcpus: 2 - cores_per_cpu: 4 - memory: 8 + vcpus: 2 + cores_per_cpu: 4 + memory: 8 register: result - name: create software profile with base version and cluster instance topology. Replicated to multiple clusters @@ -456,7 +453,6 @@ register: result - - name: update software profile version ntnx_ndb_profiles: profile_uuid: "{{profile_uuid}}" @@ -473,9 +469,8 @@ profile_uuid: "{{profile_uuid}}" software: version_uuid: "{{version_uuid}}" - publish: True + publish: true register: result - """ RETURN = r""" diff --git a/plugins/modules/ntnx_ndb_profiles_info.py b/plugins/modules/ntnx_ndb_profiles_info.py index ffed1b3b..e382a90a 100644 --- a/plugins/modules/ntnx_ndb_profiles_info.py +++ b/plugins/modules/ntnx_ndb_profiles_info.py @@ -124,7 +124,6 @@ uuid: "" latest_version: true register: result - """ RETURN = r""" response: diff --git a/plugins/modules/ntnx_ndb_register_database.py b/plugins/modules/ntnx_ndb_register_database.py index 0c8b963c..1dbf53eb 100644 --- a/plugins/modules/ntnx_ndb_register_database.py +++ b/plugins/modules/ntnx_ndb_register_database.py @@ -326,7 +326,7 @@ username: "{{vm_username}}" password: "{{vm_password}}" desc: "vm-desc-updated" - reset_desc_in_ntnx_cluster: True + reset_desc_in_ntnx_cluster: true cluster: name: "{{cluster.cluster1.name}}" diff --git a/plugins/modules/ntnx_ndb_register_db_server_vm.py b/plugins/modules/ntnx_ndb_register_db_server_vm.py index 3c5a9c24..674ae52f 100644 --- a/plugins/modules/ntnx_ndb_register_db_server_vm.py +++ b/plugins/modules/ntnx_ndb_register_db_server_vm.py @@ -141,7 +141,6 @@ username: "{{vm_username}}" password: "{{vm_password}}" register: result - """ RETURN = r""" response: diff --git a/plugins/modules/ntnx_ndb_slas_info.py b/plugins/modules/ntnx_ndb_slas_info.py index b16f6b43..8dfe6bb1 100644 --- a/plugins/modules/ntnx_ndb_slas_info.py +++ b/plugins/modules/ntnx_ndb_slas_info.py @@ -55,7 +55,6 @@ validate_certs: false uuid: "" register: result - """ RETURN = r""" response: diff --git a/plugins/modules/ntnx_ndb_snapshots_info.py b/plugins/modules/ntnx_ndb_snapshots_info.py index bd34bded..0f31542c 100644 --- a/plugins/modules/ntnx_ndb_snapshots_info.py +++ b/plugins/modules/ntnx_ndb_snapshots_info.py @@ -83,7 +83,6 @@ uuid: "" get_files: true register: result - """ RETURN = r""" response: diff --git a/plugins/modules/ntnx_ndb_stretched_vlans.py b/plugins/modules/ntnx_ndb_stretched_vlans.py index a413a6df..0fd3be0f 100644 --- a/plugins/modules/ntnx_ndb_stretched_vlans.py +++ b/plugins/modules/ntnx_ndb_stretched_vlans.py @@ -51,40 +51,39 @@ """ EXAMPLES = r""" - - name: create ndb stretched vlan - ntnx_ndb_stretched_vlans: - nutanix_host: - nutanix_username: - nutanix_password: - validate_certs: false - name: test-vlan-name - vlans: - - "00000000-0000-0000-0000-000000000000" - - "00000000-0000-0000-0000-000000000000" - register: result - - - name: update ndb stretched vlan - ntnx_ndb_stretched_vlans: - nutanix_host: - nutanix_username: - nutanix_password: - validate_certs: false - stretched_vlan_uuid: "" - vlans: - - "00000000-0000-0000-0000-000000000000" - - "00000000-0000-0000-0000-000000000000" - register: result - - - name: Delete stretched vlan - ntnx_ndb_stretched_vlans: - nutanix_host: "" - nutanix_username: - nutanix_password: - validate_certs: false - state: absent - stretched_vlan_uuid: "" - register: result - +- name: create ndb stretched vlan + ntnx_ndb_stretched_vlans: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + name: test-vlan-name + vlans: + - "00000000-0000-0000-0000-000000000000" + - "00000000-0000-0000-0000-000000000000" + register: result + +- name: update ndb stretched vlan + ntnx_ndb_stretched_vlans: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + stretched_vlan_uuid: "" + vlans: + - "00000000-0000-0000-0000-000000000000" + - "00000000-0000-0000-0000-000000000000" + register: result + +- name: Delete stretched vlan + ntnx_ndb_stretched_vlans: + nutanix_host: "" + nutanix_username: + nutanix_password: + validate_certs: false + state: absent + stretched_vlan_uuid: "" + register: result """ RETURN = r""" diff --git a/plugins/modules/ntnx_ndb_tags.py b/plugins/modules/ntnx_ndb_tags.py index bf145c4c..9d741f67 100644 --- a/plugins/modules/ntnx_ndb_tags.py +++ b/plugins/modules/ntnx_ndb_tags.py @@ -59,7 +59,7 @@ ntnx_ndb_tags: name: "{{tag_name}}-clone" desc: tag-created-by-ansible - tag_value_required: False + tag_value_required: false entity_type: CLONE register: result @@ -67,7 +67,7 @@ ntnx_ndb_tags: name: "{{tag_name}}-tm" desc: tag-created-by-ansible - tag_value_required: True + tag_value_required: true entity_type: TIME_MACHINE register: result diff --git a/plugins/modules/ntnx_ndb_time_machine_clusters.py b/plugins/modules/ntnx_ndb_time_machine_clusters.py index 576abf9f..5d589931 100644 --- a/plugins/modules/ntnx_ndb_time_machine_clusters.py +++ b/plugins/modules/ntnx_ndb_time_machine_clusters.py @@ -70,7 +70,6 @@ """ EXAMPLES = r""" - - name: create data access instance with cluster name and sla name ntnx_ndb_time_machine_clusters: nutanix_host: @@ -86,31 +85,29 @@ - name: update data access instance with new sla name ntnx_ndb_time_machine_clusters: - nutanix_host: - nutanix_username: - nutanix_password: - validate_certs: false - time_machine_uuid: "" - cluster: - name: "" - sla: - name: "" + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + time_machine_uuid: "" + cluster: + name: "" + sla: + name: "" register: result - name: delete time machine ntnx_ndb_time_machine_clusters: - nutanix_host: - nutanix_username: - nutanix_password: - validate_certs: false - state: absent - time_machine_uuid: "" - cluster: - uuid: "" + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + state: absent + time_machine_uuid: "" + cluster: + uuid: "" register: result - """ - RETURN = r""" response: description: An intentful representation of a TM status diff --git a/plugins/modules/ntnx_ndb_vlans.py b/plugins/modules/ntnx_ndb_vlans.py index 70984491..89a9f011 100644 --- a/plugins/modules/ntnx_ndb_vlans.py +++ b/plugins/modules/ntnx_ndb_vlans.py @@ -108,7 +108,7 @@ nutanix_username: nutanix_password: validate_certs: false - name: test-vlan-name + name: test-vlan-name vlan_type: DHCP cluster: uuid: "" @@ -120,7 +120,7 @@ nutanix_username: nutanix_password: validate_certs: false - name: test-vlan-name + name: test-vlan-name vlan_type: Static cluster: uuid: "" @@ -157,7 +157,6 @@ state: absent vlan_uuid: "" register: result - """ RETURN = r""" diff --git a/plugins/modules/ntnx_ndb_vlans_info.py b/plugins/modules/ntnx_ndb_vlans_info.py index 8b34f07d..a4b3e78b 100644 --- a/plugins/modules/ntnx_ndb_vlans_info.py +++ b/plugins/modules/ntnx_ndb_vlans_info.py @@ -55,7 +55,6 @@ validate_certs: false uuid: "" register: result - """ RETURN = r""" response: diff --git a/plugins/modules/ntnx_pbrs.py b/plugins/modules/ntnx_pbrs.py index c4e8feeb..17f63bf6 100644 --- a/plugins/modules/ntnx_pbrs.py +++ b/plugins/modules/ntnx_pbrs.py @@ -183,7 +183,7 @@ - name: create PBR with vpc name with any source or destination or protocol with deny action ntnx_pbrs: - validate_certs: False + validate_certs: false state: present nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" @@ -192,17 +192,17 @@ vpc: name: "{{ vpc.name }}" source: - any: True + any: true destination: - any: True + any: true action: - deny: True + deny: true protocol: - any: True + any: true - name: create PBR with vpc uuid with source Any and destination external and allow action with protocol number ntnx_pbrs: - validate_certs: False + validate_certs: false state: present nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" @@ -211,18 +211,18 @@ vpc: uuid: "{{ vpc.uuid }}" source: - any: True + any: true destination: - external: True + external: true action: - allow: True + allow: true type: bool protocol: number: "{{ protocol.number }}" - name: create PBR with vpc name with source external and destination network with reroute action and tcp port rangelist ntnx_pbrs: - validate_certs: False + validate_certs: false state: present nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" @@ -231,7 +231,7 @@ vpc: name: "{{ vpc.name }}" source: - external: True + external: true destination: network: ip: "{{ network.ip }}" @@ -245,7 +245,7 @@ - name: create PBR with vpc name with source network and destination external with reroute action and udp port rangelist ntnx_pbrs: - validate_certs: False + validate_certs: false state: present nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" @@ -258,7 +258,7 @@ ip: "{{ network.ip }}" prefix: "{{ network.prefix }}" destination: - any: True + any: true action: reroute: "{{reroute_ip}}" protocol: @@ -268,7 +268,7 @@ - name: create PBR with vpc name with source network and destination external with reroute action and icmp ntnx_pbrs: - validate_certs: False + validate_certs: false state: present nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" @@ -281,7 +281,7 @@ ip: "{{ network.ip }}" prefix: "{{ network.prefix }}" destination: - external: True + external: true action: reroute: "{{ reroute_ip }}" protocol: diff --git a/plugins/modules/ntnx_pbrs_info.py b/plugins/modules/ntnx_pbrs_info.py index 082a46e7..bd104d60 100644 --- a/plugins/modules/ntnx_pbrs_info.py +++ b/plugins/modules/ntnx_pbrs_info.py @@ -33,29 +33,28 @@ - Dina AbuHijleh (@dina-abuhijleh) """ EXAMPLES = r""" - - name: List pbrs using priority filter criteria - ntnx_pbrs_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - filter: - priority: "2" - kind: routing_policy - register: result - - - name: List pbrs using length, offset, sort order and priority sort attribute - ntnx_pbrs_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - length: 2 - offset: 0 - sort_order: "ASCENDING" - sort_attribute: "priority" - register: result - +- name: List pbrs using priority filter criteria + ntnx_pbrs_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filter: + priority: "2" + kind: routing_policy + register: result + +- name: List pbrs using length, offset, sort order and priority sort attribute + ntnx_pbrs_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + length: 2 + offset: 0 + sort_order: "ASCENDING" + sort_attribute: "priority" + register: result """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_projects.py b/plugins/modules/ntnx_projects.py index 935917f8..59ed1936 100644 --- a/plugins/modules/ntnx_projects.py +++ b/plugins/modules/ntnx_projects.py @@ -237,7 +237,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false name: "test-ansible-project-1" desc: desc-123 subnets: diff --git a/plugins/modules/ntnx_projects_info.py b/plugins/modules/ntnx_projects_info.py index 17502b96..4c613408 100644 --- a/plugins/modules/ntnx_projects_info.py +++ b/plugins/modules/ntnx_projects_info.py @@ -41,7 +41,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false filter: name: "test-ansible-project-7" @@ -50,7 +50,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false register: result - name: List project using project uuid criteria @@ -58,10 +58,9 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false project_uuid: "" register: result - """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_protection_rules.py b/plugins/modules/ntnx_protection_rules.py index 2f36ae8c..ffacec22 100644 --- a/plugins/modules/ntnx_protection_rules.py +++ b/plugins/modules/ntnx_protection_rules.py @@ -238,7 +238,7 @@ nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" validate_certs: "{{ validate_certs }}" - wait: True + wait: true name: test-ansible desc: test-ansible-desc protected_categories: @@ -269,7 +269,7 @@ nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" validate_certs: "{{ validate_certs }}" - wait: True + wait: true name: test-ansible desc: test-ansible-desc protected_categories: @@ -280,7 +280,7 @@ availability_zone_url: "{{primary_az_url}}" schedules: - source: - availability_zone_url: "{{primary_az_url}}" + availability_zone_url: "{{primary_az_url}}" destination: availability_zone_url: "{{recovery_az_url}}" protection_type: ASYNC @@ -315,7 +315,7 @@ nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" validate_certs: "{{ validate_certs }}" - wait: True + wait: true rule_uuid: "{{rule_uuid}}" name: test-ansible-updated desc: test-ansible-desc-updated @@ -326,7 +326,7 @@ availability_zone_url: "{{primary_az_url}}" schedules: - source: - availability_zone_url: "{{primary_az_url}}" + availability_zone_url: "{{primary_az_url}}" destination: availability_zone_url: "{{recovery_az_url}}" protection_type: ASYNC @@ -361,10 +361,9 @@ nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" validate_certs: "{{ validate_certs }}" - wait: True + wait: true rule_uuid: "{{ rule_uuid }}" register: result - """ RETURN = r""" diff --git a/plugins/modules/ntnx_protection_rules_info.py b/plugins/modules/ntnx_protection_rules_info.py index 218581dd..dd339e77 100644 --- a/plugins/modules/ntnx_protection_rules_info.py +++ b/plugins/modules/ntnx_protection_rules_info.py @@ -37,7 +37,6 @@ - Pradeepsingh Bhati (@bhati-pradeep) """ EXAMPLES = r""" - - name: List all Protection rules ntnx_protection_rules_info: nutanix_host: "{{ ip }}" @@ -45,7 +44,6 @@ nutanix_password: "{{ password }}" validate_certs: "{{ validate_certs }}" register: result - ignore_errors: True - name: List protection rule using uuid criteria ntnx_protection_rules_info: @@ -55,7 +53,6 @@ validate_certs: "{{ validate_certs }}" rule_uuid: "{{ test_rule_uuid }}" register: result - """ RETURN = r""" rule_affected_entities: diff --git a/plugins/modules/ntnx_recovery_plan_jobs.py b/plugins/modules/ntnx_recovery_plan_jobs.py index a115d39b..a5732783 100644 --- a/plugins/modules/ntnx_recovery_plan_jobs.py +++ b/plugins/modules/ntnx_recovery_plan_jobs.py @@ -166,7 +166,6 @@ state: "present" action: CLEANUP register: result - """ RETURN = r""" diff --git a/plugins/modules/ntnx_recovery_plan_jobs_info.py b/plugins/modules/ntnx_recovery_plan_jobs_info.py index c12374c4..b66d9811 100644 --- a/plugins/modules/ntnx_recovery_plan_jobs_info.py +++ b/plugins/modules/ntnx_recovery_plan_jobs_info.py @@ -45,7 +45,6 @@ nutanix_password: "{{ password }}" validate_certs: "{{ validate_certs }}" register: result - ignore_errors: True - name: List recovery plan job using uuid criteria ntnx_recovery_plan_jobs_info: @@ -55,7 +54,6 @@ validate_certs: "{{ validate_certs }}" job_uuid: "{{ job_uuid }}" register: result - """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_recovery_plans.py b/plugins/modules/ntnx_recovery_plans.py index ed9e1afa..91826c1c 100644 --- a/plugins/modules/ntnx_recovery_plans.py +++ b/plugins/modules/ntnx_recovery_plans.py @@ -475,7 +475,7 @@ name: "{{dr.recovery_site_network}}" - name: Update stage categories - check_mode: yes + check_mode: true ntnx_recovery_plans: nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" @@ -505,10 +505,9 @@ nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" validate_certs: "{{ validate_certs }}" - wait: True + wait: true plan_uuid: "{{ recovery_plan2.plan_uuid }}" register: result - """ RETURN = r""" diff --git a/plugins/modules/ntnx_recovery_plans_info.py b/plugins/modules/ntnx_recovery_plans_info.py index 6ec1e422..5aeb421f 100644 --- a/plugins/modules/ntnx_recovery_plans_info.py +++ b/plugins/modules/ntnx_recovery_plans_info.py @@ -43,7 +43,6 @@ nutanix_password: "{{ password }}" validate_certs: "{{ validate_certs }}" register: result - ignore_errors: True - name: List recovery plans using uuid criteria ntnx_recovery_plans_info: diff --git a/plugins/modules/ntnx_security_rules.py b/plugins/modules/ntnx_security_rules.py index 84f78fae..6c2f05c7 100644 --- a/plugins/modules/ntnx_security_rules.py +++ b/plugins/modules/ntnx_security_rules.py @@ -887,29 +887,29 @@ policy_mode: MONITOR target_group: categories: - apptype: Apache_Spark + apptype: Apache_Spark default_internal_policy: DENY_ALL inbounds: - categories: - AppFamily: - - Databases - - DevOps + AppFamily: + - Databases + - DevOps protocol: icmp: - code: 1 type: 1 - categories: - AppFamily: - - Databases - - DevOps + AppFamily: + - Databases + - DevOps protocol: tcp: - start_port: 22 end_port: 80 - categories: - AppFamily: - - Databases - - DevOps + AppFamily: + - Databases + - DevOps protocol: udp: - start_port: 82 @@ -920,12 +920,12 @@ prefix_length: 24 outbounds: - categories: - AppFamily: - - Databases + AppFamily: + - Databases register: result - name: update app security rule with outbound list ntnx_security_rules: - security_rule_uuid: '{{ result.response.metadata.uuid }}' + security_rule_uuid: "{{ result.response.metadata.uuid }}" app_rule: policy_mode: APPLY outbound: @@ -933,24 +933,24 @@ - code: 1 type: 1 categories: - AppFamily: - - Databases - - DevOps + AppFamily: + - Databases + - DevOps register: result - name: update quarantine_rule by adding inbound and outbound list ntnx_security_rules: - security_rule_uuid: '{{quarantine_rule_uuid}}' + security_rule_uuid: "{{quarantine_rule_uuid}}" quarantine_rule: inbound: - categories: - AppFamily: - - Databases - - DevOps + AppFamily: + - Databases + - DevOps outbound: - categories: - AppFamily: - - Databases - - DevOps + AppFamily: + - Databases + - DevOps policy_mode: MONITOR allow_ipv6_traffic: true policy_hitlog:: true @@ -1103,6 +1103,7 @@ from ..module_utils.base_module import BaseModule # noqa: E402 from ..module_utils.prism.security_rules import SecurityRule # noqa: E402 from ..module_utils.prism.tasks import Task # noqa: E402 +from ..module_utils.utils import check_for_idempotency # noqa: E402 from ..module_utils.utils import remove_param_with_none_value # noqa: E402 @@ -1261,7 +1262,7 @@ def update_security_rule(module, result): result["response"] = spec return - if utils.check_for_idempotency(spec, resp, state=state): + if check_for_idempotency(spec, resp, state=state): result["skipped"] = True module.exit_json(msg="Nothing to change") diff --git a/plugins/modules/ntnx_security_rules_info.py b/plugins/modules/ntnx_security_rules_info.py index 30ac5fec..550086b1 100644 --- a/plugins/modules/ntnx_security_rules_info.py +++ b/plugins/modules/ntnx_security_rules_info.py @@ -39,28 +39,28 @@ - Alaa Bishtawi (@alaa-bish) """ EXAMPLES = r""" - - name: List security_rule using name filter criteria - ntnx_security_rules_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - filter: - name: "{{ security_rule.name }}" - kind: security_rule - register: result - - - name: List security_rule using length, offset, sort order and name sort attribute - ntnx_security_rules_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - length: 1 - offset: 1 - sort_order: "ASCENDING" - sort_attribute: "name" - register: result +- name: List security_rule using name filter criteria + ntnx_security_rules_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filter: + name: "{{ security_rule.name }}" + kind: security_rule + register: result + +- name: List security_rule using length, offset, sort order and name sort attribute + ntnx_security_rules_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + length: 1 + offset: 1 + sort_order: "ASCENDING" + sort_attribute: "name" + register: result """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_service_groups.py b/plugins/modules/ntnx_service_groups.py index 85528837..62e60754 100644 --- a/plugins/modules/ntnx_service_groups.py +++ b/plugins/modules/ntnx_service_groups.py @@ -83,7 +83,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false name: app_srvive_group desc: desc service_details: @@ -93,7 +93,7 @@ - "10-50" - "60-90" - "99" - any_icmp: True + any_icmp: true register: result - name: create service group with icmp @@ -101,7 +101,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false name: icmp_srvive_group desc: desc service_details: @@ -117,7 +117,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false service_group_uuid: "{{service_group_uuid}}" name: updated_name desc: updated_desc diff --git a/plugins/modules/ntnx_service_groups_info.py b/plugins/modules/ntnx_service_groups_info.py index 7fe0c0a6..7977fc94 100644 --- a/plugins/modules/ntnx_service_groups_info.py +++ b/plugins/modules/ntnx_service_groups_info.py @@ -39,28 +39,28 @@ - Alaa Bishtawi (@alaa-bish) """ EXAMPLES = r""" - - name: List service_group using name filter criteria - ntnx_service_groups_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - filter: - name: "{{ service_group.name }}" - kind: service_group - register: result - - - name: List service_group using length, offset, sort order and name sort attribute - ntnx_service_groups_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - length: 1 - offset: 1 - sort_order: "ASCENDING" - sort_attribute: "name" - register: result +- name: List service_group using name filter criteria + ntnx_service_groups_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filter: + name: "{{ service_group.name }}" + kind: service_group + register: result + +- name: List service_group using length, offset, sort order and name sort attribute + ntnx_service_groups_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + length: 1 + offset: 1 + sort_order: "ASCENDING" + sort_attribute: "name" + register: result """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_static_routes.py b/plugins/modules/ntnx_static_routes.py index 9152a933..ab703b1a 100644 --- a/plugins/modules/ntnx_static_routes.py +++ b/plugins/modules/ntnx_static_routes.py @@ -104,7 +104,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false vpc_uuid: "{{ vpc.uuid }}" static_routes: - destination: "0.0.0.0/0" @@ -130,7 +130,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false vpc_uuid: "{{ vpc.uuid }}" remove_all_routes: true register: result diff --git a/plugins/modules/ntnx_subnets.py b/plugins/modules/ntnx_subnets.py index 1be8363c..896aea5d 100644 --- a/plugins/modules/ntnx_subnets.py +++ b/plugins/modules/ntnx_subnets.py @@ -291,91 +291,91 @@ """ EXAMPLES = r""" - - name: VLAN subnet with IPAM IP pools and DHCP - ntnx_subnets: - state: present - nutanix_host: "{{ ip }}" - validate_certs: false - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: VLAN subnet with IPAM IP pools and DHCP - vlan_subnet: - vlan_id: "{{vlan_subnets_ids.3}}" - virtual_switch: - name: "{{ virtual_switch.name }}" - cluster: - name: "{{ cluster.name }}" - ipam: - network_ip: "{{ network_ip }}" - network_prefix: "{{ network_prefix }}" - gateway_ip: "{{ gateway_ip_address }}" - ip_pools: - - start_ip: "{{ start_address }}" - end_ip: "{{ end_address }}" - dhcp: - dns_servers: "{{ dns_servers }}" - domain_search: "{{ domain_search }}" - domain_name: "{{ domain_name }}" - tftp_server_name: "{{ tftp_server_name }}" - boot_file: "{{ boot_file }}" - dhcp_server_ip: "{{ dhcp_server_address }}" - - - name: External subnet with NAT - ntnx_subnets: - state: present - nutanix_host: "{{ ip }}" - validate_certs: false - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: " External subnet with NAT " - external_subnet: - vlan_id: "{{ vlan_id }}" - enable_nat: True - cluster: - name: "{{ cluster_name }}" - ipam: - network_ip: "{{ network_ip }}" - network_prefix: "{{ network_prefix }}" - gateway_ip: "{{ gateway_ip_address }}" - ip_pools: - - start_ip: "{{ dhcp.start_address }}" - end_ip: "{{ dhcp.end_address }}" - - start_ip: "{{ static.start_address }}" - end_ip: "{{ static.end_address }}" - - - name: Overlay Subnet with IP_pools and DHCP - ntnx_subnets: - state: present - nutanix_host: "{{ ip }}" - validate_certs: false - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: Overlay Subnet with IP_pools and DHCP - overlay_subnet: - vpc: - name: "{{ vpc_name }}" - ipam: - network_ip: "{{ network_ip }}" - network_prefix: "{{ network_prefix }}" - gateway_ip: "{{ gateway_ip_address }}" - ip_pools: - - start_ip: "{{ start_address }}" - end_ip: "{{ end_address }}" - dhcp: - dns_servers: "{{ dns_servers }}" - domain_search: "{{ domain_search }}" - domain_name: "{{ domain_name }}" - tftp_server_name: "{{ tftp_server_name }}" - boot_file: "{{ boot_file }}" - - - name: Delete subnets - ntnx_subnets: - state: absent - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - subnet_uuid: "{{ subnet_uuid }}" +- name: VLAN subnet with IPAM IP pools and DHCP + ntnx_subnets: + state: present + nutanix_host: "{{ ip }}" + validate_certs: false + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: VLAN subnet with IPAM IP pools and DHCP + vlan_subnet: + vlan_id: "{{vlan_subnets_ids.3}}" + virtual_switch: + name: "{{ virtual_switch.name }}" + cluster: + name: "{{ cluster.name }}" + ipam: + network_ip: "{{ network_ip }}" + network_prefix: "{{ network_prefix }}" + gateway_ip: "{{ gateway_ip_address }}" + ip_pools: + - start_ip: "{{ start_address }}" + end_ip: "{{ end_address }}" + dhcp: + dns_servers: "{{ dns_servers }}" + domain_search: "{{ domain_search }}" + domain_name: "{{ domain_name }}" + tftp_server_name: "{{ tftp_server_name }}" + boot_file: "{{ boot_file }}" + dhcp_server_ip: "{{ dhcp_server_address }}" + +- name: External subnet with NAT + ntnx_subnets: + state: present + nutanix_host: "{{ ip }}" + validate_certs: false + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: " External subnet with NAT " + external_subnet: + vlan_id: "{{ vlan_id }}" + enable_nat: true + cluster: + name: "{{ cluster_name }}" + ipam: + network_ip: "{{ network_ip }}" + network_prefix: "{{ network_prefix }}" + gateway_ip: "{{ gateway_ip_address }}" + ip_pools: + - start_ip: "{{ dhcp.start_address }}" + end_ip: "{{ dhcp.end_address }}" + - start_ip: "{{ static.start_address }}" + end_ip: "{{ static.end_address }}" + +- name: Overlay Subnet with IP_pools and DHCP + ntnx_subnets: + state: present + nutanix_host: "{{ ip }}" + validate_certs: false + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: Overlay Subnet with IP_pools and DHCP + overlay_subnet: + vpc: + name: "{{ vpc_name }}" + ipam: + network_ip: "{{ network_ip }}" + network_prefix: "{{ network_prefix }}" + gateway_ip: "{{ gateway_ip_address }}" + ip_pools: + - start_ip: "{{ start_address }}" + end_ip: "{{ end_address }}" + dhcp: + dns_servers: "{{ dns_servers }}" + domain_search: "{{ domain_search }}" + domain_name: "{{ domain_name }}" + tftp_server_name: "{{ tftp_server_name }}" + boot_file: "{{ boot_file }}" + +- name: Delete subnets + ntnx_subnets: + state: absent + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + subnet_uuid: "{{ subnet_uuid }}" """ RETURN = r""" diff --git a/plugins/modules/ntnx_subnets_info.py b/plugins/modules/ntnx_subnets_info.py index 99e7fcab..6d3b48c3 100644 --- a/plugins/modules/ntnx_subnets_info.py +++ b/plugins/modules/ntnx_subnets_info.py @@ -33,29 +33,28 @@ - Dina AbuHijleh (@dina-abuhijleh) """ EXAMPLES = r""" - - name: List subnets using type filter criteria - ntnx_subnets_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - filter: - subnet_type: "{{ subnet.type }}" - kind: subnet - register: result - - - name: List subnets using length, offset, sort order and sort attribute - ntnx_subnets_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - length: 2 - offset: 1 - sort_order: "DESCENDING" - sort_attribute: "vlan_id" - register: result - +- name: List subnets using type filter criteria + ntnx_subnets_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filter: + subnet_type: "{{ subnet.type }}" + kind: subnet + register: result + +- name: List subnets using length, offset, sort order and sort attribute + ntnx_subnets_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + length: 2 + offset: 1 + sort_order: "DESCENDING" + sort_attribute: "vlan_id" + register: result """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_user_groups.py b/plugins/modules/ntnx_user_groups.py index f549eca3..15de4ece 100644 --- a/plugins/modules/ntnx_user_groups.py +++ b/plugins/modules/ntnx_user_groups.py @@ -92,7 +92,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false distinguished_name: "" project: uuid: "{{project_uuid}}" @@ -107,7 +107,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false idp: idp_uuid: "{{idp_uuid}}" group_name: "{{group_name}}" diff --git a/plugins/modules/ntnx_user_groups_info.py b/plugins/modules/ntnx_user_groups_info.py index 0c0875e3..f3c75281 100644 --- a/plugins/modules/ntnx_user_groups_info.py +++ b/plugins/modules/ntnx_user_groups_info.py @@ -32,36 +32,36 @@ - Alaa Bishtawi (@alaa-bish) """ EXAMPLES = r""" - - name: List user groups using name filter criteria - ntnx_user_groups_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - filter: - group_name: "{{ name }}" - register: result - - - name: List user groups using length, offset, sort order and sort attribute - ntnx_user_groups_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - length: 2 - offset: 1 - sort_order: "DESCENDING" - sort_attribute: "group_name" - register: result - - - name: test getting particular user group using uuid - ntnx_user_groups_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - usergroup_uuid: '{{ uuid }}' - register: result +- name: List user groups using name filter criteria + ntnx_user_groups_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filter: + group_name: "{{ name }}" + register: result + +- name: List user groups using length, offset, sort order and sort attribute + ntnx_user_groups_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + length: 2 + offset: 1 + sort_order: "DESCENDING" + sort_attribute: "group_name" + register: result + +- name: test getting particular user group using uuid + ntnx_user_groups_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + usergroup_uuid: "{{ uuid }}" + register: result """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_users.py b/plugins/modules/ntnx_users.py index 79c7a3b5..73d338bc 100644 --- a/plugins/modules/ntnx_users.py +++ b/plugins/modules/ntnx_users.py @@ -85,9 +85,9 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false principal_name: "{{principal_name}}" - directory_service_uuid: "{{directory_service_uuid}}" + directory_service_uuid: "{{directory_service_uuid}}" project: uuid: "{{project_uuid}}" categories: @@ -102,7 +102,7 @@ nutanix_host: "{{ ip }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" - validate_certs: False + validate_certs: false identity_provider_uuid: "{{identity_provider_uuid}}" username: "{{username}}" register: result diff --git a/plugins/modules/ntnx_users_info.py b/plugins/modules/ntnx_users_info.py index 160685af..d2d08e37 100644 --- a/plugins/modules/ntnx_users_info.py +++ b/plugins/modules/ntnx_users_info.py @@ -33,36 +33,36 @@ - Alaa Bishtawi (@alaa-bish) """ EXAMPLES = r""" - - name: List users using name filter criteria - ntnx_users_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - filter: - username: "{{ name }}" - register: result - - - name: List users using length, offset, sort order and sort attribute - ntnx_users_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - length: 2 - offset: 1 - sort_order: "DESCENDING" - sort_attribute: "username" - register: result - - - name: test getting particular user using uuid - ntnx_users_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - user_uuid: '{{ uuid }}' - register: result +- name: List users using name filter criteria + ntnx_users_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filter: + username: "{{ name }}" + register: result + +- name: List users using length, offset, sort order and sort attribute + ntnx_users_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + length: 2 + offset: 1 + sort_order: "DESCENDING" + sort_attribute: "username" + register: result + +- name: test getting particular user using uuid + ntnx_users_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + user_uuid: "{{ uuid }}" + register: result """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_vms.py b/plugins/modules/ntnx_vms.py index 0cb74849..add9f3a3 100644 --- a/plugins/modules/ntnx_vms.py +++ b/plugins/modules/ntnx_vms.py @@ -38,7 +38,7 @@ description: Wait for the CRUD operation to complete. type: bool required: false - default: True + default: true desc: description: A description for VM. required: false @@ -138,322 +138,322 @@ """ EXAMPLES = r""" - - name: VM with CentOS-7-cloud-init image - ntnx_vms: - state: present - name: VM with CentOS-7-cloud-init image - timezone: "UTC" - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - cluster: - name: "{{ cluster_name }}" - disks: - - type: "DISK" - size_gb: 10 - clone_image: - name: "{{ centos }}" - bus: "SCSI" - guest_customization: - type: "cloud_init" - script_path: "./cloud_init.yml" - is_overridable: True - - - name: VM with Cluster, Network, Universal time zone, one Disk - ntnx_vms: - state: present - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - name: "VM with Cluster Network and Disk" - timezone: "Universal" - cluster: - name: "{{ cluster_name }}" - networks: - - is_connected: True - subnet: - name: "{{ network_name }}" - disks: - - type: "DISK" - size_gb: 10 - bus: "PCI" - - - name: VM with Cluster, different CDROMs - ntnx_vms: - state: present - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - name: "VM with multiple CDROMs" - cluster: - name: "{{ cluster_name }}" - disks: - - type: "CDROM" - bus: "SATA" - empty_cdrom: True - - type: "CDROM" - bus: "IDE" - empty_cdrom: True - cores_per_vcpu: 1 - - - name: VM with different disk types and different sizes with UEFI boot type - ntnx_vms: - state: present - name: VM with UEFI boot type - timezone: GMT - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - cluster: - name: "{{ cluster_name }}" - categories: - AppType: - - Apache_Spark - disks: - - type: "DISK" - clone_image: - name: "{{ ubuntu }}" - bus: "SCSI" - size_gb: 20 - - type: DISK - size_gb: 1 - bus: SCSI - - type: DISK - size_gb: 2 - bus: PCI - storage_container: - name: "{{ storage_container_name }}" - - type: DISK - size_gb: 3 - bus: SATA - boot_config: - boot_type: UEFI - boot_order: - - DISK - - CDROM - - NETWORK - vcpus: 2 - cores_per_vcpu: 1 - memory_gb: 1 - - - name: VM with managed and unmanaged network - ntnx_vms: - state: present - name: VM_NIC - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - timezone: UTC - cluster: - name: "{{ cluster.name }}" - networks: - - is_connected: true - subnet: - uuid: "{{ network.dhcp.uuid }}" - - is_connected: true - subnet: - uuid: "{{ network.static.uuid }}" - disks: - - type: DISK - size_gb: 1 - bus: SCSI - - type: DISK - size_gb: 3 - bus: PCI - - type: CDROM - bus: SATA - empty_cdrom: True - - type: CDROM - bus: IDE - empty_cdrom: True - boot_config: - boot_type: UEFI - boot_order: - - DISK - - CDROM - - NETWORK - vcpus: 2 - cores_per_vcpu: 2 - memory_gb: 2 - - - name: Delete VM - ntnx_vms: - state: absent - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - vm_uuid: '{{ vm_uuid }}' - - - name: update vm by values for memory, vcpus and cores_per_vcpu, timezone - ntnx_vms: - vm_uuid: "{{ vm.vm_uuid }}" - vcpus: 1 - cores_per_vcpu: 1 - memory_gb: 1 - timezone: UTC - - - name: Update VM by adding all type of disks - ntnx_vms: - vm_uuid: "{{ vm.vm_uuid }}" - disks: - - type: "DISK" - clone_image: - name: "{{ ubuntu }}" - bus: "SCSI" - size_gb: 20 - - type: DISK - size_gb: 1 - bus: PCI - - type: "DISK" - size_gb: 1 - bus: "SATA" - - type: "DISK" - size_gb: 1 - bus: "SCSI" - - type: DISK - size_gb: 1 - bus: SCSI - storage_container: - uuid: "{{ storage_container.uuid }}" - - type: "DISK" - bus: "IDE" - size_gb: 1 - - type: "CDROM" - bus: "IDE" - empty_cdrom: True - - - name: Update VM by increasing the size of the disks - ntnx_vms: - vm_uuid: "{{ result.vm_uuid }}" - disks: - - type: "DISK" - uuid: "{{ result.response.spec.resources.disk_list[0].uuid }}" - size_gb: 22 - - type: DISK - uuid: "{{ result.response.spec.resources.disk_list[1].uuid }}" - size_gb: 2 - - type: "DISK" - uuid: "{{ result.response.spec.resources.disk_list[2].uuid }}" - size_gb: 2 - - type: "DISK" - size_gb: 2 - uuid: "{{ result.response.spec.resources.disk_list[3].uuid }}" - - type: DISK - size_gb: 2 - uuid: "{{ result.response.spec.resources.disk_list[4].uuid }}" - - type: "DISK" - uuid: "{{ result.response.spec.resources.disk_list[5].uuid }}" - size_gb: 1 - - - name: Update VM by removing all type of disks - ntnx_vms: - vm_uuid: "{{ result.vm_uuid }}" - disks: - - state: absent - uuid: "{{ result.response.spec.resources.disk_list[0].uuid }}" - - state: absent - uuid: "{{ result.response.spec.resources.disk_list[1].uuid }}" - - state: absent - uuid: "{{ result.response.spec.resources.disk_list[2].uuid }}" - - state: absent - uuid: "{{ result.response.spec.resources.disk_list[3].uuid }}" - - state: absent - uuid: "{{ result.response.spec.resources.disk_list[4].uuid }}" - - state: absent - uuid: "{{ result.response.spec.resources.disk_list[5].uuid }}" - - state: absent - uuid: "{{ result.response.spec.resources.disk_list[6].uuid }}" - - - name: Update VM by adding subnets - ntnx_vms: - vm_uuid: "{{ result.vm_uuid }}" - networks: - - is_connected: true - subnet: - uuid: "{{ network.dhcp.uuid }}" - - is_connected: false - subnet: - uuid: "{{ static.uuid }}" - private_ip: "{{ network.static.ip }}" - - - name: Update VM by editing a subnet is_connected - ntnx_vms: - vm_uuid: "{{ vm.vm_uuid }}" - desc: disconnect and connects nic's - networks: - - is_connected: true - uuid: "{{ result.response.spec.resources.nic_list[1].uuid }}" - - is_connected: false - uuid: "{{ result.response.spec.resources.nic_list[0].uuid }}" - - - name: Update VM by change the private ip for subnet - ntnx_vms: - vm_uuid: "{{ vm.vm_uuid }}" - name: updated - desc: change ip - networks: - - is_connected: true - private_ip: "10.30.30.79" - uuid: "{{ result.response.spec.resources.nic_list[1].uuid }}" - - - name: Update VM by change vlan subnet - ntnx_vms: - vm_uuid: "{{ vm.vm_uuid }}" - name: updated - desc: change vlan - categories: - AppType: - - Apache_Spark - networks: - - is_connected: false - subnet: - name: vlan1211 - uuid: "{{ result.response.spec.resources.nic_list[0].uuid }}" - - - name: Update VM by deleting a subnet - ntnx_vms: - vm_uuid: "{{ vm.vm_uuid }}" - networks: - - state: absent - uuid: "{{ result.response.spec.resources.nic_list[0].uuid }}" - - state: absent - uuid: "{{ result.response.spec.resources.nic_list[1].uuid }}" - - - name: hard power off the vm - ntnx_vms: - vm_uuid: "{{ vm.vm_uuid }}" - state: hard_poweroff - register: result - ignore_errors: true - - name: power on the vm - ntnx_vms: - state: power_on - vm_uuid: "{{ vm.vm_uuid }}" - - - name: soft shut down the vm - ntnx_vms: - state: soft_shutdown - vm_uuid: "{{ vm.vm_uuid }}" - - - name: Create VM with minimum requirements with hard_poweroff operation - ntnx_vms: - state: hard_poweroff - name: integration_test_opperations_vm - cluster: - name: "{{ cluster.name }}" - - - name: Create VM with minimum requirements with poweroff operation - ntnx_vms: - state: power_off - name: integration_test_opperations_vm - cluster: - name: "{{ cluster.name }}" +- name: VM with CentOS-7-cloud-init image + ntnx_vms: + state: present + name: VM with CentOS-7-cloud-init image + timezone: "UTC" + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + cluster: + name: "{{ cluster_name }}" + disks: + - type: "DISK" + size_gb: 10 + clone_image: + name: "{{ centos }}" + bus: "SCSI" + guest_customization: + type: "cloud_init" + script_path: "./cloud_init.yml" + is_overridable: true + +- name: VM with Cluster, Network, Universal time zone, one Disk + ntnx_vms: + state: present + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + name: "VM with Cluster Network and Disk" + timezone: "Universal" + cluster: + name: "{{ cluster_name }}" + networks: + - is_connected: true + subnet: + name: "{{ network_name }}" + disks: + - type: "DISK" + size_gb: 10 + bus: "PCI" + +- name: VM with Cluster, different CDROMs + ntnx_vms: + state: present + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + name: "VM with multiple CDROMs" + cluster: + name: "{{ cluster_name }}" + disks: + - type: "CDROM" + bus: "SATA" + empty_cdrom: true + - type: "CDROM" + bus: "IDE" + empty_cdrom: true + cores_per_vcpu: 1 + +- name: VM with diffrent disk types and diffrent sizes with UEFI boot type + ntnx_vms: + state: present + name: VM with UEFI boot type + timezone: GMT + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + cluster: + name: "{{ cluster_name }}" + categories: + AppType: + - Apache_Spark + disks: + - type: "DISK" + clone_image: + name: "{{ ubuntu }}" + bus: "SCSI" + size_gb: 20 + - type: DISK + size_gb: 1 + bus: SCSI + - type: DISK + size_gb: 2 + bus: PCI + storage_container: + name: "{{ storage_container_name }}" + - type: DISK + size_gb: 3 + bus: SATA + boot_config: + boot_type: UEFI + boot_order: + - DISK + - CDROM + - NETWORK + vcpus: 2 + cores_per_vcpu: 1 + memory_gb: 1 + +- name: VM with managed and unmanaged network + ntnx_vms: + state: present + name: VM_NIC + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + timezone: UTC + cluster: + name: "{{ cluster.name }}" + networks: + - is_connected: true + subnet: + uuid: "{{ network.dhcp.uuid }}" + - is_connected: true + subnet: + uuid: "{{ network.static.uuid }}" + disks: + - type: DISK + size_gb: 1 + bus: SCSI + - type: DISK + size_gb: 3 + bus: PCI + - type: CDROM + bus: SATA + empty_cdrom: true + - type: CDROM + bus: IDE + empty_cdrom: true + boot_config: + boot_type: UEFI + boot_order: + - DISK + - CDROM + - NETWORK + vcpus: 2 + cores_per_vcpu: 2 + memory_gb: 2 + +- name: Delete VM + ntnx_vms: + state: absent + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + vm_uuid: '{{ vm_uuid }}' +- name: update vm by values for memory, vcpus and cores_per_vcpu, timezone + ntnx_vms: + vm_uuid: "{{ vm.vm_uuid }}" + vcpus: 1 + cores_per_vcpu: 1 + memory_gb: 1 + timezone: UTC + +- name: Update VM by adding all type of disks + ntnx_vms: + vm_uuid: "{{ vm.vm_uuid }}" + disks: + - type: "DISK" + clone_image: + name: "{{ ubuntu }}" + bus: "SCSI" + size_gb: 20 + - type: DISK + size_gb: 1 + bus: PCI + - type: "DISK" + size_gb: 1 + bus: "SATA" + - type: "DISK" + size_gb: 1 + bus: "SCSI" + - type: DISK + size_gb: 1 + bus: SCSI + storage_container: + uuid: "{{ storage_container.uuid }}" + - type: "DISK" + bus: "IDE" + size_gb: 1 + - type: "CDROM" + bus: "IDE" + empty_cdrom: true + +- name: Update VM by increasing the size of the disks + ntnx_vms: + vm_uuid: "{{ result.vm_uuid }}" + disks: + - type: "DISK" + uuid: "{{ result.response.spec.resources.disk_list[0].uuid }}" + size_gb: 22 + - type: DISK + uuid: "{{ result.response.spec.resources.disk_list[1].uuid }}" + size_gb: 2 + - type: "DISK" + uuid: "{{ result.response.spec.resources.disk_list[2].uuid }}" + size_gb: 2 + - type: "DISK" + size_gb: 2 + uuid: "{{ result.response.spec.resources.disk_list[3].uuid }}" + - type: DISK + size_gb: 2 + uuid: "{{ result.response.spec.resources.disk_list[4].uuid }}" + - type: "DISK" + uuid: "{{ result.response.spec.resources.disk_list[5].uuid }}" + size_gb: 1 + +- name: Update VM by removing all type of disks + ntnx_vms: + vm_uuid: "{{ result.vm_uuid }}" + disks: + - state: absent + uuid: "{{ result.response.spec.resources.disk_list[0].uuid }}" + - state: absent + uuid: "{{ result.response.spec.resources.disk_list[1].uuid }}" + - state: absent + uuid: "{{ result.response.spec.resources.disk_list[2].uuid }}" + - state: absent + uuid: "{{ result.response.spec.resources.disk_list[3].uuid }}" + - state: absent + uuid: "{{ result.response.spec.resources.disk_list[4].uuid }}" + - state: absent + uuid: "{{ result.response.spec.resources.disk_list[5].uuid }}" + - state: absent + uuid: "{{ result.response.spec.resources.disk_list[6].uuid }}" + +- name: Update VM by adding subnets + ntnx_vms: + vm_uuid: "{{ result.vm_uuid }}" + networks: + - is_connected: true + subnet: + uuid: "{{ network.dhcp.uuid }}" + - is_connected: false + subnet: + uuid: "{{ static.uuid }}" + private_ip: "{{ network.static.ip }}" + +- name: Update VM by editing a subnet is_connected + ntnx_vms: + vm_uuid: "{{ vm.vm_uuid }}" + desc: disconnect and connects nic's + networks: + - is_connected: true + uuid: "{{ result.response.spec.resources.nic_list[1].uuid }}" + - is_connected: false + uuid: "{{ result.response.spec.resources.nic_list[0].uuid }}" + +- name: Update VM by change the private ip for subnet + ntnx_vms: + vm_uuid: "{{ vm.vm_uuid }}" + name: updated + desc: change ip + networks: + - is_connected: true + private_ip: "10.30.30.79" + uuid: "{{ result.response.spec.resources.nic_list[1].uuid }}" + +- name: Update VM by change vlan subnet + ntnx_vms: + vm_uuid: "{{ vm.vm_uuid }}" + name: updated + desc: change vlan + categories: + AppType: + - Apache_Spark + networks: + - is_connected: false + subnet: + name: vlan1211 + uuid: "{{ result.response.spec.resources.nic_list[0].uuid }}" + +- name: Update VM by deleting a subnet + ntnx_vms: + vm_uuid: "{{ vm.vm_uuid }}" + networks: + - state: absent + uuid: "{{ result.response.spec.resources.nic_list[0].uuid }}" + - state: absent + uuid: "{{ result.response.spec.resources.nic_list[1].uuid }}" + +- name: hard power off the vm + ntnx_vms: + vm_uuid: "{{ vm.vm_uuid }}" + state: hard_poweroff + register: result + ignore_errors: true + +- name: power on the vm + ntnx_vms: + state: power_on + vm_uuid: "{{ vm.vm_uuid }}" + +- name: soft shut down the vm + ntnx_vms: + state: soft_shutdown + vm_uuid: "{{ vm.vm_uuid }}" + +- name: Create VM with minimum requiremnts with hard_poweroff opperation + ntnx_vms: + state: hard_poweroff + name: integration_test_opperations_vm + cluster: + name: "{{ cluster.name }}" + +- name: Create VM with minimum requiremnts with poweroff opperation + ntnx_vms: + state: power_off + name: integration_test_opperations_vm + cluster: + name: "{{ cluster.name }}" """ RETURN = r""" @@ -749,6 +749,7 @@ from ..module_utils.prism.spec.vms import DefaultVMSpec # noqa: E402 from ..module_utils.prism.tasks import Task # noqa: E402 from ..module_utils.prism.vms import VM # noqa: E402 +from ..module_utils.utils import check_for_idempotency # noqa: E402 def get_module_spec(): @@ -871,7 +872,7 @@ def update_vm(module, result): result["response"] = spec return - if utils.check_for_idempotency(spec, resp, state=state): + if check_for_idempotency(spec, resp, state=state): result["skipped"] = True module.exit_json(msg="Nothing to change") @@ -881,8 +882,7 @@ def update_vm(module, result): if is_vm_on and vm.is_restart_required(): if not module.params.get("force_power_off"): module.fail_json( - msg="To make these changes, the VM should be restarted, but 'force_power_off' is False", - **result, + "To make these changes, the VM should be restarted, but 'force_power_off' is False" ) power_off_vm(vm, module, result) @@ -928,9 +928,9 @@ def update_vm(module, result): wait_for_task_completion(module, result, False) response_state = result["response"].get("status") if response_state == "FAILED": - result[ - "warning" - ] = "VM 'soft_shutdown' operation failed, use 'hard_poweroff' instead" + result["warning"] = ( + "VM 'soft_shutdown' operation failed, use 'hard_poweroff' instead" + ) resp = vm.read(vm_uuid) result["response"] = resp diff --git a/plugins/modules/ntnx_vms_clone.py b/plugins/modules/ntnx_vms_clone.py index 5b4d35a5..81bc1f97 100644 --- a/plugins/modules/ntnx_vms_clone.py +++ b/plugins/modules/ntnx_vms_clone.py @@ -32,42 +32,42 @@ EXAMPLES = r""" - name: clone vm with check mode ntnx_vms_clone: - src_vm_uuid: "{{ vm.vm_uuid }}" - networks: - - is_connected: false - subnet: - name: "{{ network.dhcp.name }}" - check_mode: yes + src_vm_uuid: "{{ vm.vm_uuid }}" + networks: + - is_connected: false + subnet: + name: "{{ network.dhcp.name }}" + check_mode: true - name: clone vm and change vcpus,memory_gb,cores_per_vcpu,timezone,desc,name with force_power_off ntnx_vms_clone: - src_vm_uuid: "{{ vm.vm_uuid }}" - vcpus: 2 - cores_per_vcpu: 2 - memory_gb: 2 - name: cloned vm - desc: cloned vm - timezone: GMT - force_power_off: true + src_vm_uuid: "{{ vm.vm_uuid }}" + vcpus: 2 + cores_per_vcpu: 2 + memory_gb: 2 + name: cloned vm + desc: cloned vm + timezone: GMT + force_power_off: true - name: clone vm and add network ntnx_vms_clone: - src_vm_uuid: "{{ vm.vm_uuid }}" - networks: - - is_connected: true - subnet: - uuid: "{{ network.dhcp.uuid }}" - - is_connected: true - subnet: - uuid: "{{ static.uuid }}" + src_vm_uuid: "{{ vm.vm_uuid }}" + networks: + - is_connected: true + subnet: + uuid: "{{ network.dhcp.uuid }}" + - is_connected: true + subnet: + uuid: "{{ static.uuid }}" - name: clone vm with script ntnx_vms_clone: - src_vm_uuid: "{{ vm.vm_uuid }}" - guest_customization: - type: "cloud_init" - script_path: "./cloud_init.yml" - is_overridable: True + src_vm_uuid: "{{ vm.vm_uuid }}" + guest_customization: + type: "cloud_init" + script_path: "./cloud_init.yml" + is_overridable: true """ RETURN = r""" diff --git a/plugins/modules/ntnx_vms_info.py b/plugins/modules/ntnx_vms_info.py index c11ec290..6c2a8a5c 100644 --- a/plugins/modules/ntnx_vms_info.py +++ b/plugins/modules/ntnx_vms_info.py @@ -33,29 +33,28 @@ - Dina AbuHijleh (@dina-abuhijleh) """ EXAMPLES = r""" - - name: List VMS using name filter criteria - ntnx_vms_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - filter: - vm_name: "{{ vm.name }}" - kind: vm - register: result - - - name: List VMS using length, offset, sort order and vm_name sort attribute - ntnx_vms_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - length: 1 - offset: 1 - sort_order: "ASCENDING" - sort_attribute: "vm_name" - register: result +- name: List VMS using name filter criteria + ntnx_vms_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filter: + vm_name: "{{ vm.name }}" + kind: vm + register: result +- name: List VMS using length, offset, sort order and vm_name sort attribute + ntnx_vms_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + length: 1 + offset: 1 + sort_order: "ASCENDING" + sort_attribute: "vm_name" + register: result """ RETURN = r""" api_version: diff --git a/plugins/modules/ntnx_vms_ova.py b/plugins/modules/ntnx_vms_ova.py index 8ef3082c..18b8295b 100644 --- a/plugins/modules/ntnx_vms_ova.py +++ b/plugins/modules/ntnx_vms_ova.py @@ -48,7 +48,7 @@ file_format: VMDK register: result ignore_errors: true - check_mode: yes + check_mode: true - name: create QCOW2 ova_image ntnx_vms_ova: diff --git a/plugins/modules/ntnx_vpcs.py b/plugins/modules/ntnx_vpcs.py index 8f7d0c65..f344509c 100644 --- a/plugins/modules/ntnx_vpcs.py +++ b/plugins/modules/ntnx_vpcs.py @@ -62,53 +62,51 @@ """ EXAMPLES = r""" +- name: Create min VPC + ntnx_vpcs: + validate_certs: false + state: present + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: MinVPC + external_subnets: + - subnet_name: "{{ external_subnet.name }}" - - name: Create min VPC - ntnx_vpcs: - validate_certs: False - state: present - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: MinVPC - external_subnets: - - subnet_name: "{{ external_subnet.name }}" +- name: Create VPC with dns_servers + ntnx_vpcs: + validate_certs: false + state: present + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: vpc_with_dns_servers + dns_servers: "{{ dns_servers }}" - - name: Create VPC with dns_servers - ntnx_vpcs: - validate_certs: False - state: present - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: vpc_with_dns_servers - dns_servers: "{{ dns_servers }}" +- name: Create VPC with all specfactions + ntnx_vpcs: + validate_certs: false + state: present + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: vpc_with_add_specfactions + external_subnets: + - subnet_name: "{{ external_subnet.name }}" + dns_servers: "{{ dns_servers }}" + routable_ips: + - network_ip: "{{ routable_ips.network_ip }}" + network_prefix: "{{ routable_ips.network_prefix }}" - - name: Create VPC with all specfactions - ntnx_vpcs: - validate_certs: False - state: present - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: vpc_with_add_specfactions - external_subnets: - - subnet_name: "{{ external_subnet.name }}" - dns_servers: "{{ dns_servers }}" - routable_ips: - - network_ip: "{{ routable_ips.network_ip }}" - network_prefix: "{{ routable_ips.network_prefix }}" - - - name: Delete VPC - ntnx_vpcs: - state: absent - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - vpc_uuid: "{{ vpc_uuid }}" +- name: Delete VPC + ntnx_vpcs: + state: absent + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + vpc_uuid: "{{ vpc_uuid }}" """ - RETURN = r""" api_version: description: API Version of the Nutanix v3 API framework. diff --git a/plugins/modules/ntnx_vpcs_info.py b/plugins/modules/ntnx_vpcs_info.py index 88bd49aa..dd6e4c06 100644 --- a/plugins/modules/ntnx_vpcs_info.py +++ b/plugins/modules/ntnx_vpcs_info.py @@ -33,28 +33,28 @@ - Dina AbuHijleh (@dina-abuhijleh) """ EXAMPLES = r""" - - name: List VPC using name filter criteria - ntnx_vpcs_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - filter: - name: "{{ vpc.name }}" - kind: vpc - register: result - - - name: List VPC using length, offset, sort order and name sort attribute - ntnx_vpcs_info: - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: False - length: 1 - offset: 1 - sort_order: "ASCENDING" - sort_attribute: "name" - register: result +- name: List VPC using name filter criteria + ntnx_vpcs_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filter: + name: "{{ vpc.name }}" + kind: vpc + register: result + +- name: List VPC using length, offset, sort order and name sort attribute + ntnx_vpcs_info: + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + length: 1 + offset: 1 + sort_order: "ASCENDING" + sort_attribute: "name" + register: result """ RETURN = r""" api_version: