diff --git a/.github/workflows/ok-to-test-command.yml b/.github/workflows/ok-to-test-command.yml
index ef80ef365..f8f1040d3 100644
--- a/.github/workflows/ok-to-test-command.yml
+++ b/.github/workflows/ok-to-test-command.yml
@@ -55,14 +55,14 @@ jobs:
echo '${{ secrets.FC_CONFIG }}' > tests/integration/targets/prepare_fc_env/vars/main.yml
echo '${{ secrets.PC_CONFIG }}' > tests/integration/targets/prepare_env/vars/main.yml
echo '${{ secrets.NDB_CONFIG }}' > tests/integration/targets/prepare_ndb_env/vars/main.yml
- ansible-playbook tests/integration/targets/prepare_env/tasks/prepare_env.yml
- ansible-playbook tests/integration/targets/prepare_ndb_env/tasks/prepare_env.yml
- ansible-playbook tests/integration/targets/prepare_fc_env/tasks/prepare_fc_env.yml
- ansible-playbook tests/integration/targets/prepare_foundation_env/tasks/prepare_foundation_env.yml
+ ansible-playbook tests/integration/targets/prepare_env/playbooks/prepare_env.yml
+ ansible-playbook tests/integration/targets/prepare_ndb_env/playbooks/prepare_env.yml
+ ansible-playbook tests/integration/targets/prepare_fc_env/playbooks/prepare_fc_env.yml
+ ansible-playbook tests/integration/targets/prepare_foundation_env/playbooks/prepare_foundation_env.yml
ansible-test integration --continue-on-error --python ${{ matrix.python-version }} --coverage $flag
ansible-test coverage report > coverage.txt
- ansible-playbook tests/integration/targets/prepare_env/tasks/cleanup.yml
- ansible-playbook tests/integration/targets/prepare_foundation_env/tasks/cleanup.yml
+ ansible-playbook tests/integration/targets/prepare_env/playbooks/cleanup.yml
+ ansible-playbook tests/integration/targets/prepare_foundation_env/playbooks/cleanup.yml
- name: Code Coverage Check
if: ${{ always() }}
diff --git a/README.md b/README.md
index d4d167d41..fe30f97a6 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,13 @@
# Nutanix Ansible
+
Official nutanix ansible collection
# About
+
Nutanix ansible collection nutanix.ncp is the official Nutanix ansible collection to automate Nutanix Cloud Platform (ncp).
It is designed keeping simplicity as the core value. Hence it is
+
1. Easy to use
2. Easy to develop
@@ -17,12 +20,15 @@ Ansible Nutanix Provider leverages the community-supported model. See [Open Sour
# Version compatibility
## Ansible
+
This collection requires ansible-core>=2.15.0
## Python
+
This collection requires Python 3.9 or greater
## Prism Central
+
> For the 1.1.0 release of the ansible plugin it will have N-2 compatibility with the Prism Central APIs. This release was tested against Prism Central versions pc2022.1.0.2, pc.2021.9.0.5 and pc.2021.8.0.1.
> For the 1.2.0 release of the ansible plugin it will have N-2 compatibility with the Prism Central APIs. This release was tested against Prism Central versions pc.2022.4, pc2022.1.0.2 and pc.2021.9.0.5.
@@ -43,19 +49,20 @@ This collection requires Python 3.9 or greater
> For the 1.9.2 release of the ansible plugin it will have N-1 compatibility with the Prism Central APIs. This release was sanity tested against Prism Central version pc.2024.1 .
-
### Notes:
+
1. Static routes module (ntnx_static_routes) is supported for PC versions >= pc.2022.1
2. Adding cluster references in projects module (ntnx_projects) is supported for PC versions >= pc.2022.1
3. For Users and User Groups modules (ntnx_users and ntnx_user_groups), adding Identity Provider (IdP) & Organizational Unit (OU) based users/groups are supported for PC versions >= pc.2022.1
-4. ntnx_security_rules - The ``apptier`` option in target group has been removed. New option called ``apptiers`` has been added to support multi tier policy.
+4. ntnx_security_rules - The `apptier` option in target group has been removed. New option called `apptiers` has been added to support multi tier policy.
Prism Central based examples: https://github.com/nutanix/nutanix.ansible/tree/main/examples/
## Foundation
+
> For the 1.1.0 release of the ansible plugin, it will have N-1 compatibility with the Foundation. This release was tested against Foundation versions v5.2 and v5.1.1
> For the 1.9.1 release of the ansible plugin, it was tested against versions v5.2
@@ -63,11 +70,13 @@ Prism Central based examples: https://github.com/nutanix/nutanix.ansible/tree/ma
Foundation based examples : https://github.com/nutanix/nutanix.ansible/tree/main/examples/foundation
## Foundation Central
+
> For the 1.1.0 release of the ansible plugin, it will have N-1 compatibility with the Foundation Central . This release was tested against Foundation Central versions v1.3 and v1.2
Foundation Central based examples : https://github.com/nutanix/nutanix.ansible/tree/main/examples/fc
## Karbon
+
> For the 1.6.0 release of the ansible plugin, it will have N-2 compatibility with the Karbon. This release was tested against Karbon versions v2.3.0, v2.4.0 and v2.5.0
> For the 1.9.0 release of the ansible plugin, it was tested against Karbon versions v2.6.0, v2.7.0 and v2.8.0
@@ -87,9 +96,11 @@ Karbon based examples : https://github.com/nutanix/nutanix.ansible/tree/main/exa
NDB based examples : https://github.com/nutanix/nutanix.ansible/tree/main/examples/ndb
### Notes:
+
1. Currently NDB based modules are supported and tested against postgres based databases.
# Installing the collection
+
**Prerequisite**
Ansible should be pre-installed. If not, please follow official ansible [install guide](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html) .
@@ -98,26 +109,28 @@ For Developers, please follow [this install guide](
**1. Clone the GitHub repository to a local directory**
-```git clone https://github.com/nutanix/nutanix.ansible.git```
+`git clone https://github.com/nutanix/nutanix.ansible.git`
**2. Git checkout release version**
-```git checkout -b ```
+`git checkout -b `
**3. Build the collection**
-```ansible-galaxy collection build```
+`ansible-galaxy collection build`
**4. Install the collection**
-```ansible-galaxy collection install nutanix-ncp-.tar.gz```
+`ansible-galaxy collection install nutanix-ncp-.tar.gz`
**Note** Add `--force` option for rebuilding or reinstalling to overwrite existing data
# Using this collection
-You can either call modules by their Fully Qualified Collection Namespace (FQCN), such as nutanix.ncp.ntnx_vms, or you can call modules by their short name if you list the nutanix.ncp collection in the playbook's ```collections:``` keyword
+
+You can either call modules by their Fully Qualified Collection Namespace (FQCN), such as nutanix.ncp.ntnx_vms, or you can call modules by their short name if you list the nutanix.ncp collection in the playbook's `collections:` keyword
For example, the playbook for iaas.yml is as follows:
+
```yaml
---
- name: IaaS Provisioning
@@ -143,7 +156,9 @@ For example, the playbook for iaas.yml is as follows:
- include_role:
name: fip
```
+
To run this playbook, use ansible-playbook command as follows:
+
```
ansible-playbook
ansible-playbook examples/iaas/iaas.yml
@@ -154,7 +169,7 @@ ansible-playbook examples/iaas/iaas.yml
## Modules
| Name | Description |
-|----------------------------------------------|--------------------------------------------------------------------------------------------------|
+| -------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| ntnx_acps | Create, Update, Delete acp. |
| ntnx_acps_info | Get acp info. |
| ntnx_address_groups | Create, Update, Delete Nutanix address groups. |
@@ -253,11 +268,12 @@ ansible-playbook examples/iaas/iaas.yml
## Inventory Plugins
-| Name | Description |
-| --- | --- |
+| Name | Description |
+| ----------------------- | ---------------------------- |
| ntnx_prism_vm_inventory | Nutanix VMs inventory source |
# Module documentation and examples
+
```
ansible-doc nutanix.ncp.
```
@@ -266,8 +282,8 @@ ansible-doc nutanix.ncp.
We glady welcome contributions from the community. From updating the documentation to adding more functions for Ansible, all ideas are welcome. Thank you in advance for all of your issues, pull requests, and comments!
-* [Contributing Guide](CONTRIBUTING.md)
-* [Code of Conduct](CODE_OF_CONDUCT.md)
+- [Contributing Guide](CONTRIBUTING.md)
+- [Code of Conduct](CODE_OF_CONDUCT.md)
# Testing
@@ -276,50 +292,56 @@ We glady welcome contributions from the community. From updating the documentati
To conduct integration tests for a specific Ansible module such as the `ntnx_vms` module, the following step-by-step procedures can be followed:
### Prerequisites
+
- Ensure you are in the installed collection directory where the module is located. For example:
-`/Users/mac.user1/.ansible/collections/ansible_collections/nutanix/ncp`
+ `/Users/mac.user1/.ansible/collections/ansible_collections/nutanix/ncp`
### Setting up Variables
+
1. Navigate to the `tests/integration/targets` directory within the collection.
-2. Define the necessary variables within the feature-specific var files, such as `tests/integration/targets/prepare_env/vars/main.yml`, `tests/integration/targets/prepare_foundation_env/vars/main.yml`,`tests/integration/targets/prepare_ndb_env/tasks/prepare_env.yml`, etc.
+2. Define the necessary variables within the feature-specific var files, such as `tests/integration/targets/prepare_env/vars/main.yml`, `tests/integration/targets/prepare_foundation_env/vars/main.yml`,`tests/integration/targets/prepare_ndb_env/playbooks/prepare_env.yml`, etc.
Note: For Karbon and FC tests, use the PC vars exclusively, as these features rely on pc setup. Not all variables are mandatory; define only the required variables for the particular feature to be tested.
3. Run the test setup playbook for the specific feature you intend to test to create entities in setup:
- - For PC, NDB, and Foundation tests, execute the relevant commands:
- ```bash
- ansible-playbook prepare_env/tasks/prepare_env.yml
- ansible-playbook prepare_ndb_env/tasks/prepare_env.yml
- ansible-playbook prepare_foundation_env/tasks/prepare_foundation_env.yml
- ```
+ - For PC, NDB, and Foundation tests, execute the relevant commands:
+ ```bash
+ ansible-playbook prepare_env/playbooks/prepare_env.yml
+ ansible-playbook prepare_ndb_env/playbooks/prepare_env.yml
+ ansible-playbook prepare_foundation_env/playbooks/prepare_foundation_env.yml
+ ```
### Running Integration Tests
+
1. Conduct integration tests for all modules using:
- ```bash
- ansible-test integration
- ```
+
+ ```bash
+ ansible-test integration
+ ```
2. To perform integration tests for a specific module:
- ```bash
- ansible-test integration module_test_name
- ```
- Replace `module_test_name` with test directory name under tests/integration/targets.
+ ```bash
+ ansible-test integration module_test_name
+ ```
+ Replace `module_test_name` with test directory name under tests/integration/targets.
### Cleanup
+
1. After completing the integration tests, perform a cleanup specific to the tested feature:
- - For PC tests, execute the command:
- ```bash
- ansible-playbook prepare_env/tasks/clean_up.yml
- ```
- - For Foundation tests, execute the command:
- ```bash
- ansible-playbook prepare_foundation_env/tasks/clean_up.yml
- ```
+ - For PC tests, execute the command:
+ ```bash
+ ansible-playbook prepare_env/playbooks/clean_up.yml
+ ```
+ - For Foundation tests, execute the command:
+ ```bash
+ ansible-playbook prepare_foundation_env/playbooks/clean_up.yml
+ ```
By following these steps, you can perform comprehensive integration testing for the specified Ansible module and ensure a clean testing environment afterward. Define only the necessary variables for the specific feature you intend to test.
# Examples
+
## Playbook for IaaS provisioning on Nutanix
**Refer to [`examples/iaas`](https://github.com/nutanix/nutanix.ansible/tree/main/examples/iaas) for full implementation**
@@ -332,46 +354,122 @@ By following these steps, you can perform comprehensive integration testing for
collections:
- nutanix.ncp
vars:
- nutanix_host:
- nutanix_username:
- nutanix_password:
- validate_certs: true
+ nutanix_host:
+ nutanix_username:
+ nutanix_password:
+ validate_certs: true
tasks:
- name: Inputs for external subnets task
include_tasks: external_subnet.yml
with_items:
- - { name: Ext-Nat, vlan_id: 102, ip: 10.44.3.192, prefix: 27, gip: 10.44.3.193, sip: 10.44.3.198, eip: 10.44.3.207, eNat: True }
+ - {
+ name: Ext-Nat,
+ vlan_id: 102,
+ ip: 10.44.3.192,
+ prefix: 27,
+ gip: 10.44.3.193,
+ sip: 10.44.3.198,
+ eip: 10.44.3.207,
+ eNat: True,
+ }
- name: Inputs for vpcs task
include_tasks: vpc.yml
with_items:
- - { name: Prod, subnet_name: Ext-Nat}
- - { name: Dev, subnet_name: Ext-Nat}
+ - { name: Prod, subnet_name: Ext-Nat }
+ - { name: Dev, subnet_name: Ext-Nat }
- name: Inputs for overlay subnets
include_tasks: overlay_subnet.yml
with_items:
- - { name: Prod-SubnetA, vpc_name: Prod , nip: 10.1.1.0, prefix: 24, gip: 10.1.1.1, sip: 10.1.1.2, eip: 10.1.1.5,
- domain_name: "calm.nutanix.com", dns_servers : ["8.8.8.8","8.8.8.4"], domain_search: ["calm.nutanix.com","eng.nutanix.com"] }
- - { name: Prod-SubnetB, vpc_name: Prod , nip: 10.1.2.0, prefix: 24, gip: 10.1.2.1, sip: 10.1.2.2, eip: 10.1.2.5,
- domain_name: "calm.nutanix.com", dns_servers : ["8.8.8.8","8.8.8.4"], domain_search: ["calm.nutanix.com","eng.nutanix.com"] }
- - { name: Dev-SubnetA, vpc_name: Dev , nip: 10.1.1.0, prefix: 24, gip: 10.1.1.1, sip: 10.1.1.2, eip: 10.1.1.5,
- domain_name: "calm.nutanix.com", dns_servers : ["8.8.8.8","8.8.8.4"], domain_search: ["calm.nutanix.com","eng.nutanix.com"] }
- - { name: Dev-SubnetB, vpc_name: Dev , nip: 10.1.2.0, prefix: 24, gip: 10.1.2.1, sip: 10.1.2.2, eip: 10.1.2.5,
- domain_name: "calm.nutanix.com", dns_servers : ["8.8.8.8","8.8.8.4"], domain_search: ["calm.nutanix.com","eng.nutanix.com"] }
+ - {
+ name: Prod-SubnetA,
+ vpc_name: Prod,
+ nip: 10.1.1.0,
+ prefix: 24,
+ gip: 10.1.1.1,
+ sip: 10.1.1.2,
+ eip: 10.1.1.5,
+ domain_name: "calm.nutanix.com",
+ dns_servers: ["8.8.8.8", "8.8.8.4"],
+ domain_search: ["calm.nutanix.com", "eng.nutanix.com"],
+ }
+ - {
+ name: Prod-SubnetB,
+ vpc_name: Prod,
+ nip: 10.1.2.0,
+ prefix: 24,
+ gip: 10.1.2.1,
+ sip: 10.1.2.2,
+ eip: 10.1.2.5,
+ domain_name: "calm.nutanix.com",
+ dns_servers: ["8.8.8.8", "8.8.8.4"],
+ domain_search: ["calm.nutanix.com", "eng.nutanix.com"],
+ }
+ - {
+ name: Dev-SubnetA,
+ vpc_name: Dev,
+ nip: 10.1.1.0,
+ prefix: 24,
+ gip: 10.1.1.1,
+ sip: 10.1.1.2,
+ eip: 10.1.1.5,
+ domain_name: "calm.nutanix.com",
+ dns_servers: ["8.8.8.8", "8.8.8.4"],
+ domain_search: ["calm.nutanix.com", "eng.nutanix.com"],
+ }
+ - {
+ name: Dev-SubnetB,
+ vpc_name: Dev,
+ nip: 10.1.2.0,
+ prefix: 24,
+ gip: 10.1.2.1,
+ sip: 10.1.2.2,
+ eip: 10.1.2.5,
+ domain_name: "calm.nutanix.com",
+ dns_servers: ["8.8.8.8", "8.8.8.4"],
+ domain_search: ["calm.nutanix.com", "eng.nutanix.com"],
+ }
- name: Inputs for vm task
include_tasks: vm.yml
with_items:
- - {name: "Prod-Wordpress-App", desc: "Prod-Wordpress-App", is_connected: True , subnet_name: Prod-SubnetA, image_name: "wordpress-appserver", private_ip: ""}
- - {name: "Prod-Wordpress-DB", desc: "Prod-Wordpress-DB", is_connected: True , subnet_name: Prod-SubnetB, image_name: "wordpress-db", private_ip: 10.1.2.5}
- - {name: "Dev-Wordpress-App", desc: "Dev-Wordpress-App", is_connected: True , subnet_name: Dev-SubnetA, image_name: "wordpress-appserver", private_ip: ""}
- - {name: "Dev-Wordpress-DB", desc: "Dev-Wordpress-DB", is_connected: True , subnet_name: Dev-SubnetB, image_name: "wordpress-db",private_ip: 10.1.2.5}
+ - {
+ name: "Prod-Wordpress-App",
+ desc: "Prod-Wordpress-App",
+ is_connected: True,
+ subnet_name: Prod-SubnetA,
+ image_name: "wordpress-appserver",
+ private_ip: "",
+ }
+ - {
+ name: "Prod-Wordpress-DB",
+ desc: "Prod-Wordpress-DB",
+ is_connected: True,
+ subnet_name: Prod-SubnetB,
+ image_name: "wordpress-db",
+ private_ip: 10.1.2.5,
+ }
+ - {
+ name: "Dev-Wordpress-App",
+ desc: "Dev-Wordpress-App",
+ is_connected: True,
+ subnet_name: Dev-SubnetA,
+ image_name: "wordpress-appserver",
+ private_ip: "",
+ }
+ - {
+ name: "Dev-Wordpress-DB",
+ desc: "Dev-Wordpress-DB",
+ is_connected: True,
+ subnet_name: Dev-SubnetB,
+ image_name: "wordpress-db",
+ private_ip: 10.1.2.5,
+ }
- name: Inputs for Floating IP task
include_tasks: fip.yml
with_items:
- - {vm_name: "Prod-Wordpress-App"}
- - {vm_name: "Dev-Wordpress-App"}
-
+ - { vm_name: "Prod-Wordpress-App" }
+ - { vm_name: "Dev-Wordpress-App" }
```
diff --git a/tests/integration/targets/ntnx_acps/tasks/create_acps.yml b/tests/integration/targets/ntnx_acps/tasks/create_acps.yml
index 06125d5b6..47a8c8cbf 100644
--- a/tests/integration/targets/ntnx_acps/tasks/create_acps.yml
+++ b/tests/integration/targets/ntnx_acps/tasks/create_acps.yml
@@ -1,29 +1,29 @@
---
- name: Generate random name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- set_fact:
+- name: Set ACP names
+ ansible.builtin.set_fact:
acp1_name: "{{random_name[0]}}1"
acp2_name: "{{random_name[0]}}2"
acp3_name: "{{random_name[0]}}3"
acp4_name: "{{random_name[0]}}4"
acp5_name: "{{random_name[0]}}5"
-
- name: Create min ACP
ntnx_acps:
state: present
- wait: True
+ wait: true
name: "{{acp1_name}}"
role:
uuid: "{{ acp.role.uuid }}"
register: result
check_mode: true
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -38,13 +38,13 @@
wait: true
name: "{{acp2_name}}"
role:
- uuid: '{{ acp.role.uuid }}'
+ uuid: "{{ acp.role.uuid }}"
check_mode: false
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -52,7 +52,8 @@
fail_msg: " Unable to create Min ACP "
success_msg: " Min ACP created successfully "
-- set_fact:
+- name: Add ACP uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.acp_uuid ] }}"
##########################################################
- name: Create ACP with user reference
@@ -64,10 +65,10 @@
user_uuids:
- "{{ acp.user_uuid }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -77,7 +78,8 @@
fail_msg: " Unable to Create ACP with user reference "
success_msg: " ACP with user reference created successfully "
-- set_fact:
+- name: Add ACP uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.acp_uuid ] }}"
##########################################################
- name: Create ACP with user ad user group reference
@@ -91,10 +93,10 @@
user_group_uuids:
- "{{ acp.user_group_uuid }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -105,7 +107,8 @@
fail_msg: " Unable to Create ACP with user and user group reference "
success_msg: " ACP with user and user group reference created successfully "
-- set_fact:
+- name: Add ACP uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.acp_uuid ] }}"
##########################################################
- name: Create ACP with all specfactions
@@ -134,7 +137,7 @@
operator: IN
rhs:
uuid_list:
- - "{{ network.dhcp.uuid }}"
+ - "{{ network.dhcp.uuid }}"
- scope_filter:
- lhs: CATEGORY
operator: IN
@@ -148,10 +151,10 @@
rhs:
collection: ALL
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -175,7 +178,8 @@
fail_msg: " Unable to Create ACP all specfactions "
success_msg: " ACP with all specfactions created successfully "
-- set_fact:
+- name: Add ACP uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.acp_uuid ] }}"
##########################################################
- name: Delete all created acps
@@ -184,10 +188,10 @@
acp_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed is defined
- result.changed == true
@@ -195,5 +199,6 @@
fail_msg: "unable to delete all created acp's"
success_msg: "All acp's deleted successfully"
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_acps/tasks/delete_acp.yml b/tests/integration/targets/ntnx_acps/tasks/delete_acp.yml
index f988ef708..3382bc58a 100644
--- a/tests/integration/targets/ntnx_acps/tasks/delete_acp.yml
+++ b/tests/integration/targets/ntnx_acps/tasks/delete_acp.yml
@@ -1,9 +1,10 @@
---
- name: Generate random name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- set_fact:
+- name: Set ACP name
+ ansible.builtin.set_fact:
acp1_name: "{{random_name[0]}}1"
- name: Create ACP with all specfactions
@@ -18,23 +19,21 @@
- "{{ acp.user_group_uuid }}"
filters:
- scope_filter:
- -
- lhs: PROJECT
+ - lhs: PROJECT
operator: IN
rhs:
uuid_list:
- "{{ project.uuid }}"
entity_filter:
- -
- lhs: ALL
+ - lhs: ALL
operator: IN
rhs:
collection: ALL
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -50,7 +49,6 @@
fail_msg: " Unable to Create ACP all specfactions "
success_msg: " ACP with all specfactions created successfully "
-
- name: Delete acp
ntnx_acps:
state: absent
@@ -59,7 +57,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'SUCCEEDED'
diff --git a/tests/integration/targets/ntnx_acps/tasks/main.yml b/tests/integration/targets/ntnx_acps/tasks/main.yml
index b75051612..a229f69a3 100644
--- a/tests/integration/targets/ntnx_acps/tasks/main.yml
+++ b/tests/integration/targets/ntnx_acps/tasks/main.yml
@@ -1,12 +1,17 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create_acps.yml"
- - import_tasks: "delete_acp.yml"
- - import_tasks: "update_acps.yml"
- - import_tasks: "negative_scenarios.yml"
+ - name: Import "create_acps.yml"
+ ansible.builtin.import_tasks: "create_acps.yml"
+ - name: Import "delete_acp.yml"
+ ansible.builtin.import_tasks: "delete_acp.yml"
+ - name: Import "update_acps.yml"
+ ansible.builtin.import_tasks: "update_acps.yml"
+ - name: Import "negative_scenarios.yml"
+ ansible.builtin.import_tasks: "negative_scenarios.yml"
diff --git a/tests/integration/targets/ntnx_acps/tasks/negative_scenarios.yml b/tests/integration/targets/ntnx_acps/tasks/negative_scenarios.yml
index 9f05fbe40..fbf6568e6 100644
--- a/tests/integration/targets/ntnx_acps/tasks/negative_scenarios.yml
+++ b/tests/integration/targets/ntnx_acps/tasks/negative_scenarios.yml
@@ -1,61 +1,62 @@
- - debug:
- msg: "Started Negative Creation Cases"
+- name: Started Negative Creation Cases
+ ansible.builtin.debug:
+ msg: "Started Negative Creation Cases"
- - name: Unknown role name
- ntnx_acps:
- state: present
- name: MinACP2
- role:
- name: "unknown987"
- register: result
- ignore_errors: true
+- name: Unknown role name
+ ntnx_acps:
+ state: present
+ name: MinACP2
+ role:
+ name: "unknown987"
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.failed==True
- - result.msg=="Failed generating acp spec"
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail ACP created successfully with unknown role name '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.failed==True
+ - result.msg=="Failed generating acp spec"
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail ACP created successfully with unknown role name "
#######################################################
- - name: Unknown role uuid
- ntnx_acps:
- state: present
- name: MinACP2
- role:
- uuid: 00000000-0000-0000-0000-000000000000
- register: result
- ignore_errors: True
- - name: Creation Status
- assert:
- that:
- - result.failed==True
- - result.status_code==405
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail acp created successfully with unknown role uuid '
+- name: Unknown role uuid
+ ntnx_acps:
+ state: present
+ name: MinACP2
+ role:
+ uuid: 00000000-0000-0000-0000-000000000000
+ register: result
+ ignore_errors: true
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.failed==True
+ - result.status_code==405
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail acp created successfully with unknown role uuid "
#######################################################
- - name: Delete acp with unknown uuid
- ntnx_acps:
- state: absent
- acp_uuid: 5
- ignore_errors: True
- register: result
- - name: Creation Status
- assert:
- that:
- - result.status_code==400
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail deleting acp with unknown uuid '
+- name: Delete acp with unknown uuid
+ ntnx_acps:
+ state: absent
+ acp_uuid: 5
+ ignore_errors: true
+ register: result
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.status_code==400
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail deleting acp with unknown uuid "
#######################################################
- - name: Delete acp with missing uuid
- ntnx_acps:
- state: absent
- ignore_errors: True
- register: result
+- name: Delete acp with missing uuid
+ ntnx_acps:
+ state: absent
+ ignore_errors: true
+ register: result
- - name: Creation Status
- assert:
- that:
- - result.failed==True
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail deleting acp with missing uuid '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.failed==True
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail deleting acp with missing uuid "
diff --git a/tests/integration/targets/ntnx_acps/tasks/update_acps.yml b/tests/integration/targets/ntnx_acps/tasks/update_acps.yml
index a2181099e..5fc7ee0ed 100644
--- a/tests/integration/targets/ntnx_acps/tasks/update_acps.yml
+++ b/tests/integration/targets/ntnx_acps/tasks/update_acps.yml
@@ -1,6 +1,6 @@
---
-
-- set_fact:
+- name: Set ACP names
+ ansible.builtin.set_fact:
acp_name: "{{ query('community.general.random_string', upper=false, numbers=false, special=false)[0] }}"
acp_name_updated: "{{ query('community.general.random_string', upper=false, numbers=false, special=false)[0] }}"
@@ -10,11 +10,11 @@
wait: true
name: "{{acp_name}}"
role:
- uuid: '{{ acp.role.uuid }}'
+ uuid: "{{ acp.role.uuid }}"
register: setup_acp
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- setup_acp.response is defined
- setup_acp.response.status.state == 'COMPLETE'
@@ -23,22 +23,23 @@
fail_msg: "Unable to create ACP for update tests"
success_msg: "ACP created successfully for update tests"
-- set_fact:
+- name: Add ACP uuid to todelete list
+ ansible.builtin.set_fact:
todelete: '{{ todelete + [ setup_acp["response"]["metadata"]["uuid"] ] }}'
############################################# UPDATE TESTS ########################################
-- name: check idempotency
+- name: Check idempotency
ntnx_acps:
state: present
acp_uuid: "{{ setup_acp.acp_uuid }}"
name: "{{acp_name}}"
role:
- uuid: '{{ acp.role.uuid }}'
+ uuid: "{{ acp.role.uuid }}"
register: result
-- name: check idempotency status
- assert:
+- name: Check idempotency status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -56,22 +57,20 @@
desc: "description after update"
filters:
- scope_filter:
- -
- lhs: PROJECT
+ - lhs: PROJECT
operator: IN
rhs:
uuid_list:
- "{{ project.uuid }}"
entity_filter:
- -
- lhs: ALL
+ - lhs: ALL
operator: IN
rhs:
collection: ALL
register: result
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -86,7 +85,6 @@
fail_msg: "Fail: Unable to update ACP"
success_msg: "Pass: ACP with given update spec updated successfully"
-
########################################################################################
- name: Update name, desc and filters
@@ -97,22 +95,20 @@
desc: "description after update"
filters:
- scope_filter:
- -
- lhs: PROJECT
+ - lhs: PROJECT
operator: IN
rhs:
uuid_list:
- "{{ project.uuid }}"
entity_filter:
- -
- lhs: ALL
+ - lhs: ALL
operator: IN
rhs:
collection: ALL
register: result
-- name: check idempotency status
- assert:
+- name: Check idempotency status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -120,20 +116,18 @@
fail_msg: "Fail: ACP got updated"
success_msg: "Pass: ACP update skipped successfully due to no changes in spec"
-
########################################### Cleanup ###################################################
-- name: cleanup created entities
+- name: Cleanup created entities
ntnx_acps:
state: absent
acp_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
-
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed is defined
- result.changed == true
@@ -141,5 +135,6 @@
fail_msg: "unable to delete all created acp's"
success_msg: "All acp's deleted successfully"
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_acps_info/tasks/info.yml b/tests/integration/targets/ntnx_acps_info/tasks/info.yml
index 3ac25358c..362dbc53c 100644
--- a/tests/integration/targets/ntnx_acps_info/tasks/info.yml
+++ b/tests/integration/targets/ntnx_acps_info/tasks/info.yml
@@ -1,8 +1,10 @@
---
-- debug:
+- name: Start ntnx_acps_info tests
+ ansible.builtin.debug:
msg: "start ntnx_acps_info tests"
-- set_fact:
+- name: Generate random acp_name
+ ansible.builtin.set_fact:
acp_name: "{{ query('community.general.random_string', upper=false, numbers=false, special=false)[0] }}"
- name: Create min ACP for update
@@ -11,14 +13,14 @@
wait: true
name: "{{acp_name}}"
role:
- uuid: '{{ acp.role.uuid }}'
+ uuid: "{{ acp.role.uuid }}"
register: acps
-- set_fact:
+- name: Add ACP uuid to todelete list
+ ansible.builtin.set_fact:
todelete: '{{ todelete + [ acps["response"]["metadata"]["uuid"] ] }}'
-
-- name: test getting all acp's
+- name: Test getting all acp's
ntnx_acps_info:
kind: access_control_policy
length: 1
@@ -27,8 +29,8 @@
sort_attribute: "name"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -37,14 +39,14 @@
success_msg: "acps listed successfully"
################################################################
-- name: test getting particular acp using filter
+- name: Test getting particular acp using filter
ntnx_acps_info:
filter:
name: "{{ acp_name }}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -55,13 +57,13 @@
#################################################################
-- name: test getting particular acp using uuid
+- name: Test getting particular acp using uuid
ntnx_acps_info:
- acp_uuid: '{{ acps.response.metadata.uuid }}'
+ acp_uuid: "{{ acps.response.metadata.uuid }}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -70,14 +72,14 @@
fail_msg: "Unable to get particular acp using uuid"
success_msg: "acp info obtained successfully using uuid"
-- name: cleanup created entities
+- name: Cleanup created entities
ntnx_acps:
state: absent
acp_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
-
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_acps_info/tasks/main.yml b/tests/integration/targets/ntnx_acps_info/tasks/main.yml
index 3364b30c6..15956a969 100644
--- a/tests/integration/targets/ntnx_acps_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_acps_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "info.yml"
+ - name: Import "info.yml"
+ ansible.builtin.import_tasks: "info.yml"
diff --git a/tests/integration/targets/ntnx_address_groups/tasks/create.yml b/tests/integration/targets/ntnx_address_groups/tasks/create.yml
index 59a2e0cef..e87894a6c 100644
--- a/tests/integration/targets/ntnx_address_groups/tasks/create.yml
+++ b/tests/integration/targets/ntnx_address_groups/tasks/create.yml
@@ -1,19 +1,21 @@
---
-- debug:
+- name: Start ntnx_address_groups create tests
+ ansible.builtin.debug:
msg: start ntnx_address_groups create tests
- name: Generate random project_name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)[0]}}"
-- set_fact:
+- name: Set suffix name
+ ansible.builtin.set_fact:
suffix_name: "ansible-ag"
-- set_fact:
+- name: Set address group names
+ ansible.builtin.set_fact:
ag1: "{{random_name}}{{suffix_name}}1"
ag2: "{{random_name}}{{suffix_name}}2"
-
- name: Create address group
ntnx_address_groups:
state: present
@@ -27,7 +29,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.address_group_uuid is defined
@@ -42,7 +44,8 @@
fail_msg: "Unable to create address group"
success_msg: "Address group created susccessfully"
-- set_fact:
+- name: Set address group uuid to delete
+ ansible.builtin.set_fact:
todelete: '{{ result["address_group_uuid"] }}'
###################################################################################################
@@ -55,10 +58,10 @@
- network_ip: "10.1.1.0"
network_prefix: 24
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.msg == "Address group with given name already exists"
- result.changed == False
@@ -68,7 +71,7 @@
###################################################################################################
- name: Check mode test
- check_mode: yes
+ check_mode: true
ntnx_address_groups:
state: present
name: "{{ag2}}"
@@ -81,7 +84,7 @@
register: result
- name: Check mode Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -97,13 +100,13 @@
###################################################################################################
-
-- name: cleanup created entities
+- name: Cleanup created entities
ntnx_address_groups:
state: absent
address_group_uuid: "{{ todelete }}"
register: result
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_address_groups/tasks/delete.yml b/tests/integration/targets/ntnx_address_groups/tasks/delete.yml
index 1c707f087..2365f3242 100644
--- a/tests/integration/targets/ntnx_address_groups/tasks/delete.yml
+++ b/tests/integration/targets/ntnx_address_groups/tasks/delete.yml
@@ -1,18 +1,20 @@
---
-- debug:
+- name: Start ntnx_address_groups delete tests
+ ansible.builtin.debug:
msg: start ntnx_address_groups delete tests
- name: Generate random project_name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)[0]}}"
-- set_fact:
+- name: Set suffix name
+ ansible.builtin.set_fact:
suffix_name: "ansible-ag"
-- set_fact:
+- name: Set address group names
+ ansible.builtin.set_fact:
ag1: "{{random_name}}{{suffix_name}}1"
-
- name: Create address group
ntnx_address_groups:
state: present
@@ -24,7 +26,7 @@
register: test_ag
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- test_ag.response is defined
- test_ag.changed == True
@@ -33,14 +35,14 @@
###################################################################################################
-- name: delete address group
+- name: Delete address group
ntnx_address_groups:
state: absent
address_group_uuid: "{{ test_ag.address_group_uuid }}"
register: result
-- name: delete Status
- assert:
+- name: Delete Status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
diff --git a/tests/integration/targets/ntnx_address_groups/tasks/main.yml b/tests/integration/targets/ntnx_address_groups/tasks/main.yml
index a2c7a07b0..aa9baff0c 100644
--- a/tests/integration/targets/ntnx_address_groups/tasks/main.yml
+++ b/tests/integration/targets/ntnx_address_groups/tasks/main.yml
@@ -1,11 +1,15 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create.yml"
- - import_tasks: "update.yml"
- - import_tasks: "delete.yml"
+ - name: Import "create.yml"
+ ansible.builtin.import_tasks: "create.yml"
+ - name: Import "update.yml"
+ ansible.builtin.import_tasks: "update.yml"
+ - name: Import "delete.yml"
+ ansible.builtin.import_tasks: "delete.yml"
diff --git a/tests/integration/targets/ntnx_address_groups/tasks/update.yml b/tests/integration/targets/ntnx_address_groups/tasks/update.yml
index 6107bc286..46bb10b81 100644
--- a/tests/integration/targets/ntnx_address_groups/tasks/update.yml
+++ b/tests/integration/targets/ntnx_address_groups/tasks/update.yml
@@ -1,20 +1,21 @@
---
-- debug:
+- name: Start ntnx_address_groups update tests
+ ansible.builtin.debug:
msg: start ntnx_address_groups update tests
-
- name: Generate random project_name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)[0]}}"
-- set_fact:
+- name: Set suffix name
+ ansible.builtin.set_fact:
suffix_name: "ansible-ag"
-- set_fact:
+- name: Set address group names
+ ansible.builtin.set_fact:
ag1: "{{random_name}}{{suffix_name}}1"
ag2: "{{random_name}}{{suffix_name}}2"
-
##############################################################################################
- name: Create address group with
@@ -30,14 +31,13 @@
register: test_ag
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- test_ag.response is defined
- test_ag.changed == True
fail_msg: "Unable to create address group"
success_msg: "Address group created susccessfully"
-
###################################################################################################
- name: Update all fields
@@ -52,7 +52,7 @@
register: result
- name: Update status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.address_group_uuid is defined
@@ -79,8 +79,8 @@
network_prefix: 32
register: result
-- name: idempotency check status
- assert:
+- name: Idempotency check status
+ ansible.builtin.assert:
that:
- result.changed == False
- result.failed == False
@@ -92,7 +92,7 @@
###################################################################################################
- name: Check mode test
- check_mode: yes
+ check_mode: true
ntnx_address_groups:
state: present
address_group_uuid: "{{test_ag.address_group_uuid}}"
@@ -105,8 +105,8 @@
network_prefix: 32
register: result
-- name: check mode Status
- assert:
+- name: Check mode Status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.address_group_uuid is defined
@@ -123,9 +123,9 @@
###################################################################################################
-- name: cleanup created entities
+- name: Cleanup created entities
ntnx_address_groups:
state: absent
address_group_uuid: "{{test_ag.address_group_uuid}}"
register: result
- ignore_errors: True
+ ignore_errors: true
diff --git a/tests/integration/targets/ntnx_address_groups_info/tasks/address_groups_info.yml b/tests/integration/targets/ntnx_address_groups_info/tasks/address_groups_info.yml
index bebdf2535..124c5328f 100644
--- a/tests/integration/targets/ntnx_address_groups_info/tasks/address_groups_info.yml
+++ b/tests/integration/targets/ntnx_address_groups_info/tasks/address_groups_info.yml
@@ -1,9 +1,10 @@
-- debug:
+- name: Start ntnx_address_groups_info tests
+ ansible.builtin.debug:
msg: start testing ntnx_address_groups_info
- name: Create address groups for tests
ntnx_address_groups:
- name: test-address-groups-info-1
+ name: Test-address-groups-info-1
subnets:
- network_ip: "10.0.2.0"
network_prefix: 24
@@ -11,7 +12,7 @@
- name: Create address groups for tests
ntnx_address_groups:
- name: test-address-groups-info-2
+ name: Test-address-groups-info-2
subnets:
- network_ip: "10.0.3.1"
network_prefix: 32
@@ -22,10 +23,10 @@
- name: List all address groups
ntnx_address_groups_info:
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.metadata.total_matches > 0
@@ -33,9 +34,11 @@
fail_msg: "Unable to list all address groups"
success_msg: " address groups info obtained successfully"
-- set_fact:
+- name: Set address group name
+ ansible.builtin.set_fact:
test_address_groups_name: "{{result.response.entities.1.address_group.name}}"
-- set_fact:
+- name: Set address group uuid
+ ansible.builtin.set_fact:
test_address_groups_uuid: "{{result.response.entities.1.uuid}}"
##################################################
@@ -44,10 +47,10 @@
ntnx_address_groups_info:
address_group_uuid: "{{ test_address_groups_uuid }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -63,10 +66,10 @@
filter:
name: "{{ test_address_groups_name }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -84,10 +87,10 @@
length: 1
offset: 1
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -98,14 +101,16 @@
##################################################
-- name: delete created address groups for tests
+- name: Delete created address groups for tests
ntnx_address_groups:
state: absent
address_group_uuid: "{{ ag_1.address_group_uuid}}"
+ register: result
ignore_errors: true
-- name: delete created address groups for tests
+- name: Delete created address groups for tests
ntnx_address_groups:
state: absent
address_group_uuid: "{{ ag_2.address_group_uuid}}"
+ register: result
ignore_errors: true
diff --git a/tests/integration/targets/ntnx_address_groups_info/tasks/main.yml b/tests/integration/targets/ntnx_address_groups_info/tasks/main.yml
index 011a2fd92..4bb1a4369 100644
--- a/tests/integration/targets/ntnx_address_groups_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_address_groups_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "address_groups_info.yml"
+ - name: Import "address_groups_info.yml"
+ ansible.builtin.import_tasks: "address_groups_info.yml"
diff --git a/tests/integration/targets/ntnx_categories/tasks/all_operations.yml b/tests/integration/targets/ntnx_categories/tasks/all_operations.yml
index 3d546343c..740314beb 100644
--- a/tests/integration/targets/ntnx_categories/tasks/all_operations.yml
+++ b/tests/integration/targets/ntnx_categories/tasks/all_operations.yml
@@ -1,18 +1,20 @@
---
-- debug:
+- name: Start testing ntnx_categories
+ ansible.builtin.debug:
msg: Start testing ntnx_categories
-- set_fact:
+- name: Set category key and values
+ ansible.builtin.set_fact:
first_category:
- name: test-catA1
+ name: Test-catA1
desc: first test description
update_desc: updated test description
second_category:
- name: test-catB1
+ name: Test-catB1
values:
- - 'value-a'
- - 'value-b'
- - 'value-c'
+ - "value-a"
+ - "value-b"
+ - "value-c"
- name: Create only category key with description
ntnx_categories:
@@ -23,7 +25,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -45,9 +47,8 @@
register: result
ignore_errors: true
-
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -59,7 +60,7 @@
fail_msg: "Unable to Add values to existing category key having no values & Update description"
success_msg: "Add values to existing category key having no values & Update description finished successfully"
#################
-- name: update existing category with same values
+- name: Update existing category with same values
ntnx_categories:
state: "present"
name: "{{first_category.name}}"
@@ -71,7 +72,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -79,7 +80,7 @@
fail_msg: "Fail: existing category update with wrong values"
success_msg: "Passed: Nothing to update as expected "
#################
-- name: update existing category by deleting some values
+- name: Update existing category by deleting some values
ntnx_categories:
state: "absent"
name: "{{first_category.name}}"
@@ -89,14 +90,14 @@
register: result
ignore_errors: true
-- name: get modified category
+- name: Get modified category
ntnx_categories_info:
name: "{{first_category.name}}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -106,7 +107,7 @@
fail_msg: "Fail: unable to update existing category by deleting some values "
success_msg: "Passed: update existing category by deleting some values finished successfully"
#################
-- name: update existing category by deleting all values
+- name: Update existing category by deleting all values
ntnx_categories:
state: "absent"
name: "{{first_category.name}}"
@@ -114,15 +115,14 @@
register: result
ignore_errors: true
-- name: get modified category
+- name: Get modified category
ntnx_categories_info:
name: "{{first_category.name}}"
register: result
ignore_errors: true
-
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -138,14 +138,14 @@
register: result
ignore_errors: true
-- name: search deleted category
+- name: Search deleted category
ntnx_categories_info:
name: "{{first_category.name}}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -167,7 +167,7 @@
check_mode: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -191,7 +191,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -202,7 +202,7 @@
fail_msg: "Unable to Create category key and value together"
success_msg: "Create category key and value together finished successfully"
#################
-- name: delete the category
+- name: Delete the category
ntnx_categories:
state: "absent"
name: "{{second_category.name}}"
@@ -210,7 +210,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
diff --git a/tests/integration/targets/ntnx_categories/tasks/main.yml b/tests/integration/targets/ntnx_categories/tasks/main.yml
index d4d19ea74..b0f46a02c 100644
--- a/tests/integration/targets/ntnx_categories/tasks/main.yml
+++ b/tests/integration/targets/ntnx_categories/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "all_operations.yml"
+ - name: Import "all_operations.yml"
+ ansible.builtin.import_tasks: "all_operations.yml"
diff --git a/tests/integration/targets/ntnx_categories_info/tasks/info.yml b/tests/integration/targets/ntnx_categories_info/tasks/info.yml
index 69a1eff99..2e4ffcfca 100644
--- a/tests/integration/targets/ntnx_categories_info/tasks/info.yml
+++ b/tests/integration/targets/ntnx_categories_info/tasks/info.yml
@@ -1,14 +1,15 @@
---
-- debug:
+- name: Start testing ntnx_categories_info
+ ansible.builtin.debug:
msg: Start testing ntnx_categories_info
-- name: test getting all categories
+- name: Test getting all categories
ntnx_categories_info:
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response.entities is defined
- result.changed == false
@@ -18,12 +19,13 @@
fail_msg: "Unable to list all categories"
success_msg: "categories listed successfully"
#####################################################################################################
-- set_fact:
- category_name: test-catAA
+- name: Set category name and values
+ ansible.builtin.set_fact:
+ category_name: Test-catAA
values:
- - 'value-a'
- - 'value-b'
- - 'value-c'
+ - "value-a"
+ - "value-b"
+ - "value-c"
- name: Create category key
ntnx_categories:
@@ -33,15 +35,15 @@
register: result
ignore_errors: true
-- name: test getting the category with filter by it's name
+- name: Test getting the category with filter by it's name
ntnx_categories_info:
filter:
- name: "{{category_name}}"
+ name: "{{category_name}}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response.entities|length == 1
- result.changed == false
@@ -50,14 +52,14 @@
fail_msg: "Unable to get particular category with name filter"
success_msg: "category info obtained successfully by name filter"
#####################################################################################################
-- name: test getting the category by it's name
+- name: Test getting the category by it's name
ntnx_categories_info:
- name: "{{category_name}}"
+ name: "{{category_name}}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -66,7 +68,7 @@
fail_msg: "Unable to get particular category with it's name"
success_msg: "category info obtained successfully by it's name"
#####################################################################################################
-- name: delete the category
+- name: Delete the category
ntnx_categories:
state: "absent"
name: "{{category_name}}"
@@ -74,7 +76,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
diff --git a/tests/integration/targets/ntnx_categories_info/tasks/main.yml b/tests/integration/targets/ntnx_categories_info/tasks/main.yml
index 3364b30c6..2063c49b4 100644
--- a/tests/integration/targets/ntnx_categories_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_categories_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "info.yml"
+ - name: Import "info.yml"
+ ansible.builtin.import_tasks: "info.yml"
diff --git a/tests/integration/targets/ntnx_clusters_info/tasks/get_clusters_info.yml b/tests/integration/targets/ntnx_clusters_info/tasks/get_clusters_info.yml
index 4f78278c2..bb495053e 100644
--- a/tests/integration/targets/ntnx_clusters_info/tasks/get_clusters_info.yml
+++ b/tests/integration/targets/ntnx_clusters_info/tasks/get_clusters_info.yml
@@ -1,14 +1,15 @@
---
-- debug:
+- name: Start testing ntnx_clusters_info
+ ansible.builtin.debug:
msg: Start testing ntnx_clusters_info
-- name: test getting all clusters
+- name: Test getting all clusters
ntnx_clusters_info:
register: clusters
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- clusters.response is defined
- clusters.changed == false
@@ -17,15 +18,14 @@
fail_msg: "Unable to list all cluster"
success_msg: "clusters listed successfully"
-
-- name: test getting particular cluster using uuid
+- name: Test getting particular cluster using uuid
ntnx_clusters_info:
- cluster_uuid: '{{ clusters.response.entities[0].metadata.uuid }}'
+ cluster_uuid: "{{ clusters.response.entities[0].metadata.uuid }}"
register: result
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -34,8 +34,6 @@
- result.response.status.state == "COMPLETE"
fail_msg: "Unable to get particular cluster"
success_msg: "custer info obtained successfully"
-
-
# commenting due to technical issue
# - name: List clusters using length, offset, sort order and priority sort attribute
# ntnx_clusters_info:
@@ -44,10 +42,10 @@
# sort_order: "ASCENDING"
# sort_attribute: "name"
# register: result
-# ignore_errors: True
+# ignore_errors: true
-# - name: check listing status
-# assert:
+# - name: Check listing status
+# ansible.builtin.assert:
# that:
# - result.response is defined
# - result.changed == false
diff --git a/tests/integration/targets/ntnx_clusters_info/tasks/main.yml b/tests/integration/targets/ntnx_clusters_info/tasks/main.yml
index 9cf0aa472..4a9905a64 100644
--- a/tests/integration/targets/ntnx_clusters_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_clusters_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "get_clusters_info.yml"
+ - name: Import "get_clusters_info.yml"
+ ansible.builtin.import_tasks: "get_clusters_info.yml"
diff --git a/tests/integration/targets/ntnx_foundation/tasks/image_nodes.yml b/tests/integration/targets/ntnx_foundation/tasks/image_nodes.yml
index 65560e6cc..b21192c85 100644
--- a/tests/integration/targets/ntnx_foundation/tasks/image_nodes.yml
+++ b/tests/integration/targets/ntnx_foundation/tasks/image_nodes.yml
@@ -1,68 +1,68 @@
---
- - debug:
- msg: start testing ntnx_foundation
+- name: Start testing ntnx_foundation
+ ansible.builtin.debug:
+ msg: start testing ntnx_foundation
- - name: Image nodes using manual and discovery modes. Create cluster
- ntnx_foundation:
- timeout: 4500
- nutanix_host: "{{foundation_host}}"
- cvm_gateway: "{{cvm_gateway}}"
- cvm_netmask: "{{cvm_netmask}}"
- hypervisor_gateway: "{{hypervisor_gateway}}"
- hypervisor_netmask: "{{hypervisor_netmask}}"
- default_ipmi_user: "{{default_ipmi_user}}"
- current_cvm_vlan_tag: "0"
- nos_package: "{{nos_package}}"
- blocks:
- - block_id: "{{IBIS_node.block_id}}"
- nodes:
- - manual_mode:
- cvm_ip: "{{IBIS_node.node1.cvm_ip}}"
- cvm_gb_ram: 50
- hypervisor_hostname: "{{IBIS_node.node1.hypervisor_hostname}}"
- ipmi_netmask: "{{IBIS_node.node1.ipmi_netmask}}"
- ipmi_gateway: "{{IBIS_node.node1.ipmi_gateway}}"
- ipmi_ip: "{{IBIS_node.node1.ipmi_ip}}"
- ipmi_password: "{{IBIS_node.node1.ipmi_password}}"
- hypervisor: "{{IBIS_node.node1.hypervisor}}"
- hypervisor_ip: "{{IBIS_node.node1.hypervisor_ip}}"
- node_position: "{{IBIS_node.node1.node_position}}"
- - discovery_mode: #dos mode using cvm
- cvm_gb_ram: 50
- node_serial: "{{IBIS_node.node3.node_serial}}"
- device_hint: "vm_installer"
- discovery_override:
- hypervisor_hostname: "{{IBIS_node.node3.hypervisor_hostname}}"
- hypervisor_ip: "{{IBIS_node.node3.hypervisor_ip}}"
- cvm_ip: "{{IBIS_node.node3.cvm_ip}}"
- hypervisor: "{{IBIS_node.node3.hypervisor}}"
- - discovery_mode: # aos node using ipmi
- cvm_gb_ram: 50
- ipmi_password: "{{IBIS_node.node2.ipmi_password}}"
- node_serial: "{{IBIS_node.node2.node_serial}}"
- discovery_override:
- hypervisor_hostname: "IBIS2"
- clusters:
- - redundancy_factor: 2
- cluster_members:
- - "{{IBIS_node.node1.cvm_ip}}"
- - "{{IBIS_node.node3.cvm_ip}}"
- - "{{IBIS_node.node2.cvm_ip}}"
- name: "test-cluster"
- register: first_cluster
- ignore_errors: True
- # when: false # make it true or remove to unskip task
-
- - name: Creation Status
- assert:
- that:
- - first_cluster.response is defined
- - first_cluster.failed==false
- - first_cluster.changed==true
- - first_cluster.response.cluster_urls is defined
- - first_cluster.response.cluster_urls.0.name=="test-cluster"
- fail_msg: " Fail : unable to create cluster with three node"
- success_msg: "Success: cluster with three node created successfully "
- # when: false # make it true or remove to unskip task
+- name: Image nodes using manual and discovery modes. Create cluster
+ ntnx_foundation:
+ timeout: 4500
+ nutanix_host: "{{foundation_host}}"
+ cvm_gateway: "{{cvm_gateway}}"
+ cvm_netmask: "{{cvm_netmask}}"
+ hypervisor_gateway: "{{hypervisor_gateway}}"
+ hypervisor_netmask: "{{hypervisor_netmask}}"
+ default_ipmi_user: "{{default_ipmi_user}}"
+ current_cvm_vlan_tag: "0"
+ nos_package: "{{nos_package}}"
+ blocks:
+ - block_id: "{{IBIS_node.block_id}}"
+ nodes:
+ - manual_mode:
+ cvm_ip: "{{IBIS_node.node1.cvm_ip}}"
+ cvm_gb_ram: 50
+ hypervisor_hostname: "{{IBIS_node.node1.hypervisor_hostname}}"
+ ipmi_netmask: "{{IBIS_node.node1.ipmi_netmask}}"
+ ipmi_gateway: "{{IBIS_node.node1.ipmi_gateway}}"
+ ipmi_ip: "{{IBIS_node.node1.ipmi_ip}}"
+ ipmi_password: "{{IBIS_node.node1.ipmi_password}}"
+ hypervisor: "{{IBIS_node.node1.hypervisor}}"
+ hypervisor_ip: "{{IBIS_node.node1.hypervisor_ip}}"
+ node_position: "{{IBIS_node.node1.node_position}}"
+ - discovery_mode: # dos mode using cvm
+ cvm_gb_ram: 50
+ node_serial: "{{IBIS_node.node3.node_serial}}"
+ device_hint: "vm_installer"
+ discovery_override:
+ hypervisor_hostname: "{{IBIS_node.node3.hypervisor_hostname}}"
+ hypervisor_ip: "{{IBIS_node.node3.hypervisor_ip}}"
+ cvm_ip: "{{IBIS_node.node3.cvm_ip}}"
+ hypervisor: "{{IBIS_node.node3.hypervisor}}"
+ - discovery_mode: # aos node using ipmi
+ cvm_gb_ram: 50
+ ipmi_password: "{{IBIS_node.node2.ipmi_password}}"
+ node_serial: "{{IBIS_node.node2.node_serial}}"
+ discovery_override:
+ hypervisor_hostname: "IBIS2"
+ clusters:
+ - redundancy_factor: 2
+ cluster_members:
+ - "{{IBIS_node.node1.cvm_ip}}"
+ - "{{IBIS_node.node3.cvm_ip}}"
+ - "{{IBIS_node.node2.cvm_ip}}"
+ name: "test-cluster"
+ register: first_cluster
+ ignore_errors: true
+ # when: false # make it true or remove to unskip task
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - first_cluster.response is defined
+ - first_cluster.failed==false
+ - first_cluster.changed==true
+ - first_cluster.response.cluster_urls is defined
+ - first_cluster.response.cluster_urls.0.name=="test-cluster"
+ fail_msg: " Fail : unable to create cluster with three node"
+ success_msg: "Succes: cluster with three node created successfully "
+ # when: false # make it true or remove to unskip task
######################################################
diff --git a/tests/integration/targets/ntnx_foundation/tasks/main.yml b/tests/integration/targets/ntnx_foundation/tasks/main.yml
index 61dfecb44..b71c47a6b 100644
--- a/tests/integration/targets/ntnx_foundation/tasks/main.yml
+++ b/tests/integration/targets/ntnx_foundation/tasks/main.yml
@@ -1,7 +1,10 @@
---
-- module_defaults:
- nutanix.ncp.ntnx_foundation:
- nutanix_host: "{{ foundation_host }}"
+- name: Set module defaults
+ module_defaults:
+ nutanix.ncp.ntnx_foundation:
+ nutanix_host: "{{ foundation_host }}"
block:
- - import_tasks: "image_nodes.yml"
- - import_tasks: "negative_scenarios.yml"
+ - name: Import "image_nodes.yml""
+ ansible.builtin.import_tasks: "image_nodes.yml"
+ - name: Import "negative_scenarios.yml"
+ ansible.builtin.import_tasks: "negative_scenarios.yml"
diff --git a/tests/integration/targets/ntnx_foundation/tasks/negative_scenarios.yml b/tests/integration/targets/ntnx_foundation/tasks/negative_scenarios.yml
index 08555d845..c1160a40c 100644
--- a/tests/integration/targets/ntnx_foundation/tasks/negative_scenarios.yml
+++ b/tests/integration/targets/ntnx_foundation/tasks/negative_scenarios.yml
@@ -1,119 +1,122 @@
- - name: Image nodes with check mode
- check_mode: yes
- ntnx_foundation:
- timeout: 3660
- nutanix_host: "{{foundation_host}}"
- cvm_gateway: "{{cvm_gateway}}"
- cvm_netmask: "{{cvm_netmask}}"
- hypervisor_gateway: "{{hypervisor_gateway}}"
- hypervisor_netmask: "{{hypervisor_netmask}}"
- default_ipmi_user: "{{default_ipmi_user}}"
- current_cvm_vlan_tag: "0"
- nos_package: "{{nos_package}}"
- blocks:
- - block_id: "{{IBIS_node.block_id}}"
- nodes:
- - manual_mode:
- cvm_gb_ram: 50
- cvm_ip: "{{IBIS_node.node1.cvm_ip}}"
- hypervisor_hostname: "{{IBIS_node.node1.hypervisor_hostname}}"
- ipmi_ip: "{{IBIS_node.node1.ipmi_ip}}"
- ipmi_password: "{{IBIS_node.node1.ipmi_password}}"
- hypervisor: "{{IBIS_node.node1.hypervisor}}"
- hypervisor_ip: "{{IBIS_node.node1.hypervisor_ip}}"
- node_position: "{{IBIS_node.node1.node_position}}"
- clusters:
- - redundancy_factor: 2
- cluster_members:
- - "{{IBIS_node.node1.cvm_ip}}"
- - "{{IBIS_node.node3.cvm_ip}}"
- - "{{IBIS_node.node2.cvm_ip}}"
- name: "test-cluster"
- register: result
+- name: Image nodes with check mode
+ check_mode: true
+ ntnx_foundation:
+ timeout: 3660
+ nutanix_host: "{{foundation_host}}"
+ cvm_gateway: "{{cvm_gateway}}"
+ cvm_netmask: "{{cvm_netmask}}"
+ hypervisor_gateway: "{{hypervisor_gateway}}"
+ hypervisor_netmask: "{{hypervisor_netmask}}"
+ default_ipmi_user: "{{default_ipmi_user}}"
+ current_cvm_vlan_tag: "0"
+ nos_package: "{{nos_package}}"
+ blocks:
+ - block_id: "{{IBIS_node.block_id}}"
+ nodes:
+ - manual_mode:
+ cvm_gb_ram: 50
+ cvm_ip: "{{IBIS_node.node1.cvm_ip}}"
+ hypervisor_hostname: "{{IBIS_node.node1.hypervisor_hostname}}"
+ ipmi_ip: "{{IBIS_node.node1.ipmi_ip}}"
+ ipmi_password: "{{IBIS_node.node1.ipmi_password}}"
+ hypervisor: "{{IBIS_node.node1.hypervisor}}"
+ hypervisor_ip: "{{IBIS_node.node1.hypervisor_ip}}"
+ node_position: "{{IBIS_node.node1.node_position}}"
+ clusters:
+ - redundancy_factor: 2
+ cluster_members:
+ - "{{IBIS_node.node1.cvm_ip}}"
+ - "{{IBIS_node.node3.cvm_ip}}"
+ - "{{IBIS_node.node2.cvm_ip}}"
+ name: "test-cluster"
+ register: result
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.failed==false
- - result.changed==false
- - result.response.blocks.0.nodes.0.cvm_ip=="{{IBIS_node.node1.cvm_ip}}"
- - result.response.blocks.0.nodes.0.hypervisor_hostname=="{{IBIS_node.node1.hypervisor_hostname}}"
- - result.response.blocks.0.nodes.0.ipmi_ip=="{{IBIS_node.node1.ipmi_ip}}"
- - result.response.blocks.0.nodes.0.hypervisor=="{{IBIS_node.node1.hypervisor}}"
- - result.response.blocks.0.nodes.0.node_position=="{{IBIS_node.node1.node_position}}"
- - result.response.clusters.0.cluster_name=="test-cluster"
- fail_msg: " Fail : check_mode fail"
- success_msg: "Success: returned response as expected"
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.failed==false
+ - result.changed==false
+ - result.response.blocks.0.nodes.0.cvm_ip=="{{IBIS_node.node1.cvm_ip}}"
+ - result.response.blocks.0.nodes.0.hypervisor_hostname=="{{IBIS_node.node1.hypervisor_hostname}}"
+ - result.response.blocks.0.nodes.0.ipmi_ip=="{{IBIS_node.node1.ipmi_ip}}"
+ - result.response.blocks.0.nodes.0.hypervisor=="{{IBIS_node.node1.hypervisor}}"
+ - result.response.blocks.0.nodes.0.node_position=="{{IBIS_node.node1.node_position}}"
+ - result.response.clusters.0.cluster_name=="test-cluster"
+ fail_msg: " Fail : check_mode fail"
+ success_msg: "Success: returned response as expected"
###################################
- - debug:
- msg: start negative_scenarios for ntnx_foundation
+- name: Start negative_scenarios for ntnx_foundation
+ ansible.builtin.debug:
+ msg: start negative_scenarios for ntnx_foundation
###################################
- - name: Image nodes with wrong serial
- ntnx_foundation:
- timeout: 3660
- nutanix_host: "{{foundation_host}}"
- cvm_gateway: "{{cvm_gateway}}"
- cvm_netmask: "{{cvm_netmask}}"
- hypervisor_gateway: "{{hypervisor_gateway}}"
- hypervisor_netmask: "{{hypervisor_netmask}}"
- default_ipmi_user: "{{default_ipmi_user}}"
- current_cvm_vlan_tag: "0"
- nos_package: "{{nos_package}}"
- blocks:
- - block_id: "{{IBIS_node.block_id}}"
- nodes:
- - discovery_mode:
- cvm_gb_ram: 50
- node_serial: wrong_serial
- device_hint: "vm_installer"
- discovery_override:
- hypervisor_hostname: "{{IBIS_node.node3.hypervisor_hostname}}"
- hypervisor_ip: "{{IBIS_node.node3.hypervisor_ip}}"
- cvm_ip: "{{IBIS_node.node3.cvm_ip}}"
- hypervisor: "{{IBIS_node.node3.hypervisor}}"
- register: result
- ignore_errors: True
+- name: Image nodes with wrong serial
+ ntnx_foundation:
+ timeout: 3660
+ nutanix_host: "{{foundation_host}}"
+ cvm_gateway: "{{cvm_gateway}}"
+ cvm_netmask: "{{cvm_netmask}}"
+ hypervisor_gateway: "{{hypervisor_gateway}}"
+ hypervisor_netmask: "{{hypervisor_netmask}}"
+ default_ipmi_user: "{{default_ipmi_user}}"
+ current_cvm_vlan_tag: "0"
+ nos_package: "{{nos_package}}"
+ blocks:
+ - block_id: "{{IBIS_node.block_id}}"
+ nodes:
+ - discovery_mode:
+ cvm_gb_ram: 50
+ node_serial: wrong_serial
+ device_hint: "vm_installer"
+ discovery_override:
+ hypervisor_hostname: "{{IBIS_node.node3.hypervisor_hostname}}"
+ hypervisor_ip: "{{IBIS_node.node3.hypervisor_ip}}"
+ cvm_ip: "{{IBIS_node.node3.cvm_ip}}"
+ hypervisor: "{{IBIS_node.node3.hypervisor}}"
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.msg == "Failed generating Image Nodes Spec"
- - result.changed==false
- - result.failed==true
- fail_msg: " Fail : image node with wrong serial done successfully "
- success_msg: "Success: unable to image node with wrong serial "
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.msg == "Failed generating Image Nodes Spec"
+ - result.changed==false
+ - result.failed==true
+ fail_msg: " Fail : image node with wrong serial done successfully "
+ success_msg: "Success: unable to image node with wrong serial "
###################################
- - name: Image nodes with wrong hypervisor
- ntnx_foundation:
- timeout: 3660
- cvm_gateway: "{{cvm_gateway}}"
- cvm_netmask: "{{cvm_netmask}}"
- hypervisor_gateway: "{{hypervisor_gateway}}"
- hypervisor_netmask: "{{hypervisor_netmask}}"
- default_ipmi_user: "{{default_ipmi_user}}"
- current_cvm_vlan_tag: "0"
- nos_package: "{{nos_package}}"
- blocks:
- - block_id: "{{IBIS_node.block_id}}"
- nodes:
- - discovery_mode:
- cvm_gb_ram: 50
- node_serial: wrong_serial
- device_hint: "vm_installer"
- discovery_override:
- hypervisor_ip: "{{IBIS_node.node3.hypervisor_ip}}"
- cvm_ip: "{{IBIS_node.node3.cvm_ip}}"
- hypervisor_hostname: "{{IBIS_node.node3.hypervisor_hostname}}"
- hypervisor: "phoenix"
- register: result
- ignore_errors: True
+- name: Image nodes with wrong hypervisor
+ ntnx_foundation:
+ timeout: 3660
+ cvm_gateway: "{{cvm_gateway}}"
+ cvm_netmask: "{{cvm_netmask}}"
+ hypervisor_gateway: "{{hypervisor_gateway}}"
+ hypervisor_netmask: "{{hypervisor_netmask}}"
+ default_ipmi_user: "{{default_ipmi_user}}"
+ current_cvm_vlan_tag: "0"
+ nos_package: "{{nos_package}}"
+ blocks:
+ - block_id: "{{IBIS_node.block_id}}"
+ nodes:
+ - discovery_mode:
+ cvm_gb_ram: 50
+ node_serial: wrong_serial
+ device_hint: "vm_installer"
+ discovery_override:
+ hypervisor_ip: "{{IBIS_node.node3.hypervisor_ip}}"
+ cvm_ip: "{{IBIS_node.node3.cvm_ip}}"
+ hypervisor_hostname: "{{IBIS_node.node3.hypervisor_hostname}}"
+ hypervisor: "phoenix"
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.changed==false
- - result.failed==true
- - "result.msg=='value of hypervisor must be one of: kvm, hyperv, xen, esx, ahv, got: phoenix found in blocks -> nodes -> discovery_mode -> discovery_override'"
- fail_msg: " Fail : Image nodes with wrong hypervisor done successfully "
- success_msg: "Success: unable to image node with wrong hypervisor"
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.changed==false
+ - result.failed==true
+ - >
+ "result.msg=='value of hypervisor must be one of: kvm, hyperv, xen, esx, ahv,
+ got: phoenix found in blocks -> nodes -> discovery_mode -> discovery_override'"
+ fail_msg: " Fail : Image nodes with wrong hypervisor done successfully "
+ success_msg: "Success: unable to image node with wrong hypervisor"
diff --git a/tests/integration/targets/ntnx_foundation_aos_packages_info/tasks/get_aos.yml b/tests/integration/targets/ntnx_foundation_aos_packages_info/tasks/get_aos.yml
index f9600af78..b8d11dd34 100644
--- a/tests/integration/targets/ntnx_foundation_aos_packages_info/tasks/get_aos.yml
+++ b/tests/integration/targets/ntnx_foundation_aos_packages_info/tasks/get_aos.yml
@@ -1,13 +1,14 @@
---
-- debug:
+- name: Start testing ntnx_foundation_aos_packages_info
+ ansible.builtin.debug:
msg: start testing ntnx_foundation_aos_packages_info
-- name: get aos_packages_info from foundation
+- name: Get aos_packages_info from foundation
ntnx_foundation_aos_packages_info:
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.aos_packages | length > 0
- result.aos_packages is defined
diff --git a/tests/integration/targets/ntnx_foundation_aos_packages_info/tasks/main.yml b/tests/integration/targets/ntnx_foundation_aos_packages_info/tasks/main.yml
index 5b585991e..7f1ec1d40 100644
--- a/tests/integration/targets/ntnx_foundation_aos_packages_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_foundation_aos_packages_info/tasks/main.yml
@@ -1,6 +1,8 @@
---
-- module_defaults:
- nutanix.ncp.ntnx_foundation_aos_packages_info:
- nutanix_host: "{{ foundation_host }}"
+- name: Set module defaults
+ module_defaults:
+ nutanix.ncp.ntnx_foundation_aos_packages_info:
+ nutanix_host: "{{ foundation_host }}"
block:
- - import_tasks: "get_aos.yml"
+ - name: Import "get_aos.yml"
+ ansible.builtin.import_tasks: "get_aos.yml"
diff --git a/tests/integration/targets/ntnx_foundation_bmc_ipmi_config/tasks/configure_ipmi.yml b/tests/integration/targets/ntnx_foundation_bmc_ipmi_config/tasks/configure_ipmi.yml
index 19d5e37c6..f4ce29a3f 100644
--- a/tests/integration/targets/ntnx_foundation_bmc_ipmi_config/tasks/configure_ipmi.yml
+++ b/tests/integration/targets/ntnx_foundation_bmc_ipmi_config/tasks/configure_ipmi.yml
@@ -1,8 +1,9 @@
---
-- debug:
+- name: Start testing ntnx_foundation_bmc_ipmi_config
+ ansible.builtin.debug:
msg: start testing ntnx_foundation_bmc_ipmi_config
-- name: configure ipmi
+- name: Configure ipmi
ntnx_foundation_bmc_ipmi_config:
ipmi_user: "{{bmc.ipmi_user}}"
ipmi_password: "{{bmc.ipmi_password}}"
@@ -10,13 +11,13 @@
ipmi_gateway: "{{bmc.ipmi_gateway}}"
timeout: 100
blocks:
- - nodes:
- - ipmi_mac: "{{bmc.ipmi_mac}}"
- ipmi_ip: "{{bmc.ipmi_ip}}"
+ - nodes:
+ - ipmi_mac: "{{bmc.ipmi_mac}}"
+ ipmi_ip: "{{bmc.ipmi_ip}}"
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed==false
diff --git a/tests/integration/targets/ntnx_foundation_bmc_ipmi_config/tasks/main.yml b/tests/integration/targets/ntnx_foundation_bmc_ipmi_config/tasks/main.yml
index 7ac06c2c5..32f7626ee 100644
--- a/tests/integration/targets/ntnx_foundation_bmc_ipmi_config/tasks/main.yml
+++ b/tests/integration/targets/ntnx_foundation_bmc_ipmi_config/tasks/main.yml
@@ -1,6 +1,8 @@
---
-- module_defaults:
- nutanix.ncp.ntnx_foundation_bmc_ipmi_config:
- nutanix_host: "{{ foundation_host }}"
+- name: Set module defaults
+ module_defaults:
+ nutanix.ncp.ntnx_foundation_bmc_ipmi_config:
+ nutanix_host: "{{ foundation_host }}"
block:
- - import_tasks: "configure_ipmi.yml"
+ - name: Import "configure_ipmi.yml"
+ ansible.builtin.import_tasks: "configure_ipmi.yml"
diff --git a/tests/integration/targets/ntnx_foundation_central/tasks/image_nodes.yml b/tests/integration/targets/ntnx_foundation_central/tasks/image_nodes.yml
index 461982fcd..1b59c1258 100644
--- a/tests/integration/targets/ntnx_foundation_central/tasks/image_nodes.yml
+++ b/tests/integration/targets/ntnx_foundation_central/tasks/image_nodes.yml
@@ -1,7 +1,8 @@
-- debug:
+- name: Start testing ntnx_foundation_central module
+ ansible.builtin.debug:
msg: start testing ntnx_foundation_central module
-- name: api
+- name: Api
ntnx_foundation_central:
cluster_name: "{{cluster_name}}"
skip_cluster_creation: false
@@ -45,7 +46,7 @@
# when: false # make it true or remove to unskip task
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed==false
diff --git a/tests/integration/targets/ntnx_foundation_central/tasks/main.yml b/tests/integration/targets/ntnx_foundation_central/tasks/main.yml
index ec2c1972f..11a0817e7 100644
--- a/tests/integration/targets/ntnx_foundation_central/tasks/main.yml
+++ b/tests/integration/targets/ntnx_foundation_central/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- nutanix.ncp.ntnx_foundation_central:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ nutanix.ncp.ntnx_foundation_central:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "image_nodes.yml"
+ - name: Import "image_nodes.yml"
+ ansible.builtin.import_tasks: "image_nodes.yml"
diff --git a/tests/integration/targets/ntnx_foundation_central/vars/main.yml b/tests/integration/targets/ntnx_foundation_central/vars/main.yml
index 34d455f00..806662984 100644
--- a/tests/integration/targets/ntnx_foundation_central/vars/main.yml
+++ b/tests/integration/targets/ntnx_foundation_central/vars/main.yml
@@ -1 +1 @@
-cluster_name: test_cluster
+cluster_name: Test_cluster
diff --git a/tests/integration/targets/ntnx_foundation_central_api_keys/tasks/create_key.yml b/tests/integration/targets/ntnx_foundation_central_api_keys/tasks/create_key.yml
index 08325b1b4..36602053b 100644
--- a/tests/integration/targets/ntnx_foundation_central_api_keys/tasks/create_key.yml
+++ b/tests/integration/targets/ntnx_foundation_central_api_keys/tasks/create_key.yml
@@ -1,15 +1,16 @@
-- debug:
+- name: Start testing ntnx_foundation_central_api_keys module
+ ansible.builtin.debug:
msg: start testing ntnx_foundation_central_api_keys module
-- name: create api key with check_mode
+- name: Create api key with check_mode
ntnx_foundation_central_api_keys:
- alias: test
+ alias: test
check_mode: true
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed==false
@@ -19,18 +20,17 @@
success_msg: "success: api key with check_mode: "
- name: Generate random alias for api key
- set_fact:
+ ansible.builtin.set_fact:
random_alias: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-
-- name: create api key with random alias
+- name: Create api key with random alias
ntnx_foundation_central_api_keys:
- alias: "{{random_alias.0}}"
+ alias: "{{random_alias.0}}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed==false
@@ -39,13 +39,14 @@
fail_msg: "fail: Unable to create api key "
success_msg: "success: api key created successfully "
-- ntnx_foundation_central_api_keys:
- alias: "{{random_alias.0}}"
+- name: Create duplicate api key with same alias
+ ntnx_foundation_central_api_keys:
+ alias: "{{random_alias.0}}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed==false
- result.failed==true
diff --git a/tests/integration/targets/ntnx_foundation_central_api_keys/tasks/main.yml b/tests/integration/targets/ntnx_foundation_central_api_keys/tasks/main.yml
index 9d26b931f..956e4ad1e 100644
--- a/tests/integration/targets/ntnx_foundation_central_api_keys/tasks/main.yml
+++ b/tests/integration/targets/ntnx_foundation_central_api_keys/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- nutanix.ncp.ntnx_foundation_central_api_keys:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ nutanix.ncp.ntnx_foundation_central_api_keys:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create_key.yml"
+ - name: Import "create_key.yml"
+ ansible.builtin.import_tasks: "create_key.yml"
diff --git a/tests/integration/targets/ntnx_foundation_central_api_keys_info/tasks/key_info.yml b/tests/integration/targets/ntnx_foundation_central_api_keys_info/tasks/key_info.yml
index 7e369b81b..3fcfd0088 100644
--- a/tests/integration/targets/ntnx_foundation_central_api_keys_info/tasks/key_info.yml
+++ b/tests/integration/targets/ntnx_foundation_central_api_keys_info/tasks/key_info.yml
@@ -1,19 +1,20 @@
---
-- debug:
+- name: Start testing ntnx_foundation_central_api_keys_info module
+ ansible.builtin.debug:
msg: start testing ntnx_foundation_central_api_keys_info module
- name: Generate random alias for api key
- set_fact:
+ ansible.builtin.set_fact:
random_alias: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- name: create api key with random alias
+- name: Create api key with random alias
ntnx_foundation_central_api_keys:
- alias: "{{random_alias.0}}"
+ alias: "{{random_alias.0}}"
register: key
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- key.response is defined
- key.failed==false
@@ -23,44 +24,44 @@
fail_msg: "fail: Unable to create api key "
success_msg: "success: api key created successfully "
-- name: get api key with key_uuid
+- name: Get api key with key_uuid
ntnx_foundation_central_api_keys_info:
key_uuid: "{{key.response.key_uuid}}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.alias=="{{random_alias.0}}"
fail_msg: "fail: Unable to get api key with key_uuid"
success_msg: "success: get api key with key_uuid "
-- name: get api key with alias
+- name: Get api key with alias
ntnx_foundation_central_api_keys_info:
alias: "{{random_alias.0}}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.0.key_uuid== key.response.key_uuid
fail_msg: "fail: Unable to get api key with alias name"
success_msg: "success: get api key with alias name "
-- name: get api key with custom filter
+- name: Get api key with custom filter
ntnx_foundation_central_api_keys_info:
- custom_filter:
- created_timestamp: "{{key.response.created_timestamp}}"
- alias: "{{key.response.alias}}"
+ custom_filter:
+ created_timestamp: "{{key.response.created_timestamp}}"
+ alias: "{{key.response.alias}}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed==false
diff --git a/tests/integration/targets/ntnx_foundation_central_api_keys_info/tasks/main.yml b/tests/integration/targets/ntnx_foundation_central_api_keys_info/tasks/main.yml
index 7444f4ef7..ef5f3bceb 100644
--- a/tests/integration/targets/ntnx_foundation_central_api_keys_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_foundation_central_api_keys_info/tasks/main.yml
@@ -1,15 +1,17 @@
---
-- module_defaults:
- nutanix.ncp.ntnx_foundation_central_api_keys:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ nutanix.ncp.ntnx_foundation_central_api_keys:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: false
- nutanix.ncp.ntnx_foundation_central_api_keys_info:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: false
+ nutanix.ncp.ntnx_foundation_central_api_keys_info:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: false
block:
- - import_tasks: "key_info.yml"
+ - name: Import "key_info.yml"
+ ansible.builtin.import_tasks: "key_info.yml"
diff --git a/tests/integration/targets/ntnx_foundation_central_imaged_clusters_info/tasks/get_cluster_info.yml b/tests/integration/targets/ntnx_foundation_central_imaged_clusters_info/tasks/get_cluster_info.yml
index 294de071d..1a6b2c02d 100644
--- a/tests/integration/targets/ntnx_foundation_central_imaged_clusters_info/tasks/get_cluster_info.yml
+++ b/tests/integration/targets/ntnx_foundation_central_imaged_clusters_info/tasks/get_cluster_info.yml
@@ -1,8 +1,8 @@
-- debug:
+- name: Start testing ntnx_foundation_central_imaged_clusters_info module
+ ansible.builtin.debug:
msg: start testing ntnx_foundation_central_imaged_clusters_info module
-
-- name: get imaged cluster using image_cluster_uuid
+- name: Get imaged cluster using image_cluster_uuid
ntnx_foundation_central_imaged_clusters_info:
filters:
archived: false
@@ -10,7 +10,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- clusters.changed==true
- clusters.failed==false
@@ -18,15 +18,14 @@
fail_msg: "fail: unable to get all imaged,archived cluster "
success_msg: "success: get all imaged,archived cluster successfully "
-
-- name: get imaged cluster using image_cluster_uuid
+- name: Get imaged cluster using image_cluster_uuid
ntnx_foundation_central_imaged_clusters_info:
imaged_cluster_uuid: "{{clusters.response.imaged_clusters.0.imaged_cluster_uuid}}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed==true
- result.failed==false
@@ -35,7 +34,7 @@
fail_msg: "fail: unable to get imaged cluster using image_cluster_uuid "
success_msg: "success: get imaged cluster using image_cluster_uuid successfully "
-- name: get imaged cluster using custom filter
+- name: Get imaged cluster using custom filter
ntnx_foundation_central_imaged_clusters_info:
custom_filter:
destroyed: true
@@ -43,7 +42,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed==true
- result.failed==false
@@ -53,15 +52,15 @@
# still offset and length
-# - debug:
+# - ansible.builtin.debug:
# var: clusters.response
-# - name: get imaged cluster using image_cluster_uuid
+# - name: Get imaged cluster using image_cluster_uuid
# ntnx_foundation_central_imaged_clusters_info:
# filters:
# archived: false
# length: 20
# register: result
# ignore_errors: true
-# - debug:
+# - ansible.builtin.debug:
# var: result.response.imaged_clusters|length
diff --git a/tests/integration/targets/ntnx_foundation_central_imaged_clusters_info/tasks/main.yml b/tests/integration/targets/ntnx_foundation_central_imaged_clusters_info/tasks/main.yml
index 0a642e6ba..433833a9d 100644
--- a/tests/integration/targets/ntnx_foundation_central_imaged_clusters_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_foundation_central_imaged_clusters_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- nutanix.ncp.ntnx_foundation_central_imaged_clusters_info:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ nutanix.ncp.ntnx_foundation_central_imaged_clusters_info:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "get_cluster_info.yml"
+ - name: Import "get_cluster_info.yml"
+ ansible.builtin.import_tasks: "get_cluster_info.yml"
diff --git a/tests/integration/targets/ntnx_foundation_central_imaged_nodes_info/tasks/get_node_info.yml b/tests/integration/targets/ntnx_foundation_central_imaged_nodes_info/tasks/get_node_info.yml
index 4e30b3294..0c6ea1247 100644
--- a/tests/integration/targets/ntnx_foundation_central_imaged_nodes_info/tasks/get_node_info.yml
+++ b/tests/integration/targets/ntnx_foundation_central_imaged_nodes_info/tasks/get_node_info.yml
@@ -1,13 +1,14 @@
-- debug:
+- name: Start testing ntnx_foundation_central_imaged_nodes_info module
+ ansible.builtin.debug:
msg: start testing ntnx_foundation_central_imaged_nodes_info module
-- name: get all imaged nodes
+- name: Get all imaged nodes
ntnx_foundation_central_imaged_nodes_info:
register: nodes
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- nodes.changed==true
- nodes.failed==false
@@ -17,14 +18,14 @@
fail_msg: "fail: unable to get all imaged nodes "
success_msg: "success: get all imaged nodes successfully "
-- name: get node by uuid
+- name: Get node by uuid
ntnx_foundation_central_imaged_nodes_info:
imaged_node_uuid: "{{nodes.response.imaged_nodes.0.imaged_node_uuid}}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed==true
- result.failed==false
@@ -33,7 +34,7 @@
fail_msg: "fail: unable to get node by uuid"
success_msg: "success: get node by uuid successfully "
-- name: get imaged node using custom filter
+- name: Get imaged node using custom filter
ntnx_foundation_central_imaged_nodes_info:
custom_filter:
node_serial: "{{nodes.response.imaged_nodes.0.node_serial}}"
@@ -41,7 +42,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed==true
- result.failed==false
diff --git a/tests/integration/targets/ntnx_foundation_central_imaged_nodes_info/tasks/main.yml b/tests/integration/targets/ntnx_foundation_central_imaged_nodes_info/tasks/main.yml
index 552adf413..bdf3d4523 100644
--- a/tests/integration/targets/ntnx_foundation_central_imaged_nodes_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_foundation_central_imaged_nodes_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- nutanix.ncp.ntnx_foundation_central_imaged_nodes_info:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ nutanix.ncp.ntnx_foundation_central_imaged_nodes_info:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "get_node_info.yml"
+ - name: Import "get_node_info.yml"
+ ansible.builtin.import_tasks: "get_node_info.yml"
diff --git a/tests/integration/targets/ntnx_foundation_discover_nodes_info/tasks/discover_nodes.yml b/tests/integration/targets/ntnx_foundation_discover_nodes_info/tasks/discover_nodes.yml
index aa1ffd92e..cc804c51f 100644
--- a/tests/integration/targets/ntnx_foundation_discover_nodes_info/tasks/discover_nodes.yml
+++ b/tests/integration/targets/ntnx_foundation_discover_nodes_info/tasks/discover_nodes.yml
@@ -1,5 +1,6 @@
---
-- debug:
+- name: Start testing ntnx_foundation_discover_nodes_info
+ ansible.builtin.debug:
msg: start testing ntnx_foundation_discover_nodes_info
- name: Discover nodes
@@ -7,7 +8,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.blocks is defined
- result.failed==false
@@ -23,7 +24,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.blocks is defined
- result.failed==false
@@ -38,7 +39,7 @@
# register: result
# - name: Creation Status
-# assert:
+# ansible.builtin.assert:
# that:
# - result.blocks is defined
# - result.failed==false
diff --git a/tests/integration/targets/ntnx_foundation_discover_nodes_info/tasks/main.yml b/tests/integration/targets/ntnx_foundation_discover_nodes_info/tasks/main.yml
index ef590b9a7..8228114c2 100644
--- a/tests/integration/targets/ntnx_foundation_discover_nodes_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_foundation_discover_nodes_info/tasks/main.yml
@@ -1,6 +1,8 @@
---
-- module_defaults:
- nutanix.ncp.ntnx_foundation_discover_nodes_info:
- nutanix_host: "{{ foundation_host }}"
+- name: Set module defaults
+ module_defaults:
+ nutanix.ncp.ntnx_foundation_discover_nodes_info:
+ nutanix_host: "{{ foundation_host }}"
block:
- - import_tasks: "discover_nodes.yml"
+ - name: Import "discover_nodes.yml"
+ ansible.builtin.import_tasks: "discover_nodes.yml"
diff --git a/tests/integration/targets/ntnx_foundation_hypervisor_images_info/tasks/get_hypervisors.yml b/tests/integration/targets/ntnx_foundation_hypervisor_images_info/tasks/get_hypervisors.yml
index 18a3c5587..a55844411 100644
--- a/tests/integration/targets/ntnx_foundation_hypervisor_images_info/tasks/get_hypervisors.yml
+++ b/tests/integration/targets/ntnx_foundation_hypervisor_images_info/tasks/get_hypervisors.yml
@@ -1,13 +1,14 @@
---
-- debug:
+- name: Start testing ntnx_foundation_hypervisor_images_info
+ ansible.builtin.debug:
msg: start testing ntnx_foundation_hypervisor_images_info
-- name: get hypervisor_images_info from foundation
+- name: Get hypervisor_images_info from foundation
ntnx_foundation_hypervisor_images_info:
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.hypervisor_images | length > 0
- result.hypervisor_images is defined
diff --git a/tests/integration/targets/ntnx_foundation_hypervisor_images_info/tasks/main.yml b/tests/integration/targets/ntnx_foundation_hypervisor_images_info/tasks/main.yml
index 87fb5fbb1..aeeab00ad 100644
--- a/tests/integration/targets/ntnx_foundation_hypervisor_images_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_foundation_hypervisor_images_info/tasks/main.yml
@@ -1,6 +1,8 @@
---
-- module_defaults:
- nutanix.ncp.ntnx_foundation_hypervisor_images_info:
- nutanix_host: "{{ foundation_host }}"
+- name: Set module defaults
+ module_defaults:
+ nutanix.ncp.ntnx_foundation_hypervisor_images_info:
+ nutanix_host: "{{ foundation_host }}"
block:
- - import_tasks: "get_hypervisors.yml"
+ - name: Import "get_hypervisors.yml"
+ ansible.builtin.import_tasks: "get_hypervisors.yml"
diff --git a/tests/integration/targets/ntnx_foundation_image_upload/tasks/main.yml b/tests/integration/targets/ntnx_foundation_image_upload/tasks/main.yml
index ce36d3623..0b0ceb6e4 100644
--- a/tests/integration/targets/ntnx_foundation_image_upload/tasks/main.yml
+++ b/tests/integration/targets/ntnx_foundation_image_upload/tasks/main.yml
@@ -1,7 +1,10 @@
---
-- module_defaults:
- nutanix.ncp.ntnx_foundation_image_upload:
- nutanix_host: "{{ foundation_host }}"
+- name: Set module defaults
+ module_defaults:
+ nutanix.ncp.ntnx_foundation_image_upload:
+ nutanix_host: "{{ foundation_host }}"
block:
- - import_tasks: "upload.yml"
- - import_tasks: "negative_scenarios.yml"
+ - name: Import "upload.yml"
+ ansible.builtin.import_tasks: "upload.yml"
+ - name: Import "negative_scenarios.yml"
+ ansible.builtin.import_tasks: "negative_scenarios.yml"
diff --git a/tests/integration/targets/ntnx_foundation_image_upload/tasks/negative_scenarios.yml b/tests/integration/targets/ntnx_foundation_image_upload/tasks/negative_scenarios.yml
index d3957ac6b..e551f76f6 100644
--- a/tests/integration/targets/ntnx_foundation_image_upload/tasks/negative_scenarios.yml
+++ b/tests/integration/targets/ntnx_foundation_image_upload/tasks/negative_scenarios.yml
@@ -9,7 +9,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.failed==true
- result.changed==false
diff --git a/tests/integration/targets/ntnx_foundation_image_upload/tasks/upload.yml b/tests/integration/targets/ntnx_foundation_image_upload/tasks/upload.yml
index 00555ee16..a726029bc 100644
--- a/tests/integration/targets/ntnx_foundation_image_upload/tasks/upload.yml
+++ b/tests/integration/targets/ntnx_foundation_image_upload/tasks/upload.yml
@@ -1,9 +1,11 @@
---
-- debug:
+- name: Start testing ntnx_foundation_image_upload
+ ansible.builtin.debug:
msg: start testing ntnx_foundation_image_upload
- name: Download image for test
- get_url:
+ ansible.builtin.get_url:
+ mode: "0644"
url: "{{ image_url }}"
dest: "{{ source }}"
@@ -18,7 +20,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed==false
@@ -35,7 +37,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response.status_code == 200
- result.failed==false
diff --git a/tests/integration/targets/ntnx_foundation_node_network_info/tasks/get_info.yml b/tests/integration/targets/ntnx_foundation_node_network_info/tasks/get_info.yml
index 5c8327f3e..7cd9969ab 100644
--- a/tests/integration/targets/ntnx_foundation_node_network_info/tasks/get_info.yml
+++ b/tests/integration/targets/ntnx_foundation_node_network_info/tasks/get_info.yml
@@ -1,5 +1,6 @@
---
-- debug:
+- name: Start testing ntnx_foundation_node_network_info
+ ansible.builtin.debug:
msg: start testing ntnx_foundation_node_network_info
- name: Discover nodes
@@ -14,7 +15,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.nodes is defined
- result.failed==false
diff --git a/tests/integration/targets/ntnx_foundation_node_network_info/tasks/main.yml b/tests/integration/targets/ntnx_foundation_node_network_info/tasks/main.yml
index 12815744d..bdab30ff5 100644
--- a/tests/integration/targets/ntnx_foundation_node_network_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_foundation_node_network_info/tasks/main.yml
@@ -1,6 +1,8 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ foundation_host }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ foundation_host }}"
block:
- - import_tasks: "get_info.yml"
+ - name: Import "get_info.yml"
+ ansible.builtin.import_tasks: "get_info.yml"
diff --git a/tests/integration/targets/ntnx_foundation_sanity/tasks/image_nodes.yml b/tests/integration/targets/ntnx_foundation_sanity/tasks/image_nodes.yml
index 8ed9ee396..ebc42ce78 100644
--- a/tests/integration/targets/ntnx_foundation_sanity/tasks/image_nodes.yml
+++ b/tests/integration/targets/ntnx_foundation_sanity/tasks/image_nodes.yml
@@ -1,214 +1,216 @@
---
- - debug:
- msg: start testing ntnx_foundation test for bare metal imaging and cluster creation
+- name: Start testing ntnx_foundation test for bare metal imaging and cluster creation
+ ansible.builtin.debug:
+ msg: start testing ntnx_foundation test for bare metal imaging and cluster creation
+- name: Get aos_packages_info from foundation
+ ntnx_foundation_aos_packages_info:
+ register: images
- - name: get aos_packages_info from foundation
- ntnx_foundation_aos_packages_info:
- register: images
+- name: Create spec for imaging and creating cluster out of bare metal nodes
+ check_mode: true
+ ntnx_foundation:
+ timeout: 4500
+ cvm_gateway: "{{cvm_gateway}}"
+ cvm_netmask: "{{cvm_netmask}}"
+ hypervisor_gateway: "{{hypervisor_gateway}}"
+ hypervisor_netmask: "{{hypervisor_netmask}}"
+ default_ipmi_user: "{{default_ipmi_user}}"
+ current_cvm_vlan_tag: "{{nodes.current_cvm_vlan_tag}}"
+ nos_package: "{{images.aos_packages[0]}}"
+ blocks:
+ - block_id: "{{nodes.block_id}}"
+ nodes:
+ - manual_mode:
+ cvm_ip: "{{nodes.node1.cvm_ip}}"
+ cvm_gb_ram: 50
+ hypervisor_hostname: "{{nodes.node1.hypervisor_hostname}}"
+ ipmi_netmask: "{{nodes.node1.ipmi_netmask}}"
+ ipmi_gateway: "{{nodes.node1.ipmi_gateway}}"
+ ipmi_ip: "{{nodes.node1.ipmi_ip}}"
+ ipmi_password: "{{nodes.node1.ipmi_password}}"
+ hypervisor: "{{nodes.node1.hypervisor}}"
+ hypervisor_ip: "{{nodes.node1.hypervisor_ip}}"
+ node_position: "{{nodes.node1.node_position}}"
+ clusters:
+ - redundancy_factor: 1
+ cluster_members:
+ - "{{nodes.node1.cvm_ip}}"
+ name: "test-cluster"
+ timezone: "Asia/Calcutta"
+ cvm_ntp_servers:
+ - "{{nodes.ntp_servers[0]}}"
+ - "{{nodes.ntp_servers[1]}}"
+ cvm_dns_servers:
+ - "{{nodes.dns_servers[0]}}"
+ - "{{nodes.dns_servers[1]}}"
+ hypervisor_ntp_servers:
+ - "{{nodes.ntp_servers[0]}}"
+ - "{{nodes.ntp_servers[1]}}"
+ enable_ns: true
+ backplane_vlan: "{{nodes.backplane_vlan}}"
+ backplane_subnet: "{{nodes.backplane_subnet}}"
+ backplane_netmask: "{{nodes.backplane_netmask}}"
+ register: spec
+ ignore_errors: true
- - name: Create spec for imaging and creating cluster out of bare metal nodes
- check_mode: yes
- ntnx_foundation:
- timeout: 4500
- cvm_gateway: "{{cvm_gateway}}"
- cvm_netmask: "{{cvm_netmask}}"
- hypervisor_gateway: "{{hypervisor_gateway}}"
- hypervisor_netmask: "{{hypervisor_netmask}}"
- default_ipmi_user: "{{default_ipmi_user}}"
- current_cvm_vlan_tag: "{{nodes.current_cvm_vlan_tag}}"
- nos_package: "{{images.aos_packages[0]}}"
- blocks:
- - block_id: "{{nodes.block_id}}"
- nodes:
- - manual_mode:
- cvm_ip: "{{nodes.node1.cvm_ip}}"
- cvm_gb_ram: 50
- hypervisor_hostname: "{{nodes.node1.hypervisor_hostname}}"
- ipmi_netmask: "{{nodes.node1.ipmi_netmask}}"
- ipmi_gateway: "{{nodes.node1.ipmi_gateway}}"
- ipmi_ip: "{{nodes.node1.ipmi_ip}}"
- ipmi_password: "{{nodes.node1.ipmi_password}}"
- hypervisor: "{{nodes.node1.hypervisor}}"
- hypervisor_ip: "{{nodes.node1.hypervisor_ip}}"
- node_position: "{{nodes.node1.node_position}}"
- clusters:
- - redundancy_factor: 1
- cluster_members:
- - "{{nodes.node1.cvm_ip}}"
- name: "test-cluster"
- timezone: "Asia/Calcutta"
- cvm_ntp_servers:
- - "{{nodes.ntp_servers[0]}}"
- - "{{nodes.ntp_servers[1]}}"
- cvm_dns_servers:
- - "{{nodes.dns_servers[0]}}"
- - "{{nodes.dns_servers[1]}}"
- hypervisor_ntp_servers:
- - "{{nodes.ntp_servers[0]}}"
- - "{{nodes.ntp_servers[1]}}"
- enable_ns: true
- backplane_vlan: "{{nodes.backplane_vlan}}"
- backplane_subnet: "{{nodes.backplane_subnet}}"
- backplane_netmask: "{{nodes.backplane_netmask}}"
- register: spec
- ignore_errors: True
+- name: Set expected spec
+ ansible.builtin.set_fact:
+ expected_spec:
+ {
+ "blocks":
+ [
+ {
+ "block_id": "{{nodes.block_id}}",
+ "nodes":
+ [
+ {
+ "cvm_gb_ram": 50,
+ "cvm_ip": "{{nodes.node1.cvm_ip}}",
+ "hypervisor": "{{nodes.node1.hypervisor}}",
+ "hypervisor_hostname": "{{nodes.node1.hypervisor_hostname}}",
+ "hypervisor_ip": "{{nodes.node1.hypervisor_ip}}",
+ "image_now": true,
+ "ipmi_gateway": "{{nodes.node1.ipmi_gateway}}",
+ "ipmi_ip": "{{nodes.node1.ipmi_ip}}",
+ "ipmi_netmask": "{{nodes.node1.ipmi_netmask}}",
+ "ipmi_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
+ "node_position": "{{nodes.node1.node_position}}",
+ },
+ ],
+ },
+ ],
+ "clusters":
+ [
+ {
+ "backplane_netmask": "{{nodes.backplane_netmask}}",
+ "backplane_subnet": "{{nodes.backplane_subnet}}",
+ "backplane_vlan": "{{nodes.backplane_vlan}}",
+ "cluster_external_ip": null,
+ "cluster_init_now": true,
+ "cluster_members": ["{{nodes.node1.cvm_ip}}"],
+ "cluster_name": "test-cluster",
+ "cvm_dns_servers": "{{nodes.dns_servers[0]}},{{nodes.dns_servers[1]}}",
+ "cvm_ntp_servers": "{{nodes.ntp_servers[0]}},{{nodes.ntp_servers[1]}}",
+ "enable_ns": true,
+ "hypervisor_ntp_servers": "{{nodes.ntp_servers[0]}},{{nodes.ntp_servers[1]}}",
+ "redundancy_factor": 1,
+ "single_node_cluster": true,
+ "timezone": "Asia/Calcutta",
+ },
+ ],
+ "current_cvm_vlan_tag": "{{nodes.current_cvm_vlan_tag}}",
+ "cvm_gateway": "{{cvm_gateway}}",
+ "cvm_netmask": "{{cvm_netmask}}",
+ "hypervisor_gateway": "{{hypervisor_gateway}}",
+ "hypervisor_iso": {},
+ "hypervisor_netmask": "{{hypervisor_netmask}}",
+ "ipmi_user": "{{default_ipmi_user}}",
+ "nos_package": "{{images.aos_packages[0]}}",
+ }
- - set_fact:
- expected_spec: {
- "blocks": [
- {
- "block_id": "{{nodes.block_id}}",
- "nodes": [
- {
- "cvm_gb_ram": 50,
- "cvm_ip": "{{nodes.node1.cvm_ip}}",
- "hypervisor": "{{nodes.node1.hypervisor}}",
- "hypervisor_hostname": "{{nodes.node1.hypervisor_hostname}}",
- "hypervisor_ip": "{{nodes.node1.hypervisor_ip}}",
- "image_now": true,
- "ipmi_gateway": "{{nodes.node1.ipmi_gateway}}",
- "ipmi_ip": "{{nodes.node1.ipmi_ip}}",
- "ipmi_netmask": "{{nodes.node1.ipmi_netmask}}",
- "ipmi_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
- "node_position": "{{nodes.node1.node_position}}"
- }
- ]
- }
- ],
- "clusters": [
- {
- "backplane_netmask": "{{nodes.backplane_netmask}}",
- "backplane_subnet": "{{nodes.backplane_subnet}}",
- "backplane_vlan": "{{nodes.backplane_vlan}}",
- "cluster_external_ip": null,
- "cluster_init_now": true,
- "cluster_members": [
- "{{nodes.node1.cvm_ip}}"
- ],
- "cluster_name": "test-cluster",
- "cvm_dns_servers": "{{nodes.dns_servers[0]}},{{nodes.dns_servers[1]}}",
- "cvm_ntp_servers": "{{nodes.ntp_servers[0]}},{{nodes.ntp_servers[1]}}",
- "enable_ns": true,
- "hypervisor_ntp_servers": "{{nodes.ntp_servers[0]}},{{nodes.ntp_servers[1]}}",
- "redundancy_factor": 1,
- "single_node_cluster": true,
- "timezone": "Asia/Calcutta"
- }
- ],
- "current_cvm_vlan_tag": "{{nodes.current_cvm_vlan_tag}}",
- "cvm_gateway": "{{cvm_gateway}}",
- "cvm_netmask": "{{cvm_netmask}}",
- "hypervisor_gateway": "{{hypervisor_gateway}}",
- "hypervisor_iso": {},
- "hypervisor_netmask": "{{hypervisor_netmask}}",
- "ipmi_user": "{{default_ipmi_user}}",
- "nos_package": "{{images.aos_packages[0]}}"
- }
+- name: Verify spec
+ ansible.builtin.assert:
+ that:
+ - spec.response is defined
+ - spec.failed==false
+ - spec.changed==false
+ - spec.response == expected_spec
+ fail_msg: " Fail : unable to create spec for imaging nodes"
+ success_msg: "Succes: spec generated successfully"
- - name: Verify spec
- assert:
- that:
- - spec.response is defined
- - spec.failed==false
- - spec.changed==false
- - spec.response == expected_spec
- fail_msg: " Fail : unable to create spec for imaging nodes"
- success_msg: "Success: spec generated successfully"
+- name: Image nodes without cluster creation
+ ntnx_foundation:
+ timeout: 4500
+ cvm_gateway: "{{cvm_gateway}}"
+ cvm_netmask: "{{cvm_netmask}}"
+ hypervisor_gateway: "{{hypervisor_gateway}}"
+ hypervisor_netmask: "{{hypervisor_netmask}}"
+ default_ipmi_user: "{{default_ipmi_user}}"
+ current_cvm_vlan_tag: "{{nodes.current_cvm_vlan_tag}}"
+ nos_package: "{{images.aos_packages[0]}}"
+ blocks:
+ - block_id: "{{nodes.block_id}}"
+ nodes:
+ - manual_mode:
+ cvm_ip: "{{nodes.node1.cvm_ip}}"
+ cvm_gb_ram: 50
+ hypervisor_hostname: "{{nodes.node1.hypervisor_hostname}}"
+ ipmi_netmask: "{{nodes.node1.ipmi_netmask}}"
+ ipmi_gateway: "{{nodes.node1.ipmi_gateway}}"
+ ipmi_ip: "{{nodes.node1.ipmi_ip}}"
+ ipmi_password: "{{nodes.node1.ipmi_password}}"
+ hypervisor: "{{nodes.node1.hypervisor}}"
+ hypervisor_ip: "{{nodes.node1.hypervisor_ip}}"
+ node_position: "{{nodes.node1.node_position}}"
+ bond_lacp_rate: "{{nodes.node1.bond_lacp_rate}}"
+ bond_mode: "{{nodes.node1.bond_mode}}"
- - name: Image nodes without cluster creation
- ntnx_foundation:
- timeout: 4500
- cvm_gateway: "{{cvm_gateway}}"
- cvm_netmask: "{{cvm_netmask}}"
- hypervisor_gateway: "{{hypervisor_gateway}}"
- hypervisor_netmask: "{{hypervisor_netmask}}"
- default_ipmi_user: "{{default_ipmi_user}}"
- current_cvm_vlan_tag: "{{nodes.current_cvm_vlan_tag}}"
- nos_package: "{{images.aos_packages[0]}}"
- blocks:
- - block_id: "{{nodes.block_id}}"
- nodes:
- - manual_mode:
- cvm_ip: "{{nodes.node1.cvm_ip}}"
- cvm_gb_ram: 50
- hypervisor_hostname: "{{nodes.node1.hypervisor_hostname}}"
- ipmi_netmask: "{{nodes.node1.ipmi_netmask}}"
- ipmi_gateway: "{{nodes.node1.ipmi_gateway}}"
- ipmi_ip: "{{nodes.node1.ipmi_ip}}"
- ipmi_password: "{{nodes.node1.ipmi_password}}"
- hypervisor: "{{nodes.node1.hypervisor}}"
- hypervisor_ip: "{{nodes.node1.hypervisor_ip}}"
- node_position: "{{nodes.node1.node_position}}"
- bond_lacp_rate: "{{nodes.node1.bond_lacp_rate}}"
- bond_mode: "{{nodes.node1.bond_mode}}"
+ register: result
+ no_log: true
+ ignore_errors: true
- register: result
- no_log: true
- ignore_errors: True
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.failed==false
+ - result.changed==true
+ fail_msg: " Fail : unable to image nodes"
+ success_msg: "Succes: node imaging done successfully"
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.failed==false
- - result.changed==true
- fail_msg: " Fail : unable to image nodes"
- success_msg: "Success: node imaging done successfully"
-
- - name: Image nodes and create cluster out of it
- ntnx_foundation:
- timeout: 4500
- cvm_gateway: "{{cvm_gateway}}"
- cvm_netmask: "{{cvm_netmask}}"
- hypervisor_gateway: "{{hypervisor_gateway}}"
- hypervisor_netmask: "{{hypervisor_netmask}}"
- default_ipmi_user: "{{default_ipmi_user}}"
- current_cvm_vlan_tag: "{{nodes.current_cvm_vlan_tag}}"
- nos_package: "{{images.aos_packages[0]}}"
- blocks:
- - block_id: "{{nodes.block_id}}"
- nodes:
- - manual_mode:
- cvm_ip: "{{nodes.node1.cvm_ip}}"
- cvm_gb_ram: 50
- hypervisor_hostname: "{{nodes.node1.hypervisor_hostname}}"
- ipmi_netmask: "{{nodes.node1.ipmi_netmask}}"
- ipmi_gateway: "{{nodes.node1.ipmi_gateway}}"
- ipmi_ip: "{{nodes.node1.ipmi_ip}}"
- ipmi_password: "{{nodes.node1.ipmi_password}}"
- hypervisor: "{{nodes.node1.hypervisor}}"
- hypervisor_ip: "{{nodes.node1.hypervisor_ip}}"
- node_position: "{{nodes.node1.node_position}}"
- bond_lacp_rate: "{{nodes.node1.bond_lacp_rate}}"
- bond_mode: "{{nodes.node1.bond_mode}}"
- clusters:
- - redundancy_factor: 1
- cluster_members:
- - "{{nodes.node1.cvm_ip}}"
- name: "test-cluster"
- timezone: "Asia/Calcutta"
- cvm_ntp_servers:
- - "{{nodes.ntp_servers[0]}}"
- - "{{nodes.ntp_servers[1]}}"
- cvm_dns_servers:
- - "{{nodes.dns_servers[0]}}"
- - "{{nodes.dns_servers[1]}}"
- hypervisor_ntp_servers:
- - "{{nodes.ntp_servers[0]}}"
- - "{{nodes.ntp_servers[1]}}"
- register: result
- no_log: true
- ignore_errors: True
-
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.failed==false
- - result.changed==true
- - result.response.cluster_urls is defined
- fail_msg: " Fail : unable to image nodes and create cluster"
- success_msg: "Success: cluster and node imaging done successfully"
+- name: Image nodes and create cluster out of it
+ ntnx_foundation:
+ timeout: 4500
+ cvm_gateway: "{{cvm_gateway}}"
+ cvm_netmask: "{{cvm_netmask}}"
+ hypervisor_gateway: "{{hypervisor_gateway}}"
+ hypervisor_netmask: "{{hypervisor_netmask}}"
+ default_ipmi_user: "{{default_ipmi_user}}"
+ current_cvm_vlan_tag: "{{nodes.current_cvm_vlan_tag}}"
+ nos_package: "{{images.aos_packages[0]}}"
+ blocks:
+ - block_id: "{{nodes.block_id}}"
+ nodes:
+ - manual_mode:
+ cvm_ip: "{{nodes.node1.cvm_ip}}"
+ cvm_gb_ram: 50
+ hypervisor_hostname: "{{nodes.node1.hypervisor_hostname}}"
+ ipmi_netmask: "{{nodes.node1.ipmi_netmask}}"
+ ipmi_gateway: "{{nodes.node1.ipmi_gateway}}"
+ ipmi_ip: "{{nodes.node1.ipmi_ip}}"
+ ipmi_password: "{{nodes.node1.ipmi_password}}"
+ hypervisor: "{{nodes.node1.hypervisor}}"
+ hypervisor_ip: "{{nodes.node1.hypervisor_ip}}"
+ node_position: "{{nodes.node1.node_position}}"
+ bond_lacp_rate: "{{nodes.node1.bond_lacp_rate}}"
+ bond_mode: "{{nodes.node1.bond_mode}}"
+ clusters:
+ - redundancy_factor: 1
+ cluster_members:
+ - "{{nodes.node1.cvm_ip}}"
+ name: "test-cluster"
+ timezone: "Asia/Calcutta"
+ cvm_ntp_servers:
+ - "{{nodes.ntp_servers[0]}}"
+ - "{{nodes.ntp_servers[1]}}"
+ cvm_dns_servers:
+ - "{{nodes.dns_servers[0]}}"
+ - "{{nodes.dns_servers[1]}}"
+ hypervisor_ntp_servers:
+ - "{{nodes.ntp_servers[0]}}"
+ - "{{nodes.ntp_servers[1]}}"
+ register: result
+ no_log: true
+ ignore_errors: true
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.failed==false
+ - result.changed==true
+ - result.response.cluster_urls is defined
+ fail_msg: " Fail : unable to image nodes and create cluster"
+ success_msg: "Succes: cluster and node imaging done successfully"
######################################################
diff --git a/tests/integration/targets/ntnx_foundation_sanity/tasks/main.yml b/tests/integration/targets/ntnx_foundation_sanity/tasks/main.yml
index 24fc4e925..05ac7c8b1 100644
--- a/tests/integration/targets/ntnx_foundation_sanity/tasks/main.yml
+++ b/tests/integration/targets/ntnx_foundation_sanity/tasks/main.yml
@@ -1,6 +1,8 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ foundation_host }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ foundation_host }}"
block:
- - import_tasks: "image_nodes.yml"
+ - name: Import "image_nodes.yml"
+ ansible.builtin.import_tasks: "image_nodes.yml"
diff --git a/tests/integration/targets/ntnx_hosts_info/tasks/get_hosts_info.yml b/tests/integration/targets/ntnx_hosts_info/tasks/get_hosts_info.yml
index cb84471e2..c74cd7f18 100644
--- a/tests/integration/targets/ntnx_hosts_info/tasks/get_hosts_info.yml
+++ b/tests/integration/targets/ntnx_hosts_info/tasks/get_hosts_info.yml
@@ -1,14 +1,15 @@
---
-- debug:
+- name: Start testing ntnx_hosts_info
+ ansible.builtin.debug:
msg: Start testing ntnx_hosts_info
-- name: test getting all hosts
+- name: Test getting all hosts
ntnx_hosts_info:
register: hosts
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- hosts.response is defined
- hosts.failed == false
@@ -17,14 +18,13 @@
fail_msg: "Unable to list all hosts"
success_msg: "hosts listed successfully"
-
-- name: test getting particular host using uuid
+- name: Test getting particular host using uuid
ntnx_hosts_info:
- host_uuid: '{{ hosts.response.entities[0].metadata.uuid }}'
+ host_uuid: "{{ hosts.response.entities[0].metadata.uuid }}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -34,7 +34,6 @@
fail_msg: "Unable to get particular host"
success_msg: "host info obtained successfully"
-
- name: List hosts using length, offset, sort order and name sort attribute
ntnx_hosts_info:
length: 2
@@ -42,10 +41,10 @@
sort_order: "ASCENDING"
sort_attribute: "name"
register: result
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
diff --git a/tests/integration/targets/ntnx_hosts_info/tasks/main.yml b/tests/integration/targets/ntnx_hosts_info/tasks/main.yml
index fccc9eeda..ce6bfee90 100644
--- a/tests/integration/targets/ntnx_hosts_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_hosts_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "get_hosts_info.yml"
+ - name: Import "get_hosts_info.yml"
+ ansible.builtin.import_tasks: "get_hosts_info.yml"
diff --git a/tests/integration/targets/ntnx_image_placement_policies_info/tasks/info.yml b/tests/integration/targets/ntnx_image_placement_policies_info/tasks/info.yml
index 8515e38ae..0ad722076 100644
--- a/tests/integration/targets/ntnx_image_placement_policies_info/tasks/info.yml
+++ b/tests/integration/targets/ntnx_image_placement_policies_info/tasks/info.yml
@@ -1,8 +1,9 @@
---
-- debug:
+- name: Start testing ntnx_image_placement_policies_info
+ ansible.builtin.debug:
msg: "start ntnx_image_placement_policies_info tests"
-- name: create image placement policy
+- name: Create image placement policy
ntnx_image_placement_policy:
placement_type: soft
name: "test_policy_1"
@@ -14,7 +15,7 @@
- Default
register: policy_1
-- name: create image placement policy
+- name: Create image placement policy
ntnx_image_placement_policy:
placement_type: soft
name: "test_policy_2"
@@ -26,19 +27,21 @@
- Default
register: policy_2
-- set_fact:
+- name: Add policies to delete list
+ ansible.builtin.set_fact:
todelete: '{{ todelete + [ policy_1["response"]["metadata"]["uuid"] ] }}'
-- set_fact:
+- name: Add policies to delete list
+ ansible.builtin.set_fact:
todelete: '{{ todelete + [ policy_2["response"]["metadata"]["uuid"] ] }}'
###################################################################
-- name: test getting all image placement policies
+- name: Test getting all image placement policies
ntnx_image_placement_policies_info:
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -47,7 +50,7 @@
success_msg: "Image placement policies listed successfully"
################################################################
-- name: test getting particular image placement policy using filter
+- name: Test getting particular image placement policy using filter
ntnx_image_placement_policies_info:
filter:
name: "{{ policy_1.response.status.name }}"
@@ -55,8 +58,8 @@
offset: 0
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.entities[0].status.name == '{{ policy_1.response.status.name }}'
@@ -65,13 +68,13 @@
################################################################
-- name: test getting particular image placement policy using uuid
+- name: Test getting particular image placement policy using uuid
ntnx_image_placement_policies_info:
policy_uuid: "{{ policy_2.response.metadata.uuid }}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.name == '{{ policy_2.response.status.name }}'
@@ -87,21 +90,22 @@
register: result
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: "Unable to list policies as per names"
success_msg: "Image placement policy listed successfully"
-##################################################CLEANUP#######################################################
+################################################## CLEANUP #######################################################
-- name: cleanup created entities
+- name: Cleanup created entities
ntnx_image_placement_policy:
state: absent
policy_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_image_placement_policies_info/tasks/main.yml b/tests/integration/targets/ntnx_image_placement_policies_info/tasks/main.yml
index 3364b30c6..2063c49b4 100644
--- a/tests/integration/targets/ntnx_image_placement_policies_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_image_placement_policies_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "info.yml"
+ - name: Import "info.yml"
+ ansible.builtin.import_tasks: "info.yml"
diff --git a/tests/integration/targets/ntnx_image_placement_policy/tasks/create.yml b/tests/integration/targets/ntnx_image_placement_policy/tasks/create.yml
index 5489af62e..85b0a94f6 100644
--- a/tests/integration/targets/ntnx_image_placement_policy/tasks/create.yml
+++ b/tests/integration/targets/ntnx_image_placement_policy/tasks/create.yml
@@ -1,5 +1,6 @@
---
-- debug:
+- name: Start ntnx_image_placement_policy create tests
+ ansible.builtin.debug:
msg: start ntnx_image_placement_policy create tests
- name: Create image placement policy with minimal spec
@@ -15,7 +16,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -27,7 +28,8 @@
fail_msg: "Unable to create image placement policy with minimal spec"
success_msg: "Image placement policy with minimal spec created successfully"
-- set_fact:
+- name: Add policy to delete list
+ ansible.builtin.set_fact:
todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
################################################################################################################
@@ -52,7 +54,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -61,13 +63,14 @@
fail_msg: "Unable to create image placement policy with all specifications"
success_msg: "Image placement policy with all specifications created successfully"
-- set_fact:
+- name: Add policy to delete list
+ ansible.builtin.set_fact:
todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
################################################################################################################
- name: Create image placement policy in check mode
- check_mode: yes
+ check_mode: true
ntnx_image_placement_policy:
name: "test_policy_3"
desc: "test_policy_3_desc"
@@ -82,7 +85,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -105,7 +108,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -113,9 +116,9 @@
fail_msg: "Image placement policy didn't failed with incorrect category"
success_msg: "Image placement policy with incorrect category errored out successfully"
-##################################################CLEANUP#######################################################
+################################################## CLEANUP #######################################################
-- name: cleanup created entities
+- name: Cleanup created entities
ntnx_image_placement_policy:
state: absent
policy_uuid: "{{ item }}"
@@ -123,5 +126,6 @@
loop: "{{ todelete }}"
ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_image_placement_policy/tasks/delete.yml b/tests/integration/targets/ntnx_image_placement_policy/tasks/delete.yml
index 2d39baf74..8bbd8f20d 100644
--- a/tests/integration/targets/ntnx_image_placement_policy/tasks/delete.yml
+++ b/tests/integration/targets/ntnx_image_placement_policy/tasks/delete.yml
@@ -1,5 +1,6 @@
---
-- debug:
+- name: Start ntnx_image_placement_policy delete tests
+ ansible.builtin.debug:
msg: start ntnx_image_placement_policy delete tests
- name: Create image placement policy with minimal spec for delete tests
@@ -15,7 +16,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -30,7 +31,7 @@
register: result
- name: Delete Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -48,7 +49,7 @@
ignore_errors: true
- name: Delete Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
diff --git a/tests/integration/targets/ntnx_image_placement_policy/tasks/main.yml b/tests/integration/targets/ntnx_image_placement_policy/tasks/main.yml
index a2c7a07b0..4ccc4d16c 100644
--- a/tests/integration/targets/ntnx_image_placement_policy/tasks/main.yml
+++ b/tests/integration/targets/ntnx_image_placement_policy/tasks/main.yml
@@ -1,11 +1,15 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create.yml"
- - import_tasks: "update.yml"
- - import_tasks: "delete.yml"
+ - name: Import "create.yml"
+ ansible.builtin.import_tasks: "create.yml"
+ - name: Import "update.yml"
+ ansible.builtin.import_tasks: "update.yml"
+ - name: Import "delete.yml"
+ ansible.builtin.import_tasks: "delete.yml"
diff --git a/tests/integration/targets/ntnx_image_placement_policy/tasks/update.yml b/tests/integration/targets/ntnx_image_placement_policy/tasks/update.yml
index 3f0087324..6a05bf87d 100644
--- a/tests/integration/targets/ntnx_image_placement_policy/tasks/update.yml
+++ b/tests/integration/targets/ntnx_image_placement_policy/tasks/update.yml
@@ -1,5 +1,6 @@
---
-- debug:
+- name: Start ntnx_image_placement_policy update tests
+ ansible.builtin.debug:
msg: start ntnx_image_placement_policy update tests
- name: Create image placement policy with minimal spec for update tests
@@ -20,7 +21,7 @@
register: setup_policy
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- setup_policy.response is defined
- setup_policy.changed == true
@@ -28,12 +29,13 @@
fail_msg: "Unable to create image placement policy with minimal spec"
success_msg: "Image placement policy with minimal spec created successfully"
-- set_fact:
+- name: Add policy to delete list
+ ansible.builtin.set_fact:
todelete: '{{ todelete + [ setup_policy["response"]["metadata"]["uuid"] ] }}'
#############################################################################################
-- name: test idempotency by definig same spec as before
+- name: Test idempotency by definig same spec as before
ntnx_image_placement_policy:
state: present
policy_uuid: "{{ setup_policy.response.metadata.uuid }}"
@@ -52,7 +54,7 @@
register: result
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == false
- "'Nothing to change' in result.msg"
@@ -61,7 +63,7 @@
#####################################################################################################
-- name: update all specs
+- name: Update all specs
ntnx_image_placement_policy:
state: present
policy_uuid: "{{ setup_policy.response.metadata.uuid }}"
@@ -82,7 +84,7 @@
register: result
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -99,7 +101,7 @@
#####################################################################################################
-- name: remove attached categories to the policy
+- name: Remove attached categories to the policy
ntnx_image_placement_policy:
state: present
policy_uuid: "{{ setup_policy.response.metadata.uuid }}"
@@ -107,7 +109,7 @@
register: result
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -116,15 +118,16 @@
fail_msg: "Unable to remove categories from image placement policy"
success_msg: "Image placement policy updated successfully"
-##################################################CLEANUP#######################################################
+################################################## CLEANUP #######################################################
-- name: cleanup created entities
+- name: Cleanup created entities
ntnx_image_placement_policy:
state: absent
policy_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_images/tasks/create.yml b/tests/integration/targets/ntnx_images/tasks/create.yml
index 207f1bd8b..5707a1b4a 100644
--- a/tests/integration/targets/ntnx_images/tasks/create.yml
+++ b/tests/integration/targets/ntnx_images/tasks/create.yml
@@ -1,5 +1,6 @@
---
-- debug:
+- name: Start testing ntnx_images
+ ansible.builtin.debug:
msg: start ntnx_image create tests
- name: Create image with minimal spec and source uri
@@ -7,22 +8,23 @@
state: present
image_type: DISK_IMAGE
source_uri: "{{ disk_image.url }}"
- name: integration-test-image-with-uri
+ name: Integration-test-image-with-uri
wait: true
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- result.response.status.resources.image_type == "DISK_IMAGE"
- - result.response.status.name == 'integration-test-image-with-uri'
+ - result.response.status.name == 'Integration-test-image-with-uri'
- result.response.status.resources.source_uri == "{{ disk_image.url }}"
fail_msg: "Unable to create image using source_uri"
success_msg: "Image with given source_uri created successfully"
-- set_fact:
+- name: Add image to delete list
+ ansible.builtin.set_fact:
todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
##################################################################################
@@ -30,7 +32,7 @@
- name: Create image with all spec and using local image upload
ntnx_images:
state: present
- name: integration-test-image-with-upload
+ name: Integration-test-image-with-upload
desc: "uploaded image during integration test"
source_path: "{{ disk_image.dest }}"
image_type: "DISK_IMAGE"
@@ -51,7 +53,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -65,16 +67,17 @@
fail_msg: "Unable to create image and upload local image with all specification"
success_msg: "Image with given local path created successfully"
-- set_fact:
+- name: Add image to delete list
+ ansible.builtin.set_fact:
todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
###############################################################################################
- name: Verify check mode for ntnx_image
- check_mode: yes
+ check_mode: true
ntnx_images:
state: present
- name: integration-test-image
+ name: Integration-test-image
desc: "uploaded image during integration test"
source_uri: "{{ disk_image.url }}"
image_type: "DISK_IMAGE"
@@ -95,13 +98,13 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
- result.failed == false
- result.response.metadata is defined
- - result.response.spec.name == 'integration-test-image'
+ - result.response.spec.name == 'Integration-test-image'
- result.response.spec.resources.source_uri == "{{ disk_image.url }}"
- result.response.metadata.categories_mapping['AppType'] == ['Default']
- result.response.metadata.categories_mapping['Environment'] == ['Dev']
@@ -119,13 +122,13 @@
state: present
source_uri: "www.google.com"
image_type: "DISK_IMAGE"
- name: integration-test-image-with-uri
+ name: Integration-test-image-with-uri
wait: true
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == True
@@ -135,13 +138,14 @@
fail_msg: "Image create didn't failed for invalid source uri"
###################################################################################################
-- name: cleanup created entities
+- name: Cleanup created entities
ntnx_images:
state: absent
image_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_images/tasks/delete.yml b/tests/integration/targets/ntnx_images/tasks/delete.yml
index 3c91138e4..bcb7b8ca5 100644
--- a/tests/integration/targets/ntnx_images/tasks/delete.yml
+++ b/tests/integration/targets/ntnx_images/tasks/delete.yml
@@ -1,5 +1,6 @@
---
-- debug:
+- name: Start testing ntnx_images delete
+ ansible.builtin.debug:
msg: start ntnx_image delete tests
- name: Create image with minimal spec and source uri for delete tests
@@ -7,12 +8,12 @@
state: present
image_type: DISK_IMAGE
source_uri: "{{ disk_image.url }}"
- name: integration-test-image-with-uri
+ name: Integration-test-image-with-uri
wait: true
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -27,7 +28,7 @@
register: result
- name: Delete Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -42,10 +43,10 @@
state: absent
image_uuid: abcd
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == True
diff --git a/tests/integration/targets/ntnx_images/tasks/main.yml b/tests/integration/targets/ntnx_images/tasks/main.yml
index a2c7a07b0..4ccc4d16c 100644
--- a/tests/integration/targets/ntnx_images/tasks/main.yml
+++ b/tests/integration/targets/ntnx_images/tasks/main.yml
@@ -1,11 +1,15 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create.yml"
- - import_tasks: "update.yml"
- - import_tasks: "delete.yml"
+ - name: Import "create.yml"
+ ansible.builtin.import_tasks: "create.yml"
+ - name: Import "update.yml"
+ ansible.builtin.import_tasks: "update.yml"
+ - name: Import "delete.yml"
+ ansible.builtin.import_tasks: "delete.yml"
diff --git a/tests/integration/targets/ntnx_images/tasks/update.yml b/tests/integration/targets/ntnx_images/tasks/update.yml
index 80f4353d3..a0772d339 100644
--- a/tests/integration/targets/ntnx_images/tasks/update.yml
+++ b/tests/integration/targets/ntnx_images/tasks/update.yml
@@ -1,11 +1,12 @@
---
-- debug:
- msg: start ntnx_image create tests
+- name: Start testing ntnx_images update
+ ansible.builtin.debug:
+ msg: Start testing ntnx_images update
- name: Create image for update tests
ntnx_images:
state: present
- name: integration-test-image-update
+ name: Integration-test-image-update
desc: "image for integration"
source_uri: "{{ disk_image.url }}"
image_type: "DISK_IMAGE"
@@ -27,23 +28,24 @@
register: setup_image
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- setup_image.response is defined
- setup_image.response.status.state == 'COMPLETE'
fail_msg: "Unable to create image using source_uri for update tests"
success_msg: "Image with given source_uri created successfully for update tests"
-- set_fact:
+- name: Add image to delete list
+ ansible.builtin.set_fact:
todelete: '{{ todelete + [ setup_image["response"]["metadata"]["uuid"] ] }}'
############################################# UPDATE TESTS ########################################
-- name: check idempotency
+- name: Check idempotency
ntnx_images:
state: present
image_uuid: "{{ setup_image.image_uuid }}"
- name: integration-test-image-update
+ name: Integration-test-image-update
desc: "image for integration"
categories:
Environment:
@@ -53,8 +55,8 @@
image_type: "DISK_IMAGE"
register: result
-- name: check idempotency status
- assert:
+- name: Check idempotency status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -68,7 +70,7 @@
ntnx_images:
state: present
image_uuid: "{{ setup_image.image_uuid }}"
- name: integration-test-image-after-update
+ name: Integration-test-image-after-update
desc: "description after update"
categories:
Environment:
@@ -79,11 +81,11 @@
register: result
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- - result.response.status.name == 'integration-test-image-after-update'
+ - result.response.status.name == 'Integration-test-image-after-update'
- result.response.status.description == 'description after update'
- result.response.status.resources.image_type == 'ISO_IMAGE'
- result.response.metadata.categories_mapping['Environment'] == ['Production']
@@ -94,16 +96,15 @@
########################################################################################
# Commenting out as removing all categories from Images is broken
-# - name: test removal of all categories from image
+# - name: Test removal of all categories from image
# ntnx_images:
# state: present
# image_uuid: "{{ setup_image.image_uuid }}"
# remove_categories: true
# register: result
-
# - name: Update Status
-# assert:
+# ansible.builtin.assert:
# that:
# - result.response is defined
# - result.response.status.state == 'COMPLETE'
@@ -113,13 +114,14 @@
########################################### Cleanup ###################################################
-- name: cleanup created entities
+- name: Cleanup created entities
ntnx_images:
state: absent
image_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_images_info/tasks/info.yml b/tests/integration/targets/ntnx_images_info/tasks/info.yml
index 382319a75..b83761b50 100644
--- a/tests/integration/targets/ntnx_images_info/tasks/info.yml
+++ b/tests/integration/targets/ntnx_images_info/tasks/info.yml
@@ -1,27 +1,28 @@
---
-- debug:
+- name: Start testing ntnx_images_info
+ ansible.builtin.debug:
msg: "start ntnx_images_info tests"
-- name: test getting all images
+- name: Test getting all images
ntnx_images_info:
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: "Unable to list all images"
success_msg: "Images listed successfully"
################################################################
-- name: test getting particular image using filter
+- name: Test getting particular image using filter
ntnx_images_info:
filter:
name: "{{ disk_image.centos }}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.entities[0].status.name == '{{ disk_image.centos }}'
@@ -30,19 +31,19 @@
################################################################
-- name: getting image info for test
+- name: Getting image info for test
ntnx_images_info:
filter:
name: "{{ disk_image.centos }}"
register: result
-- name: test getting particular image using uuid
+- name: Test getting particular image using uuid
ntnx_images_info:
- image_uuid: '{{ result.response.entities[0].metadata.uuid }}'
+ image_uuid: "{{ result.response.entities[0].metadata.uuid }}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.name == '{{ disk_image.centos }}'
diff --git a/tests/integration/targets/ntnx_images_info/tasks/main.yml b/tests/integration/targets/ntnx_images_info/tasks/main.yml
index 3364b30c6..2063c49b4 100644
--- a/tests/integration/targets/ntnx_images_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_images_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "info.yml"
+ - name: Import "info.yml"
+ ansible.builtin.import_tasks: "info.yml"
diff --git a/tests/integration/targets/ntnx_karbon_clusters_and_info/tasks/crud.yml b/tests/integration/targets/ntnx_karbon_clusters_and_info/tasks/crud.yml
index 5afafa993..94d7aecec 100644
--- a/tests/integration/targets/ntnx_karbon_clusters_and_info/tasks/crud.yml
+++ b/tests/integration/targets/ntnx_karbon_clusters_and_info/tasks/crud.yml
@@ -1,12 +1,14 @@
---
-- debug:
+- name: Start testing ntnx_karbon_clusters and ntnx_karbon_clusters_info
+ ansible.builtin.debug:
msg: Start testing ntnx_karbon_clusters and ntnx_karbon_clusters_info
-- set_fact:
- karbon_name: "test-module21"
+- name: Set karbon name
+ ansible.builtin.set_fact:
+ karbon_name: "test-module21"
#############################
-- name: Verify check mode for PROD karbon cluster
+- name: Verify check mode for PROD karbon cluster
ntnx_karbon_clusters:
cluster:
uuid: "{{cluster.uuid}}"
@@ -17,19 +19,19 @@
name: "{{network.dhcp.name}}"
cluster_type: PROD
cni:
- node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
+ node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
service_ipv4_cidr: "{{cni.service_ipv4_cidr}}"
pod_ipv4_cidr: "{{cni.pod_ipv4_cidr}}"
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
+ default_storage_class: true
+ name: Test-storage-class
reclaim_policy: Delete
storage_container: "{{storage_container.name}}"
file_system: ext4
- flash_mode: False
+ flash_mode: false
control_plane_virtual_ip: 10.101.0.1
custom_node_configs:
etcd:
@@ -52,7 +54,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -65,7 +67,7 @@
fail_msg: "Check mode for PROD cluster failed"
#############################
-- name: Verify check mode for ntnx_karbon_clusters
+- name: Verify check mode for ntnx_karbon_clusters
ntnx_karbon_clusters:
cluster:
uuid: "{{cluster.uuid}}"
@@ -76,25 +78,25 @@
name: "{{network.dhcp.name}}"
cluster_type: DEV
cni:
- node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
+ node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
service_ipv4_cidr: "{{cni.service_ipv4_cidr}}"
pod_ipv4_cidr: "{{cni.pod_ipv4_cidr}}"
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
+ default_storage_class: true
+ name: Test-storage-class
reclaim_policy: Delete
storage_container: "{{storage_container.name}}"
file_system: ext4
- flash_mode: False
+ flash_mode: false
register: result
check_mode: true
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -106,7 +108,7 @@
success_msg: "Success: check mode spec returned as expected"
fail_msg: "Check mode for ntnx_karbon_clusters failed"
############################
-- name: create DEV cluster with Flannel network provider
+- name: Create DEV cluster with Flannel network provider
ntnx_karbon_clusters:
cluster:
uuid: "{{cluster.uuid}}"
@@ -117,24 +119,24 @@
name: "{{network.dhcp.name}}"
cluster_type: DEV
cni:
- node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
+ node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
service_ipv4_cidr: "{{cni.service_ipv4_cidr}}"
pod_ipv4_cidr: "{{cni.pod_ipv4_cidr}}"
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
+ default_storage_class: true
+ name: Test-storage-class
reclaim_policy: Delete
storage_container: "{{storage_container.name}}"
file_system: ext4
- flash_mode: False
+ flash_mode: false
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -147,7 +149,7 @@
fail_msg: " Fail: unable to create DEV cluster with Flannel network provider"
success_msg: " Pass: create DEV cluster with Flannel network provider successfully "
#############################
-- name: delete dev cluster with Flannel network provider
+- name: Delete dev cluster with Flannel network provider
ntnx_karbon_clusters:
state: absent
name: "{{result.response.name}}"
@@ -155,7 +157,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -164,7 +166,7 @@
fail_msg: " Fail: unable to delete dev cluster with Flannel network provider"
success_msg: " Pass: delete dev cluster with Flannel network provider finished successfully"
#############################
-- name: create DEV cluster with Calico network provider
+- name: Create DEV cluster with Calico network provider
ntnx_karbon_clusters:
cluster:
name: "{{cluster.name}}"
@@ -174,7 +176,7 @@
node_subnet:
uuid: "{{network.dhcp.uuid}}"
cni:
- node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
+ node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
service_ipv4_cidr: "{{cni.service_ipv4_cidr}}"
pod_ipv4_cidr: "{{cni.pod_ipv4_cidr}}"
network_provider: Calico
@@ -197,8 +199,8 @@
storage_class:
nutanix_cluster_password: "{{nutanix_cluster_password}}"
nutanix_cluster_username: "{{nutanix_cluster_username}}"
- default_storage_class: True
- name: test-storage-class
+ default_storage_class: true
+ name: Test-storage-class
reclaim_policy: Retain
storage_container: "{{storage_container.name}}"
file_system: xfs
@@ -207,7 +209,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- karbon_cluster.response is defined
- karbon_cluster.changed == true
@@ -222,14 +224,14 @@
success_msg: " Pass: create DEV cluster with Calico network provider finished successfully"
#############################
-- name: test getting dev cluster using name
+- name: Test getting dev cluster using name
ntnx_karbon_clusters_info:
cluster_name: "{{karbon_cluster.response.name}}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -239,7 +241,7 @@
success_msg: " Pass: Cluster info obtained successfully "
####################################################
-- name: test getting cluster with ssh config using cluster name
+- name: Test getting cluster with ssh config using cluster name
ntnx_karbon_clusters_info:
cluster_name: "{{karbon_cluster.response.name}}"
fetch_ssh_credentials: true
@@ -247,7 +249,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -256,7 +258,7 @@
fail_msg: " Fail: Unable to get particular Cluster and it's ssh config "
success_msg: " Pass: Cluster info obtained successfully with it's ssh config "
####################################################
-- name: test getting cluster with kubeconfig config using cluster name
+- name: Test getting cluster with kubeconfig config using cluster name
ntnx_karbon_clusters_info:
cluster_name: "{{karbon_cluster.response.name}}"
fetch_kubeconfig: true
@@ -264,7 +266,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -274,26 +276,29 @@
success_msg: " Pass: Cluster info obtained successfully with it's kube config "
#############################
- name: Generate random node_pool name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=9,upper = false)[0]}}"
-- set_fact:
+- name: Set suffix name
+ ansible.builtin.set_fact:
suffix_name: "ansible"
-- set_fact:
- node1_name: "{{random_name}}{{suffix_name}}1"
- node2_name: "{{random_name}}{{suffix_name}}2"
- node3_name: "{{random_name}}{{suffix_name}}3"
+- name: Set node pool names
+ ansible.builtin.set_fact:
+ node1_name: "{{random_name}}{{suffix_name}}1"
+ node2_name: "{{random_name}}{{suffix_name}}2"
+ node3_name: "{{random_name}}{{suffix_name}}3"
-- debug:
+- name: Start testing ntnx_karbon_clusters_node_pools
+ ansible.builtin.debug:
msg: Start testing ntnx_karbon_clusters_node_pools
- name: Create node pool with subnet uuid
ntnx_karbon_clusters_node_pools:
node_subnet:
uuid: "{{network.dhcp.uuid}}"
- node_pool_name: "{{node1_name}}"
- cluster_name: "{{karbon_name}}"
+ node_pool_name: "{{node1_name}}"
+ cluster_name: "{{karbon_name}}"
pool_config:
num_instances: 2
cpu: 4
@@ -303,7 +308,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == true
- result.failed == false
@@ -314,10 +319,10 @@
fail_msg: "Fail: Unable to Create node pool "
success_msg: "Passed: Create node pool finished successfully "
#################################
-- name: try to update node pool config with same values
+- name: Try to update node pool config with same values
ntnx_karbon_clusters_node_pools:
- node_pool_name: "{{node1_name}}"
- cluster_name: "{{karbon_name}}"
+ node_pool_name: "{{node1_name}}"
+ cluster_name: "{{karbon_name}}"
pool_config:
num_instances: 2
cpu: 4
@@ -327,7 +332,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -335,10 +340,10 @@
fail_msg: "Fail: idempotecy check fail "
success_msg: "Passed: Returned as expected "
#################################
-- name: try to update node pool config with wrong labels
+- name: Try to update node pool config with wrong labels
ntnx_karbon_clusters_node_pools:
- node_pool_name: "{{node1_name}}"
- cluster_name: "{{karbon_name}}"
+ node_pool_name: "{{node1_name}}"
+ cluster_name: "{{karbon_name}}"
pool_config:
num_instances: 2
cpu: 4
@@ -352,23 +357,23 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == true
fail_msg: "Fail: node pool updated with wrong labels "
success_msg: "Passed: Returned as expected "
#################################
-- name: update pool by increasing cpu,memory_gb,num_instances and try to add wrong labels
+- name: Update pool by increasing cpu,memory_gb,num_instances and try to add wrong labels
ntnx_karbon_clusters_node_pools:
- wait: True
- node_pool_name: "{{node1_name}}"
- cluster_name: "{{karbon_name}}"
+ wait: true
+ node_pool_name: "{{node1_name}}"
+ cluster_name: "{{karbon_name}}"
pool_config:
- cpu: 6
- memory_gb: 10 # for etcd min 8
- disk_gb: 150
- num_instances: 4
+ cpu: 6
+ memory_gb: 10 # for etcd min 8
+ disk_gb: 150
+ num_instances: 4
add_labels:
property1: "test-property1"
property2: "test-property2"
@@ -378,7 +383,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == true
- result.failed == false
@@ -390,11 +395,11 @@
fail_msg: "Fail: Unable to update pool by increasing cpu,memory_gb,num_instances and try to add wrong labels "
success_msg: "Passed: update pool by increasing cpu,memory_gb,num_instances and try to add wrong labels finished successfully "
# #################################
-- name: update pool by add labels
+- name: Update pool by add labels
ntnx_karbon_clusters_node_pools:
- wait: True
- node_pool_name: "{{node1_name}}"
- cluster_name: "{{karbon_name}}"
+ wait: true
+ node_pool_name: "{{node1_name}}"
+ cluster_name: "{{karbon_name}}"
add_labels:
property1: "test-property1"
property2: "test-property2"
@@ -403,7 +408,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == true
- result.failed == false
@@ -414,16 +419,16 @@
fail_msg: "Fail: Unable to update pool by add labels "
success_msg: "Passed: update pool by add labels finished successfully "
#################################
-- name: update pool by decreasing cpu,memory_gb,num_instances and add remove labels
+- name: Update pool by decreasing cpu,memory_gb,num_instances and add remove labels
ntnx_karbon_clusters_node_pools:
- wait: True
- node_pool_name: "{{node1_name}}"
- cluster_name: "{{karbon_name}}"
+ wait: true
+ node_pool_name: "{{node1_name}}"
+ cluster_name: "{{karbon_name}}"
pool_config:
- cpu: 5
- memory_gb: 9 # for etcd min 8
- disk_gb: 140
- num_instances: 3
+ cpu: 5
+ memory_gb: 9 # for etcd min 8
+ disk_gb: 140
+ num_instances: 3
remove_labels:
- property2
- property3
@@ -431,7 +436,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == true
- result.failed == false
@@ -442,16 +447,16 @@
fail_msg: "Fail: Unable to update pool by decreasing cpu,memory_gb,num_instances and add remove labels "
success_msg: "Passed: update pool by decreasing cpu,memory_gb,num_instances and add remove labels finished successfully "
################################
-- name: delete pool
+- name: Delete pool
ntnx_karbon_clusters_node_pools:
state: absent
- node_pool_name: "{{node1_name}}"
- cluster_name: "{{karbon_name}}"
+ node_pool_name: "{{node1_name}}"
+ cluster_name: "{{karbon_name}}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'SUCCEEDED'
@@ -465,13 +470,13 @@
ntnx_karbon_clusters_node_pools:
node_subnet:
name: "{{network.dhcp.name}}"
- node_pool_name: "{{node2_name}}"
- cluster_name: "{{karbon_name}}"
+ node_pool_name: "{{node2_name}}"
+ cluster_name: "{{karbon_name}}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == true
- result.failed == false
@@ -482,16 +487,16 @@
fail_msg: "Fail: Unable to Create node pool with subnet name with default values "
success_msg: "Passed: Create node pool with subnet name with default values finished successfully "
#################################
-- name: delete pool
+- name: Delete pool
ntnx_karbon_clusters_node_pools:
state: absent
- node_pool_name: "{{node2_name}}"
- cluster_name: "{{karbon_name}}"
+ node_pool_name: "{{node2_name}}"
+ cluster_name: "{{karbon_name}}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'SUCCEEDED'
@@ -500,7 +505,7 @@
fail_msg: " Unable to delete node pool "
success_msg: " node pool has been deleted successfully "
#################################
-- name: delete dev cluster
+- name: Delete dev cluster
ntnx_karbon_clusters:
state: absent
name: "{{karbon_cluster.response.name}}"
@@ -508,7 +513,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
diff --git a/tests/integration/targets/ntnx_karbon_clusters_and_info/tasks/main.yml b/tests/integration/targets/ntnx_karbon_clusters_and_info/tasks/main.yml
index f7d047c91..499e6177d 100644
--- a/tests/integration/targets/ntnx_karbon_clusters_and_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_karbon_clusters_and_info/tasks/main.yml
@@ -1,10 +1,13 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "crud.yml"
- - import_tasks: "negative_scenarios.yml"
+ - name: Import "crud.yml"
+ ansible.builtin.import_tasks: "crud.yml"
+ - name: Import "negative_scenarios.yml"
+ ansible.builtin.import_tasks: "negative_scenarios.yml"
diff --git a/tests/integration/targets/ntnx_karbon_clusters_and_info/tasks/negative_scenarios.yml b/tests/integration/targets/ntnx_karbon_clusters_and_info/tasks/negative_scenarios.yml
index f0c9477e0..58a2d517c 100644
--- a/tests/integration/targets/ntnx_karbon_clusters_and_info/tasks/negative_scenarios.yml
+++ b/tests/integration/targets/ntnx_karbon_clusters_and_info/tasks/negative_scenarios.yml
@@ -1,12 +1,14 @@
---
-- debug:
- msg: Start negative test cases for ntnx_karbon_clusters
+- name: Start negative test cases for ntnx_karbon_clusters
+ ansible.builtin.debug:
+ msg: Start negative test cases for ntnx_karbon_clusters
-- set_fact:
+- name: Set Karbon name
+ ansible.builtin.set_fact:
karbon_name: "test-module22"
#############################
-- name: create cluster with cpu less than minimum
+- name: Create cluster with cpu less than minimum
ntnx_karbon_clusters:
cluster:
name: "{{cluster.name}}"
@@ -29,8 +31,8 @@
storage_class:
nutanix_cluster_password: "{{nutanix_cluster_password}}"
nutanix_cluster_username: "{{nutanix_cluster_username}}"
- default_storage_class: True
- name: test-storage-class
+ default_storage_class: true
+ name: Test-storage-class
reclaim_policy: Retain
storage_container: "{{storage_container.name}}"
file_system: xfs
@@ -39,7 +41,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response == {}
- result.changed == false
@@ -49,7 +51,7 @@
fail_msg: " Fail: cluster created with cpu less than minimum"
success_msg: " Pass: Returned as expected"
#############################
-- name: create cluster with memory_gb less than minimum
+- name: Create cluster with memory_gb less than minimum
ntnx_karbon_clusters:
cluster:
name: "{{cluster.name}}"
@@ -72,8 +74,8 @@
storage_class:
nutanix_cluster_password: "{{nutanix_cluster_password}}"
nutanix_cluster_username: "{{nutanix_cluster_username}}"
- default_storage_class: True
- name: test-storage-class
+ default_storage_class: true
+ name: Test-storage-class
reclaim_policy: Retain
storage_container: "{{storage_container.name}}"
file_system: xfs
@@ -82,7 +84,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response == {}
- result.changed == false
@@ -92,7 +94,7 @@
fail_msg: " Fail: cluster created with memory_gb size less than minimum"
success_msg: " Pass: Returned as expected"
#############################
-- name: create cluster with wrong num_instances for master nodes
+- name: Create cluster with wrong num_instances for master nodes
ntnx_karbon_clusters:
cluster:
name: "{{cluster.name}}"
@@ -115,8 +117,8 @@
storage_class:
nutanix_cluster_password: "{{nutanix_cluster_password}}"
nutanix_cluster_username: "{{nutanix_cluster_username}}"
- default_storage_class: True
- name: test-storage-class
+ default_storage_class: true
+ name: Test-storage-class
reclaim_policy: Retain
storage_container: "{{storage_container.name}}"
file_system: xfs
@@ -125,7 +127,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response == {}
- result.changed == false
@@ -135,7 +137,7 @@
fail_msg: " Fail: cluster created with wrong num_instances for master nodes"
success_msg: " Pass: Returned as expected"
#############################
-- name: create cluster with wrong num_instances for etcd nodes
+- name: Create cluster with wrong num_instances for etcd nodes
ntnx_karbon_clusters:
cluster:
name: "{{cluster.name}}"
@@ -158,8 +160,8 @@
storage_class:
nutanix_cluster_password: "{{nutanix_cluster_password}}"
nutanix_cluster_username: "{{nutanix_cluster_username}}"
- default_storage_class: True
- name: test-storage-class
+ default_storage_class: true
+ name: Test-storage-class
reclaim_policy: Retain
storage_container: "{{storage_container.name}}"
file_system: xfs
@@ -168,7 +170,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response == {}
- result.changed == false
diff --git a/tests/integration/targets/ntnx_karbon_registries/tasks/create.yml b/tests/integration/targets/ntnx_karbon_registries/tasks/create.yml
index d0d3afc6e..d2a4b3612 100644
--- a/tests/integration/targets/ntnx_karbon_registries/tasks/create.yml
+++ b/tests/integration/targets/ntnx_karbon_registries/tasks/create.yml
@@ -1,45 +1,45 @@
---
-
-- debug:
+- name: Start testing ntnx_karbon_registries
+ ansible.builtin.debug:
msg: "start ntnx_karbon_registries tests"
- name: Generate random registry_name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- set_fact:
+- name: Set registry name
+ ansible.builtin.set_fact:
registry_name: "{{random_name[0]}}"
-
-- name: create registry with check_mode
+- name: Create registry with check_mode
ntnx_karbon_registries:
name: "{{registry_name}}"
url: "{{url}}"
register: result
- ignore_errors: True
+ ignore_errors: true
check_mode: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
- result.changed == false
- result.response.name == "{{registry_name}}"
- result.response.url == "{{url}}"
- success_msg: ' Success: returned response as expected '
- fail_msg: ' Fail: create registry with check_mode '
+ success_msg: " Success: returned response as expected "
+ fail_msg: " Fail: create registry with check_mode "
################################################################
-- name: create registry
+- name: Create registry
ntnx_karbon_registries:
name: "{{registry_name}}"
url: "{{url}}"
port: 5000
register: result
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -49,15 +49,15 @@
fail_msg: "Fail: Unable to create registry"
success_msg: "Pass: create registry finished successfully"
################################################################
-- name: delete registry
+- name: Delete registry
ntnx_karbon_registries:
name: "{{registry_name}}"
state: absent
register: result
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -68,17 +68,17 @@
################################################################
-- name: create registry with username and password
+- name: Create registry with username and password
ntnx_karbon_registries:
name: "{{registry_name}}"
url: "{{url}}"
- username: test
+ username: Test
password: test
register: result
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -87,15 +87,15 @@
fail_msg: "Fail: unable to create registry with username and password"
success_msg: "Pass: create registry with username and password finished successfully"
###############################################################
-- name: delete registry
+- name: Delete registry
ntnx_karbon_registries:
name: "{{registry_name}}"
state: absent
register: result
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
diff --git a/tests/integration/targets/ntnx_karbon_registries/tasks/main.yml b/tests/integration/targets/ntnx_karbon_registries/tasks/main.yml
index 709409a78..42953a946 100644
--- a/tests/integration/targets/ntnx_karbon_registries/tasks/main.yml
+++ b/tests/integration/targets/ntnx_karbon_registries/tasks/main.yml
@@ -1,10 +1,13 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create.yml"
- - import_tasks: "negativ_scenarios.yml"
+ - name: Import "create.yml"
+ ansible.builtin.import_tasks: "create.yml"
+ - name: Import "negative_scenarios.yml"
+ ansible.builtin.import_tasks: "negative_scenarios.yml"
diff --git a/tests/integration/targets/ntnx_karbon_registries/tasks/negativ_scenarios.yml b/tests/integration/targets/ntnx_karbon_registries/tasks/negative_scenarios.yml
old mode 100644
new mode 100755
similarity index 62%
rename from tests/integration/targets/ntnx_karbon_registries/tasks/negativ_scenarios.yml
rename to tests/integration/targets/ntnx_karbon_registries/tasks/negative_scenarios.yml
index 705149710..ae513fc6e
--- a/tests/integration/targets/ntnx_karbon_registries/tasks/negativ_scenarios.yml
+++ b/tests/integration/targets/ntnx_karbon_registries/tasks/negative_scenarios.yml
@@ -1,17 +1,18 @@
---
-- debug:
+- name: Start negative test cases for ntnx_karbon_registries
+ ansible.builtin.debug:
msg: Start negative test cases for ntnx_karbon_registries
-- name: create registry with wrong port number
+- name: Create registry with wrong port number
ntnx_karbon_registries:
- name: test_regitry
+ name: Test regitry
url: "{{url}}"
port: 501
register: result
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == true
diff --git a/tests/integration/targets/ntnx_karbon_registries_info/tasks/info.yml b/tests/integration/targets/ntnx_karbon_registries_info/tasks/info.yml
index 810e82abb..7be2fd1bb 100644
--- a/tests/integration/targets/ntnx_karbon_registries_info/tasks/info.yml
+++ b/tests/integration/targets/ntnx_karbon_registries_info/tasks/info.yml
@@ -1,23 +1,25 @@
---
-- debug:
+- name: Start testing ntnx_karbon_registries_info
+ ansible.builtin.debug:
msg: "start ntnx_karbon_registries_info tests"
- name: Generate random registry_name
- set_fact:
+ ansible.builtin.set_fact:
random_name1: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
random_name2: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- set_fact:
+- name: Set registry name
+ ansible.builtin.set_fact:
registry_name1: "{{random_name1[0]}}"
registry_name2: "{{random_name2[0]}}"
-- name: create registries for tests
+- name: Create registries for tests
ntnx_karbon_registries:
name: "{{registry_name1}}"
url: "{{url}}"
register: r1
-- name: create registries for tests
+- name: Create registries for tests
ntnx_karbon_registries:
name: "{{registry_name2}}"
url: "{{url}}"
@@ -25,12 +27,12 @@
################################################################
-- name: test getting all registries
+- name: Test getting all registries
ntnx_karbon_registries_info:
register: registries
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- registries.response is defined
- registries.response | length > 0
@@ -39,13 +41,13 @@
fail_msg: "Unable to list all registries"
success_msg: "registries listed successfully"
################################################################
-- name: test getting particular register using name
+- name: Test getting particular register using name
ntnx_karbon_registries_info:
- registry_name: "{{ registries.response[1].name }}"
+ registry_name: "{{ registries.response[1].name }}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.uuid == "{{ registries.response[1].uuid }}"
@@ -56,16 +58,16 @@
################################################################
-- name: delete registry entry
+- name: Delete registry entry
ntnx_karbon_registries:
name: "{{registry_name1}}"
state: absent
register: result
- ignore_errors: True
+ ignore_errors: true
-- name: delete registry
+- name: Delete registry
ntnx_karbon_registries:
name: "{{registry_name2}}"
state: absent
register: result
- ignore_errors: True
+ ignore_errors: true
diff --git a/tests/integration/targets/ntnx_karbon_registries_info/tasks/main.yml b/tests/integration/targets/ntnx_karbon_registries_info/tasks/main.yml
index 3364b30c6..2063c49b4 100644
--- a/tests/integration/targets/ntnx_karbon_registries_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_karbon_registries_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "info.yml"
+ - name: Import "info.yml"
+ ansible.builtin.import_tasks: "info.yml"
diff --git a/tests/integration/targets/ntnx_ndb_availability_databases/tasks/main.yml b/tests/integration/targets/ntnx_ndb_availability_databases/tasks/main.yml
index d09f77ab1..4edb4f424 100644
--- a/tests/integration/targets/ntnx_ndb_availability_databases/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_availability_databases/tasks/main.yml
@@ -1,10 +1,12 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ndb_ip }}"
- nutanix_username: "{{ ndb_username }}"
- nutanix_password: "{{ ndb_password }}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ndb_ip }}"
+ nutanix_username: "{{ ndb_username }}"
+ nutanix_password: "{{ ndb_password }}"
+ validate_certs: false
block:
- - import_tasks: "tests.yml"
+ - name: Import "tests.yml"
+ ansible.builtin.import_tasks: "tests.yml"
diff --git a/tests/integration/targets/ntnx_ndb_availability_databases/tasks/tests.yml b/tests/integration/targets/ntnx_ndb_availability_databases/tasks/tests.yml
index 6cdf767e8..012cc3179 100644
--- a/tests/integration/targets/ntnx_ndb_availability_databases/tasks/tests.yml
+++ b/tests/integration/targets/ntnx_ndb_availability_databases/tasks/tests.yml
@@ -5,20 +5,22 @@
# 2. Create HA postgres database instance with multicluster nodes
# 3. Create HA postgres database instance with static IP and cluster IP assignments
-- debug:
+- name: Start ndb databases test flow
+ ansible.builtin.debug:
msg: "start ndb databases test flow for testing high availability databases"
- name: Generate random name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- set_fact:
+- name: Set db names
+ ansible.builtin.set_fact:
db1_name: "{{random_name[0]}}-ha"
db1_name_updated: "{{random_name[0]}}-updated"
cluster1_name: "{{random_name[0]}}-cluster"
-- name: create HA instance postgres database spec using check mode
- check_mode: yes
+- name: Create HA instance postgres database spec using check mode
+ check_mode: true
ntnx_ndb_databases:
wait: true
name: "{{db1_name}}"
@@ -62,7 +64,6 @@
name: "{{cluster.cluster2.name}}"
node_type: "haproxy"
-
postgres:
type: "ha"
db_name: testAnsible
@@ -80,7 +81,6 @@
write_port: "9999"
read_port: "8888"
-
time_machine:
name: TM1
desc: TM-desc
@@ -103,222 +103,140 @@
register: result
-- set_fact:
- expected_response: {
- "actionArguments": [
- {
- "name": "cluster_name",
- "value": "{{cluster1_name}}"
- },
- {
- "name": "listener_port",
- "value": "9999"
- },
- {
- "name": "allocate_pg_hugepage",
- "value": false
- },
- {
- "name": "cluster_database",
- "value": false
- },
- {
- "name": "db_password",
- "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
- },
- {
- "name": "pre_create_script",
- "value": "ls -a"
- },
- {
- "name": "post_create_script",
- "value": "ls"
- },
- {
- "name": "patroni_cluster_name",
- "value": "patroni_cluster"
- },
- {
- "name": "archive_wal_expire_days",
- "value": "3"
- },
- {
- "name": "enable_synchronous_mode",
- "value": true
- },
- {
- "name": "enable_peer_auth",
- "value": true
- },
- {
- "name": "node_type",
- "value": "database"
- },
- {
- "name": "backup_policy",
- "value": "primary_only"
- },
- {
- "name": "failover_mode",
- "value": "Automatic"
- },
- {
- "name": "database_names",
- "value": "testAnsible"
- },
- {
- "name": "database_size",
- "value": "200"
- },
- {
- "name": "provision_virtual_ip",
- "value": true
- },
- {
- "name": "proxy_write_port",
- "value": "9999"
- },
- {
- "name": "proxy_read_port",
- "value": "8888"
- },
+- name: Set expected response
+ ansible.builtin.set_fact:
+ expected_response:
+ {
+ "actionArguments":
+ [
+ { "name": "cluster_name", "value": "{{cluster1_name}}" },
+ { "name": "listener_port", "value": "9999" },
+ { "name": "allocate_pg_hugepage", "value": false },
+ { "name": "cluster_database", "value": false },
+ {
+ "name": "db_password",
+ "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
+ },
+ { "name": "pre_create_script", "value": "ls -a" },
+ { "name": "post_create_script", "value": "ls" },
+ { "name": "patroni_cluster_name", "value": "patroni_cluster" },
+ { "name": "archive_wal_expire_days", "value": "3" },
+ { "name": "enable_synchronous_mode", "value": true },
+ { "name": "enable_peer_auth", "value": true },
+ { "name": "node_type", "value": "database" },
+ { "name": "backup_policy", "value": "primary_only" },
+ { "name": "failover_mode", "value": "Automatic" },
+ { "name": "database_names", "value": "testAnsible" },
+ { "name": "database_size", "value": "200" },
+ { "name": "provision_virtual_ip", "value": true },
+ { "name": "proxy_write_port", "value": "9999" },
+ { "name": "proxy_read_port", "value": "8888" },
+ { "name": "deploy_haproxy", "value": true },
+ ],
+ "autoTuneStagingDrive": true,
+ "clustered": true,
+ "computeProfileId": "{{postgres_ha_profiles.compute_profile.uuid}}",
+ "createDbserver": true,
+ "databaseDescription": "ansible-created-db-desc",
+ "databaseType": "postgres_database",
+ "dbParameterProfileId": "{{postgres_ha_profiles.db_params_profile.uuid}}",
+ "maintenanceTasks":
+ {
+ "maintenanceWindowId": "{{ maintenance.window_uuid }}",
+ "tasks":
+ [
{
- "name": "deploy_haproxy",
- "value": true
- }
- ],
- "autoTuneStagingDrive": true,
- "clustered": true,
- "computeProfileId": "{{postgres_ha_profiles.compute_profile.uuid}}",
- "createDbserver": true,
- "databaseDescription": "ansible-created-db-desc",
- "databaseType": "postgres_database",
- "dbParameterProfileId": "{{postgres_ha_profiles.db_params_profile.uuid}}",
- "maintenanceTasks": {
- "maintenanceWindowId": "{{ maintenance.window_uuid }}",
- "tasks": [
+ "payload":
{
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -a",
- "preCommand": "ls"
- }
- },
- "taskType": "OS_PATCHING"
+ "prePostCommand":
+ { "postCommand": "ls -a", "preCommand": "ls" },
},
- {
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -F",
- "preCommand": "ls -l"
- }
- },
- "taskType": "DB_PATCHING"
- }
- ]
- },
- "name": "{{db1_name}}",
- "networkProfileId": "{{postgres_ha_profiles.static_network_profile.uuid}}",
- "nodeCount": 4,
- "nodes": [
- {
- "computeProfileId": "{{postgres_ha_profiles.compute_profile.uuid}}",
- "networkProfileId": "{{postgres_ha_profiles.static_network_profile.uuid}}",
- "nxClusterId": "{{cluster.cluster1.uuid}}",
- "properties": [
- {
- "name": "role",
- "value": "Primary"
- },
- {
- "name": "node_type",
- "value": "database"
- },
- {
- "name": "remote_archive_destination",
- "value": "/temp/"
- }
- ],
- "vmName": "{{cluster1_name}}-vm-1"
- },
- {
- "computeProfileId": "{{postgres_ha_profiles.compute_profile.uuid}}",
- "networkProfileId": "{{postgres_ha_profiles.static_network_profile.uuid}}",
- "nxClusterId": "{{cluster.cluster1.uuid}}",
- "properties": [
- {
- "name": "role",
- "value": "Secondary"
- },
- {
- "name": "node_type",
- "value": "database"
- },
- {
- "name": "remote_archive_destination",
- "value": "/temp/"
- }
- ],
- "vmName": "{{cluster1_name}}-vm-2"
+ "taskType": "OS_PATCHING",
},
{
- "computeProfileId": "test_compute_uuid",
- "networkProfileId": "{{postgres_ha_profiles.static_network_profile.uuid}}",
- "nxClusterId": "{{cluster.cluster2.uuid}}",
- "properties": [
- {
- "name": "role",
- "value": "Secondary"
- },
- {
- "name": "node_type",
- "value": "database"
- },
- {
- "name": "remote_archive_destination",
- "value": "/temp/"
- }
- ],
- "vmName": "{{cluster1_name}}-vm-3"
+ "payload":
+ {
+ "prePostCommand":
+ { "postCommand": "ls -F", "preCommand": "ls -l" },
+ },
+ "taskType": "DB_PATCHING",
},
- {
- "computeProfileId": "{{postgres_ha_profiles.compute_profile.uuid}}",
- "networkProfileId": "{{postgres_ha_profiles.static_network_profile.uuid}}",
- "nxClusterId": "{{cluster.cluster2.uuid}}",
- "properties": [
- {
- "name": "node_type",
- "value": "haproxy"
- }
- ],
- "vmName": "{{cluster1_name}}-ha-vm"
- }
- ],
- "nxClusterId": "{{cluster.cluster1.uuid}}",
- "softwareProfileId": "{{postgres_ha_profiles.software_profile.uuid}}",
- "softwareProfileVersionId": "{{postgres_ha_profiles.software_profile.latest_version_id}}",
- "sshPublicKey": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
- "tags": [],
- "timeMachineInfo": {
- "autoTuneLogDrive": true,
- "description": "TM-desc",
- "name": "TM1",
- "schedule": {},
- "slaDetails": {
- "primarySla": {
- "nxClusterIds": [
- "{{cluster.cluster1.uuid}}",
- "test_uuid"
- ],
- "slaId": "{{sla.uuid}}"
- }
- }
+ ],
+ },
+ "name": "{{db1_name}}",
+ "networkProfileId": "{{postgres_ha_profiles.static_network_profile.uuid}}",
+ "nodeCount": 4,
+ "nodes":
+ [
+ {
+ "computeProfileId": "{{postgres_ha_profiles.compute_profile.uuid}}",
+ "networkProfileId": "{{postgres_ha_profiles.static_network_profile.uuid}}",
+ "nxClusterId": "{{cluster.cluster1.uuid}}",
+ "properties":
+ [
+ { "name": "role", "value": "Primary" },
+ { "name": "node_type", "value": "database" },
+ { "name": "remote_archive_destination", "value": "/temp/" },
+ ],
+ "vmName": "{{cluster1_name}}-vm-1",
},
- "vmPassword": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
- }
+ {
+ "computeProfileId": "{{postgres_ha_profiles.compute_profile.uuid}}",
+ "networkProfileId": "{{postgres_ha_profiles.static_network_profile.uuid}}",
+ "nxClusterId": "{{cluster.cluster1.uuid}}",
+ "properties":
+ [
+ { "name": "role", "value": "Secondary" },
+ { "name": "node_type", "value": "database" },
+ { "name": "remote_archive_destination", "value": "/temp/" },
+ ],
+ "vmName": "{{cluster1_name}}-vm-2",
+ },
+ {
+ "computeProfileId": "test_compute_uuid",
+ "networkProfileId": "{{postgres_ha_profiles.static_network_profile.uuid}}",
+ "nxClusterId": "{{cluster.cluster2.uuid}}",
+ "properties":
+ [
+ { "name": "role", "value": "Secondary" },
+ { "name": "node_type", "value": "database" },
+ { "name": "remote_archive_destination", "value": "/temp/" },
+ ],
+ "vmName": "{{cluster1_name}}-vm-3",
+ },
+ {
+ "computeProfileId": "{{postgres_ha_profiles.compute_profile.uuid}}",
+ "networkProfileId": "{{postgres_ha_profiles.static_network_profile.uuid}}",
+ "nxClusterId": "{{cluster.cluster2.uuid}}",
+ "properties": [{ "name": "node_type", "value": "haproxy" }],
+ "vmName": "{{cluster1_name}}-ha-vm",
+ },
+ ],
+ "nxClusterId": "{{cluster.cluster1.uuid}}",
+ "softwareProfileId": "{{postgres_ha_profiles.software_profile.uuid}}",
+ "softwareProfileVersionId": "{{postgres_ha_profiles.software_profile.latest_version_id}}",
+ "sshPublicKey": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
+ "tags": [],
+ "timeMachineInfo":
+ {
+ "autoTuneLogDrive": true,
+ "description": "TM-desc",
+ "name": "TM1",
+ "schedule": {},
+ "slaDetails":
+ {
+ "primarySla":
+ {
+ "nxClusterIds": ["{{cluster.cluster1.uuid}}", "test_uuid"],
+ "slaId": "{{sla.uuid}}",
+ },
+ },
+ },
+ "vmPassword": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -327,7 +245,7 @@
fail_msg: "Unable to create ha instance database create spec"
success_msg: "HA instance postgres database spec created successfully"
-- name: create HA instance postgres database with static IP assignments
+- name: Create HA instance postgres database with static IP assignments
ntnx_ndb_databases:
wait: true
timeout: 5400
@@ -356,7 +274,6 @@
password: "{{vm_password}}"
pub_ssh_key: "{{public_ssh_key}}"
vms:
-
- name: "{{cluster1_name}}-vm-1"
node_type: "database"
role: "Primary"
@@ -421,15 +338,15 @@
# skip jekyll/Liquid syntax check
# {% raw %}
-- name: create properties map
- set_fact:
- properties: "{{ properties | default({}) | combine ({ item['name'] : item['value'] }) }}"
+- name: Create properties map
+ ansible.builtin.set_fact:
+ properties: "{{ properties | default({}) | combine ({ item['name'] : item['value'] }) }}"
loop: "{{result.response.properties}}"
no_log: true
# {% endraw %}
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'READY'
@@ -446,24 +363,23 @@
- result.response.databaseNodes[2].status == "READY"
- result.response.type == "postgres_database"
- result.response.tags | length == 1
- - result.response.tags[0].tagName == "{{tags.databases.name}}"
+ - result.response.tags[0].tagName == "{{entity_tags.databases.name}}"
- result.response.tags[0].value == "ha-instance-dbs"
fail_msg: "Unable to provision postgres HA database instance"
success_msg: "postgres HA database instance provision successfully"
-
-- name: unregister db along with delete time machine and db server vms
+- name: Unregister db along with delete time machine and db server vms
ntnx_ndb_databases:
db_uuid: "{{result.db_uuid}}"
state: "absent"
wait: true
delete_time_machine: true
- delete_db_server_vms: True
+ delete_db_server_vms: true
register: result
-- name: verify status of delete of database along with time machine delete
- assert:
+- name: Verify status of delete of database along with time machine delete
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -472,8 +388,7 @@
fail_msg: "database delete failed"
success_msg: "database deleted successfully"
-
-- name: create HA instance postgres database with multicluster vms
+- name: Create HA instance postgres database with multicluster vms
ntnx_ndb_databases:
timeout: 5400
wait: true
@@ -497,7 +412,6 @@
password: "{{vm_password}}"
pub_ssh_key: "{{public_ssh_key}}"
vms:
-
- name: "{{cluster1_name}}-vm-1"
node_type: "database"
role: "Primary"
@@ -552,15 +466,15 @@
# skip jekyll/Liquid syntax check
# {% raw %}
-- name: create properties map
- set_fact:
- properties: "{{ properties | default({}) | combine ({ item['name'] : item['value'] }) }}"
+- name: Create properties map
+ ansible.builtin.set_fact:
+ properties: "{{ properties | default({}) | combine ({ item['name'] : item['value'] }) }}"
loop: "{{result.response.properties}}"
no_log: true
# {% endraw %}
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'READY'
@@ -578,23 +492,23 @@
- result.response.databaseNodes[2].status == "READY"
- result.response.type == "postgres_database"
- result.response.tags | length == 1
- - result.response.tags[0].tagName == "{{tags.databases.name}}"
+ - result.response.tags[0].tagName == "{{entity_tags.databases.name}}"
- result.response.tags[0].value == "ha-instance-dbs"
fail_msg: "Unable to provision postgres HA database instance"
success_msg: "postgres HA database instance provision successfully"
-- name: unregister db along with delete time machine and db server vms
+- name: Unregister db along with delete time machine and db server vms
ntnx_ndb_databases:
db_uuid: "{{result.db_uuid}}"
state: "absent"
wait: true
delete_time_machine: true
- delete_db_server_vms: True
+ delete_db_server_vms: true
register: result
-- name: verify status of delete of database along with time machine delete
- assert:
+- name: Verify status of delete of database along with time machine delete
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
diff --git a/tests/integration/targets/ntnx_ndb_clones_info/tasks/info.yml b/tests/integration/targets/ntnx_ndb_clones_info/tasks/info.yml
index 61d21e97b..e946d767c 100644
--- a/tests/integration/targets/ntnx_ndb_clones_info/tasks/info.yml
+++ b/tests/integration/targets/ntnx_ndb_clones_info/tasks/info.yml
@@ -1,13 +1,14 @@
---
-- debug:
+- name: Start testing ntnx_ndb_clones_info
+ ansible.builtin.debug:
msg: Start testing ntnx_ndb_clones_info
- name: List all era clones
ntnx_ndb_clones_info:
register: clones
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- clones.response is defined
- clones.failed == false
@@ -16,13 +17,13 @@
fail_msg: "Unable to list all era clones"
success_msg: "era clones listed successfully"
################################################################
-- name: get era clones using it's name
+- name: Get era clones using it's name
ntnx_ndb_clones_info:
name: "{{clones.response[0].name}}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -36,8 +37,8 @@
uuid: "{{clones.response[0].id}}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -47,16 +48,15 @@
success_msg: "get era clones using it's id successfully"
################################################################
-
-- name: get era clones with incorrect name
+- name: Get era clones with incorrect name
ntnx_ndb_clones_info:
name: "abcd"
register: result
no_log: true
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.error is defined
- result.failed == true
diff --git a/tests/integration/targets/ntnx_ndb_clones_info/tasks/main.yml b/tests/integration/targets/ntnx_ndb_clones_info/tasks/main.yml
index da502fcc5..8e7493b9f 100644
--- a/tests/integration/targets/ntnx_ndb_clones_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_clones_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ndb_ip}}"
- nutanix_username: "{{ndb_username}}"
- nutanix_password: "{{ndb_password}}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ndb_ip}}"
+ nutanix_username: "{{ndb_username}}"
+ nutanix_password: "{{ndb_password}}"
+ validate_certs: false
block:
- - import_tasks: "info.yml"
+ - name: Import "info.yml"
+ ansible.builtin.import_tasks: "info.yml"
diff --git a/tests/integration/targets/ntnx_ndb_clusters/tasks/CRUD.yml b/tests/integration/targets/ntnx_ndb_clusters/tasks/CRUD.yml
index 859075c8d..6a3ae6a35 100644
--- a/tests/integration/targets/ntnx_ndb_clusters/tasks/CRUD.yml
+++ b/tests/integration/targets/ntnx_ndb_clusters/tasks/CRUD.yml
@@ -1,40 +1,40 @@
---
-- debug:
+- name: Start testing ntnx_ndb_clusters
+ ansible.builtin.debug:
msg: Start testing ntnx_ndb_clusters
- name: Register cluster with prism_vlan in check mode
ntnx_ndb_clusters:
- name: "{{cluster.cluster3.name}}"
- desc: "{{cluster.cluster3.desc}}"
- name_prefix: "{{cluster.cluster3.name_prefix}}"
- cluster_ip: "{{cluster.cluster3.cluster_ip}}"
- cluster_credentials:
- username: "{{cluster.cluster3.cluster_credentials.username}}"
- password: "{{cluster.cluster3.cluster_credentials.password}}"
- agent_network:
- dns_servers:
- - "{{cluster.cluster3.agent_network.dns_servers[0]}}"
- - "{{cluster.cluster3.agent_network.dns_servers[1]}}"
- ntp_servers:
- - "{{cluster.cluster3.agent_network.ntp_servers[0]}}"
- - "{{cluster.cluster3.agent_network.ntp_servers[1]}}"
- - "{{cluster.cluster3.agent_network.ntp_servers[2]}}"
- - "{{cluster.cluster3.agent_network.ntp_servers[3]}}"
- vlan_access:
- prism_vlan:
- vlan_name: "{{cluster.cluster3.vlan_access.prism_vlan.vlan_name}}"
- vlan_type: "{{cluster.cluster3.vlan_access.prism_vlan.vlan_type}}"
- static_ip: "{{cluster.cluster3.vlan_access.prism_vlan.static_ip}}"
- gateway: "{{cluster.cluster3.vlan_access.prism_vlan.gateway}}"
- subnet_mask: "{{cluster.cluster3.vlan_access.prism_vlan.subnet_mask}}"
- storage_container: "{{cluster.cluster3.storage_container}}"
+ name: "{{cluster.cluster3.name}}"
+ desc: "{{cluster.cluster3.desc}}"
+ name_prefix: "{{cluster.cluster3.name_prefix}}"
+ cluster_ip: "{{cluster.cluster3.cluster_ip}}"
+ cluster_credentials:
+ username: "{{cluster.cluster3.cluster_credentials.username}}"
+ password: "{{cluster.cluster3.cluster_credentials.password}}"
+ agent_network:
+ dns_servers:
+ - "{{cluster.cluster3.agent_network.dns_servers[0]}}"
+ - "{{cluster.cluster3.agent_network.dns_servers[1]}}"
+ ntp_servers:
+ - "{{cluster.cluster3.agent_network.ntp_servers[0]}}"
+ - "{{cluster.cluster3.agent_network.ntp_servers[1]}}"
+ - "{{cluster.cluster3.agent_network.ntp_servers[2]}}"
+ - "{{cluster.cluster3.agent_network.ntp_servers[3]}}"
+ vlan_access:
+ prism_vlan:
+ vlan_name: "{{cluster.cluster3.vlan_access.prism_vlan.vlan_name}}"
+ vlan_type: "{{cluster.cluster3.vlan_access.prism_vlan.vlan_type}}"
+ static_ip: "{{cluster.cluster3.vlan_access.prism_vlan.static_ip}}"
+ gateway: "{{cluster.cluster3.vlan_access.prism_vlan.gateway}}"
+ subnet_mask: "{{cluster.cluster3.vlan_access.prism_vlan.subnet_mask}}"
+ storage_container: "{{cluster.cluster3.storage_container}}"
register: result
ignore_errors: true
check_mode: true
-
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -54,37 +54,37 @@
- name: Register cluster with prism_vlan
ntnx_ndb_clusters:
- wait: true
- name: "{{cluster.cluster3.name}}"
- desc: "{{cluster.cluster3.desc}}"
- name_prefix: "{{cluster.cluster3.name_prefix}}"
- cluster_ip: "{{cluster.cluster3.cluster_ip}}"
- cluster_credentials:
- username: "{{cluster.cluster3.cluster_credentials.username}}"
- password: "{{cluster.cluster3.cluster_credentials.password}}"
- agent_network:
- dns_servers:
- - "{{cluster.cluster3.agent_network.dns_servers[0]}}"
- - "{{cluster.cluster3.agent_network.dns_servers[1]}}"
- ntp_servers:
- - "{{cluster.cluster3.agent_network.ntp_servers[0]}}"
- - "{{cluster.cluster3.agent_network.ntp_servers[1]}}"
- - "{{cluster.cluster3.agent_network.ntp_servers[2]}}"
- - "{{cluster.cluster3.agent_network.ntp_servers[3]}}"
- vlan_access:
- prism_vlan:
- vlan_name: "{{cluster.cluster3.vlan_access.prism_vlan.vlan_name}}"
- vlan_type: "{{cluster.cluster3.vlan_access.prism_vlan.vlan_type}}"
- static_ip: "{{cluster.cluster3.vlan_access.prism_vlan.static_ip}}"
- gateway: "{{cluster.cluster3.vlan_access.prism_vlan.gateway}}"
- subnet_mask: "{{cluster.cluster3.vlan_access.prism_vlan.subnet_mask}}"
- storage_container: "{{cluster.cluster3.storage_container}}"
+ wait: true
+ name: "{{cluster.cluster3.name}}"
+ desc: "{{cluster.cluster3.desc}}"
+ name_prefix: "{{cluster.cluster3.name_prefix}}"
+ cluster_ip: "{{cluster.cluster3.cluster_ip}}"
+ cluster_credentials:
+ username: "{{cluster.cluster3.cluster_credentials.username}}"
+ password: "{{cluster.cluster3.cluster_credentials.password}}"
+ agent_network:
+ dns_servers:
+ - "{{cluster.cluster3.agent_network.dns_servers[0]}}"
+ - "{{cluster.cluster3.agent_network.dns_servers[1]}}"
+ ntp_servers:
+ - "{{cluster.cluster3.agent_network.ntp_servers[0]}}"
+ - "{{cluster.cluster3.agent_network.ntp_servers[1]}}"
+ - "{{cluster.cluster3.agent_network.ntp_servers[2]}}"
+ - "{{cluster.cluster3.agent_network.ntp_servers[3]}}"
+ vlan_access:
+ prism_vlan:
+ vlan_name: "{{cluster.cluster3.vlan_access.prism_vlan.vlan_name}}"
+ vlan_type: "{{cluster.cluster3.vlan_access.prism_vlan.vlan_type}}"
+ static_ip: "{{cluster.cluster3.vlan_access.prism_vlan.static_ip}}"
+ gateway: "{{cluster.cluster3.vlan_access.prism_vlan.gateway}}"
+ subnet_mask: "{{cluster.cluster3.vlan_access.prism_vlan.subnet_mask}}"
+ storage_container: "{{cluster.cluster3.storage_container}}"
register: result
ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -97,39 +97,40 @@
################################################################
-- name: update cluster name , desc
+- name: Update cluster name , desc
ntnx_ndb_clusters:
- uuid: "{{result.cluster_uuid}}"
- name: newname
- desc: newdesc
+ uuid: "{{result.cluster_uuid}}"
+ name: newname
+ desc: newdesc
register: result
ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response.name == "newname"
- result.cluster_uuid is defined
- result.response.description == "newdesc"
fail_msg: "fail: Unable to update cluster name , desc"
success_msg: "pass: update cluster name , desc finished successfully"
-- set_fact:
- todelete: "{{result.cluster_uuid}}"
+- name: Set cluster uuid to delete
+ ansible.builtin.set_fact:
+ todelete: "{{result.cluster_uuid}}"
################################################################
-- name: update cluster credeential in check_mode
+- name: Update cluster credeential in check_mode
ntnx_ndb_clusters:
- uuid: "{{result.cluster_uuid}}"
- cluster_credentials:
- username: test
- password: test
+ uuid: "{{result.cluster_uuid}}"
+ cluster_credentials:
+ username: test
+ password: test
register: result
ignore_errors: true
no_log: true
check_mode: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -143,14 +144,14 @@
- name: Negative Scenarios update storage container
ntnx_ndb_clusters:
- uuid: "{{result.cluster_uuid}}"
- storage_container: "{{cluster.cluster3.storage_container}}"
+ uuid: "{{result.cluster_uuid}}"
+ storage_container: "{{cluster.cluster3.storage_container}}"
register: out
ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- out.changed == false
- out.failed == true
@@ -162,20 +163,20 @@
- name: Negative Scenarios update vlan access
ntnx_ndb_clusters:
- uuid: "{{result.cluster_uuid}}"
- vlan_access:
- prism_vlan:
- vlan_name: "{{cluster.cluster3.vlan_access.prism_vlan.vlan_name}}"
- vlan_type: "{{cluster.cluster3.vlan_access.prism_vlan.vlan_type}}"
- static_ip: "{{cluster.cluster3.vlan_access.prism_vlan.static_ip}}"
- gateway: "{{cluster.cluster3.vlan_access.prism_vlan.gateway}}"
- subnet_mask: "{{cluster.cluster3.vlan_access.prism_vlan.subnet_mask}}"
+ uuid: "{{result.cluster_uuid}}"
+ vlan_access:
+ prism_vlan:
+ vlan_name: "{{cluster.cluster3.vlan_access.prism_vlan.vlan_name}}"
+ vlan_type: "{{cluster.cluster3.vlan_access.prism_vlan.vlan_type}}"
+ static_ip: "{{cluster.cluster3.vlan_access.prism_vlan.static_ip}}"
+ gateway: "{{cluster.cluster3.vlan_access.prism_vlan.gateway}}"
+ subnet_mask: "{{cluster.cluster3.vlan_access.prism_vlan.subnet_mask}}"
register: out
ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- out.changed == false
- out.failed == true
@@ -187,22 +188,22 @@
- name: Negative Scenarios update agent network
ntnx_ndb_clusters:
- uuid: "{{result.cluster_uuid}}"
- agent_network:
- dns_servers:
- - "{{cluster.cluster3.agent_network.dns_servers[0]}}"
- - "{{cluster.cluster3.agent_network.dns_servers[1]}}"
- ntp_servers:
- - "{{cluster.cluster3.agent_network.ntp_servers[0]}}"
- - "{{cluster.cluster3.agent_network.ntp_servers[1]}}"
- - "{{cluster.cluster3.agent_network.ntp_servers[2]}}"
- - "{{cluster.cluster3.agent_network.ntp_servers[3]}}"
+ uuid: "{{result.cluster_uuid}}"
+ agent_network:
+ dns_servers:
+ - "{{cluster.cluster3.agent_network.dns_servers[0]}}"
+ - "{{cluster.cluster3.agent_network.dns_servers[1]}}"
+ ntp_servers:
+ - "{{cluster.cluster3.agent_network.ntp_servers[0]}}"
+ - "{{cluster.cluster3.agent_network.ntp_servers[1]}}"
+ - "{{cluster.cluster3.agent_network.ntp_servers[2]}}"
+ - "{{cluster.cluster3.agent_network.ntp_servers[3]}}"
register: out
ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- out.changed == false
- out.failed == true
@@ -214,14 +215,14 @@
- name: Negative Scenarios update agent network
ntnx_ndb_clusters:
- uuid: "{{result.cluster_uuid}}"
- name_prefix: "{{cluster.cluster3.name_prefix}}"
+ uuid: "{{result.cluster_uuid}}"
+ name_prefix: "{{cluster.cluster3.name_prefix}}"
register: out
ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- out.changed == false
- out.failed == true
@@ -236,8 +237,8 @@
register: clusters
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- clusters.response is defined
- clusters.failed == false
@@ -247,7 +248,7 @@
success_msg: "NDB clusters listed successfully"
################################################################
-- name: get ndb cluster with count_entities
+- name: Get ndb cluster with count_entities
ntnx_ndb_clusters_info:
filters:
count_entities: true
@@ -255,8 +256,8 @@
ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -265,14 +266,14 @@
fail_msg: "Unable to get NDB clusters with count_entities "
success_msg: "get NDB clusters using with count_entities successfully"
################################################################
-- name: get NDB clusters using it's name
+- name: Get NDB clusters using it's name
ntnx_ndb_clusters_info:
name: "{{clusters.response[0].name}}"
register: result
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -289,8 +290,8 @@
register: result
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -301,15 +302,15 @@
################################################################
-- name: get NDB clusters with incorrect name
+- name: Get NDB clusters with incorrect name
ntnx_ndb_clusters_info:
name: "abcd"
register: result
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.error is defined
- result.failed == true
@@ -319,16 +320,16 @@
################################################################
-- name: delete cluster
+- name: Delete cluster
ntnx_ndb_clusters:
- uuid: "{{todelete}}"
- state: absent
+ uuid: "{{todelete}}"
+ state: absent
register: result
ignore_errors: true
no_log: true
-- name: assert when status not complete
- assert:
+- name: Assert when status not complete
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -337,6 +338,6 @@
fail_msg: "Unable to delete custer"
success_msg: "cluster deleted successfully"
-
-- set_fact:
- todelete: []
+- name: Reset todelete list
+ ansible.builtin.set_fact:
+ todelete: []
diff --git a/tests/integration/targets/ntnx_ndb_clusters/tasks/main.yml b/tests/integration/targets/ntnx_ndb_clusters/tasks/main.yml
index cbd87d175..99508b383 100644
--- a/tests/integration/targets/ntnx_ndb_clusters/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_clusters/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ndb_ip}}"
- nutanix_username: "{{ndb_username}}"
- nutanix_password: "{{ndb_password}}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ndb_ip}}"
+ nutanix_username: "{{ndb_username}}"
+ nutanix_password: "{{ndb_password}}"
+ validate_certs: false
block:
- - import_tasks: "CRUD.yml"
+ - name: Import "CRUD.yml"
+ ansible.builtin.import_tasks: "CRUD.yml"
diff --git a/tests/integration/targets/ntnx_ndb_database_clones/tasks/clones.yml b/tests/integration/targets/ntnx_ndb_database_clones/tasks/clones.yml
index 882a78bb5..699108501 100644
--- a/tests/integration/targets/ntnx_ndb_database_clones/tasks/clones.yml
+++ b/tests/integration/targets/ntnx_ndb_database_clones/tasks/clones.yml
@@ -7,24 +7,25 @@
# 4. Authorization and deauthorization of db server vm wrt to time machines
# 5. Creation of clone on authorized db server vm
-- debug:
+- name: Start ntnx_ndb_database_clones tests
+ ansible.builtin.debug:
msg: "start ndb database clone tests"
- name: Generate random name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- set_fact:
+- name: Set variables
+ ansible.builtin.set_fact:
db1_name: "{{random_name[0]}}"
- clone_db1: "{{random_name[0]}}-clone"
+ clone_db1: "{{random_name[0]}}-clone"
vm1_name: "{{random_name[0]}}-vm"
tm1: "{{random_name[0]}}-time-machine"
snapshot_name: "{{random_name[0]}}-snapshot"
############################################ setup db and its snapshot for clone tests ###########################################
-
-- name: create single instance postgres database on new db server vm
+- name: Create single instance postgres database on new db server vm
ntnx_ndb_databases:
wait: true
name: "{{db1_name}}"
@@ -70,14 +71,16 @@
register: result
-- set_fact:
+- name: Set db uuid
+ ansible.builtin.set_fact:
db_uuid: "{{result.db_uuid}}"
-- set_fact:
+- name: Set time machine uuid
+ ansible.builtin.set_fact:
time_machine_uuid: "{{result.response.timeMachineId}}"
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'READY'
@@ -87,17 +90,18 @@
fail_msg: "Unable to create single instance postgres database"
success_msg: "single instance postgres database created successfully"
-- set_fact:
+- name: Set db server uuid
+ ansible.builtin.set_fact:
db_server_uuid: "{{result.response.databaseNodes[0].dbserverId}}"
-- name: create manual snapshot of database
+- name: Create manual snapshot of database
ntnx_ndb_database_snapshots:
- time_machine_uuid: "{{time_machine_uuid}}"
+ time_machine_uuid: "{{time_machine_uuid}}"
name: "{{snapshot_name}}"
register: result
-- name: snapshot status
- assert:
+- name: Snapshot status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -107,14 +111,14 @@
fail_msg: "unable to create snapshot of database"
success_msg: "snapshot for clone tests created successfully"
-- set_fact:
+- name: Set snapshot uuid
+ ansible.builtin.set_fact:
snapshot_uuid: "{{result.snapshot_uuid}}"
############################################ create clone on new db server vm tests ###########################################
-
-- name: create spec for clone of database created above on new db server vm
- check_mode: yes
+- name: Create spec for clone of database created above on new db server vm
+ check_mode: true
ntnx_ndb_database_clones:
name: "{{clone_db1}}"
desc: "ansible-created-clone"
@@ -149,7 +153,7 @@
days: 2
timezone: "Asia/Calcutta"
remind_before_in_days: 1
- delete_database: True
+ delete_database: true
refresh_schedule:
days: 2
@@ -160,79 +164,77 @@
ansible-clones: ansible-test-db-clones
register: result
-
-
-- set_fact:
- expected_response: {
- "actionArguments": [
- {
- "name": "db_password",
- "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
- },
- {
- "name": "pre_clone_cmd",
- "value": "ls"
- },
- {
- "name": "post_clone_cmd",
- "value": "ls -a"
- },
- {
- "name": "dbserver_description",
- "value": "vm for db server"
- }
- ],
- "clustered": false,
- "computeProfileId": "{{compute_profile.uuid}}",
- "createDbserver": true,
- "databaseParameterProfileId": "{{db_params_profile.uuid}}",
- "description": "ansible-created-clone",
- "latestSnapshot": false,
- "lcmConfig": {
- "databaseLCMConfig": {
- "expiryDetails": {
- "deleteDatabase": true,
- "expireInDays": 2,
- "expiryDateTimezone": "Asia/Calcutta",
- "remindBeforeInDays": 1
- },
- "refreshDetails": {
- "refreshDateTimezone": "Asia/Calcutta",
- "refreshInDays": 2,
- "refreshTime": "12:00:00"
- }
- }
+- name: Set expected response
+ ansible.builtin.set_fact:
+ expected_response:
+ {
+ "actionArguments":
+ [
+ {
+ "name": "db_password",
+ "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
+ },
+ { "name": "pre_clone_cmd", "value": "ls" },
+ { "name": "post_clone_cmd", "value": "ls -a" },
+ { "name": "dbserver_description", "value": "vm for db server" },
+ ],
+ "clustered": false,
+ "computeProfileId": "{{compute_profile.uuid}}",
+ "createDbserver": true,
+ "databaseParameterProfileId": "{{db_params_profile.uuid}}",
+ "description": "ansible-created-clone",
+ "latestSnapshot": false,
+ "lcmConfig":
+ {
+ "databaseLCMConfig":
+ {
+ "expiryDetails":
+ {
+ "deleteDatabase": true,
+ "expireInDays": 2,
+ "expiryDateTimezone": "Asia/Calcutta",
+ "remindBeforeInDays": 1,
+ },
+ "refreshDetails":
+ {
+ "refreshDateTimezone": "Asia/Calcutta",
+ "refreshInDays": 2,
+ "refreshTime": "12:00:00",
+ },
+ },
+ },
+ "name": "{{clone_db1}}",
+ "networkProfileId": "{{network_profile.uuid}}",
+ "nodeCount": 1,
+ "nodes":
+ [
+ {
+ "computeProfileId": "{{compute_profile.uuid}}",
+ "networkProfileId": "{{network_profile.uuid}}",
+ "nxClusterId": "{{cluster.cluster1.uuid}}",
+ "properties": [],
+ "vmName": "{{vm1_name}}",
+ },
+ ],
+ "nxClusterId": "{{cluster.cluster1.uuid}}",
+ "snapshotId": null,
+ "sshPublicKey": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
+ "tags":
+ [
+ {
+ "tagId": "{{entity_tags.clones.uuid}}",
+ "tagName": "ansible-clones",
+ "value": "ansible-test-db-clones",
},
- "name": "{{clone_db1}}",
- "networkProfileId": "{{network_profile.uuid}}",
- "nodeCount": 1,
- "nodes": [
- {
- "computeProfileId": "{{compute_profile.uuid}}",
- "networkProfileId": "{{network_profile.uuid}}",
- "nxClusterId": "{{cluster.cluster1.uuid}}",
- "properties": [],
- "vmName": "{{vm1_name}}"
- }
- ],
- "nxClusterId": "{{cluster.cluster1.uuid}}",
- "snapshotId": null,
- "sshPublicKey": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
- "tags": [
- {
- "tagId": "{{tags.clones.uuid}}",
- "tagName": "ansible-clones",
- "value": "ansible-test-db-clones"
- }
- ],
- "timeMachineId": "{{time_machine_uuid}}",
- "timeZone": "UTC",
- "userPitrTimestamp": "2023-02-04 07:29:36",
- "vmPassword": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
- }
+ ],
+ "timeMachineId": "{{time_machine_uuid}}",
+ "timeZone": "UTC",
+ "userPitrTimestamp": "2023-02-04 07:29:36",
+ "vmPassword": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -241,7 +243,7 @@
fail_msg: "Unable to create DB clone provision spec"
success_msg: "DB clone create spec generated successfully using check_mode"
-- name: create clone using snapshot of previously created database
+- name: Create clone using snapshot of previously created database
ntnx_ndb_database_clones:
name: "{{clone_db1}}"
desc: "ansible-created-clone"
@@ -273,7 +275,7 @@
days: 2
timezone: "Asia/Calcutta"
remind_before_in_days: 1
- delete_database: True
+ delete_database: true
refresh_schedule:
days: 2
@@ -286,15 +288,15 @@
# skip jekyll/Liquid syntax check
# {% raw %}
-- name: create properties map
- set_fact:
+- name: Create properties map
+ ansible.builtin.set_fact:
properties: "{{ properties | default({}) | combine ({ item['name'] : item['value'] }) }}"
loop: "{{result.response.properties}}"
no_log: true
# {% endraw %}
- name: Clone create status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -313,23 +315,24 @@
- result.response.lcmConfig.refreshDetails.refreshTime == "12:00:00"
- properties["db_parameter_profile_id"] == db_params_profile.uuid
- result.response.tags | length == 1
- - result.response.tags[0].tagName == "{{tags.clones.name}}"
+ - result.response.tags[0].tagName == "{{entity_tags.clones.name}}"
- result.response.tags[0].value == "ansible-test-db-clones"
- result.response.sourceSnapshotId == snapshot_uuid
- result.response.parentTimeMachineId == time_machine_uuid
fail_msg: "Unable to create clone"
success_msg: "Database clone created successfully"
-- set_fact:
+- name: Set clone uuid
+ ansible.builtin.set_fact:
clone_uuid: "{{result.uuid}}"
-- set_fact:
+- name: Set db server uuid
+ ansible.builtin.set_fact:
db_server_uuid: "{{result.response.databaseNodes[0].dbserverId}}"
############################################ clone update and removal/refresh schedules related tests ###########################################
-
-- name: update name, desc, tags and schedules
+- name: Update name, desc, tags and schedules
ntnx_ndb_database_clones:
uuid: "{{clone_uuid}}"
name: "{{clone_db1}}-updated"
@@ -351,7 +354,7 @@
register: result
- name: Clone update status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -366,13 +369,13 @@
- result.response.lcmConfig.refreshDetails.refreshInDays == 4
- result.response.lcmConfig.refreshDetails.refreshTime == "14:00:00"
- result.response.tags | length == 1
- - result.response.tags[0].tagName == "{{tags.clones.name}}"
+ - result.response.tags[0].tagName == "{{entity_tags.clones.name}}"
- result.response.tags[0].value == "ansible-test-db-clones-updated"
fail_msg: "Unable to update clone"
success_msg: "Database clone updated succefully"
-- name: check idempotency
+- name: Check idempotency
ntnx_ndb_database_clones:
uuid: "{{clone_uuid}}"
name: "{{clone_db1}}-updated"
@@ -393,10 +396,8 @@
ansible-clones: ansible-test-db-clones-updated
register: result
-
-
-- name: check idempotency status
- assert:
+- name: Check idempotency status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -404,8 +405,7 @@
fail_msg: "database clone got updated"
success_msg: "database clone update got skipped due to no state changes"
-
-- name: remove schedules
+- name: Remove schedules
ntnx_ndb_database_clones:
uuid: "{{clone_uuid}}"
@@ -417,10 +417,8 @@
register: result
-
-
- name: Check schedule remove status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -433,18 +431,16 @@
########################################### refresh clone ###########################################
-
-- name: create spec for refresh clone to a pitr timestamp
- check_mode: yes
+- name: Create spec for refresh clone to a pitr timestamp
+ check_mode: true
ntnx_ndb_database_clone_refresh:
uuid: "{{clone_uuid}}"
pitr_timestamp: "2023-02-04 07:29:36"
timezone: "UTC"
register: result
-
- name: Check refresh db with pitr spec
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -453,17 +449,14 @@
fail_msg: "creation refresh db clone spec failed"
success_msg: "refresh db clone spec created successfully"
-
-- name: refresh db clone
+- name: Refresh db clone
ntnx_ndb_database_clone_refresh:
uuid: "{{clone_uuid}}"
snapshot_uuid: "{{snapshot_uuid}}"
register: result
-
-
- name: Check database refresh status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -474,19 +467,16 @@
########################################### delete clone tests###########################################
-
-- name: create soft remove spec
- check_mode: yes
+- name: Create soft remove spec
+ check_mode: true
ntnx_ndb_database_clones:
state: "absent"
uuid: "{{clone_uuid}}"
soft_remove: true
register: result
-
-
-- name: verify soft remove spec
- assert:
+- name: Verify soft remove spec
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -496,19 +486,15 @@
fail_msg: "creation of spec for soft remove failed"
success_msg: "spec for soft remove created successfully"
-
-
-- name: create unregistration spec
- check_mode: yes
+- name: Create unregistration spec
+ check_mode: true
ntnx_ndb_database_clones:
state: "absent"
uuid: "{{clone_uuid}}"
register: result
-
-
-- name: verify unregistration spec
- assert:
+- name: Verify unregistration spec
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -518,17 +504,15 @@
fail_msg: "creation of spec for unregistration failed"
success_msg: "spec for unregistration created successfully"
-- name: delete clone db
+- name: Delete clone db
ntnx_ndb_database_clones:
state: "absent"
uuid: "{{clone_uuid}}"
delete_from_vm: true
register: result
-
-
-- name: verify status of db clone delete
- assert:
+- name: Verify status of db clone delete
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -538,8 +522,7 @@
########################################### authorize and deauthorize db server vms###########################################
-
-- name: authorize db server vms
+- name: Authorize db server vms
ntnx_ndb_authorize_db_server_vms:
time_machine:
name: "{{tm1}}"
@@ -547,10 +530,8 @@
- name: "{{vm1_name}}"
register: result
-
-
-- name: verify status of authorization of db server vms
- assert:
+- name: Verify status of authorization of db server vms
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -558,7 +539,7 @@
fail_msg: "database authorization with time machine failed"
success_msg: "database authorization with time machine successfully"
-- name: deauthorize db server vms
+- name: Deauthorize db server vms
ntnx_ndb_authorize_db_server_vms:
state: "absent"
time_machine:
@@ -567,10 +548,8 @@
- name: "{{vm1_name}}"
register: result
-
-
-- name: verify status of deauthorization of db server vms
- assert:
+- name: Verify status of deauthorization of db server vms
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -578,8 +557,7 @@
fail_msg: "database deauthorization with time machine failed"
success_msg: "database deauthorization with time machine went successfully"
-
-- name: authorize db server vms for hosting clone
+- name: Authorize db server vms for hosting clone
ntnx_ndb_authorize_db_server_vms:
time_machine:
name: "{{tm1}}"
@@ -587,9 +565,8 @@
- name: "{{vm1_name}}"
register: result
-
-- name: verify status of authorization of db server vms
- assert:
+- name: Verify status of authorization of db server vms
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -599,10 +576,10 @@
############################################ clone on authorized db server vm ###########################################
-
-- set_fact:
+- name: Create timestamp for clone schedules
+ ansible.builtin.set_fact:
timestamp: "2123-11-08 12:36:15"
-- name: create clone using snapshot on authorized server
+- name: Create clone using snapshot on authorized server
ntnx_ndb_database_clones:
name: "{{clone_db1}}"
desc: "ansible-created-clone"
@@ -625,7 +602,7 @@
timestamp: "{{timestamp}}"
timezone: "Asia/Calcutta"
remind_before_in_days: 1
- delete_database: True
+ delete_database: true
refresh_schedule:
days: 2
@@ -636,10 +613,8 @@
ansible-clones: ansible-test-db-clones
register: result
-
-
- name: Clone create status on authorized db server vm
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -654,18 +629,19 @@
fail_msg: "Unable to create clone"
success_msg: "Database clone created succefully"
-- set_fact:
+- name: Set clone uuid
+ ansible.builtin.set_fact:
delete_clone_uuid: "{{result.uuid}}"
-- name: delete clone db
+- name: Delete clone db
ntnx_ndb_database_clones:
state: "absent"
uuid: "{{delete_clone_uuid}}"
delete_from_vm: true
register: result
-- name: verify status of db clone delete
- assert:
+- name: Verify status of db clone delete
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -675,7 +651,7 @@
########################################### create clone from latest snapshot ##################################
-- name: authorize again db server vm
+- name: Authorize again db server vm
ntnx_ndb_authorize_db_server_vms:
time_machine:
name: "{{tm1}}"
@@ -683,10 +659,8 @@
- name: "{{vm1_name}}"
register: result
-
-
-- name: verify status of authorization of db server vms
- assert:
+- name: Verify status of authorization of db server vms
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -694,7 +668,7 @@
fail_msg: "database authorization with time machine failed"
success_msg: "database authorization with time machine successfully"
-- name: create clone using latest snapshot on authorized server
+- name: Create clone using latest snapshot on authorized server
ntnx_ndb_database_clones:
name: "{{clone_db1}}fromLatestSnapshot"
desc: "ansible-created-clone from latest snapshot"
@@ -711,13 +685,13 @@
time_machine:
uuid: "{{time_machine_uuid}}"
- latest_snapshot: True
+ latest_snapshot: true
removal_schedule:
timestamp: "{{timestamp}}"
timezone: "Asia/Calcutta"
remind_before_in_days: 1
- delete_database: True
+ delete_database: true
refresh_schedule:
days: 2
@@ -728,10 +702,8 @@
ansible-clones: ansible-test-db-clones
register: result
-
-
- name: Clone create status on authorized db server vm
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -746,21 +718,21 @@
fail_msg: "Unable to create clone from latest snapshot"
success_msg: "Database clone created from latest snapshot successfully"
-
-
-- set_fact:
+- name: Set clone uuid
+ ansible.builtin.set_fact:
delete_clone_uuid: "{{result.uuid}}"
############################################ info module tests ##################################
-- debug:
+- name: Start testing ntnx_ndb_clones_info
+ ansible.builtin.debug:
msg: Start testing ntnx_ndb_clones_info
- name: List all era clones
ntnx_ndb_clones_info:
register: clones
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- clones.response is defined
- clones.failed == false
@@ -769,13 +741,13 @@
fail_msg: "Unable to list all era clones"
success_msg: "era clones listed successfully"
################################################################
-- name: get era clones using it's name
+- name: Get era clones using it's name
ntnx_ndb_clones_info:
name: "{{clones.response[0].name}}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -789,8 +761,8 @@
uuid: "{{clones.response[0].id}}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -800,34 +772,32 @@
success_msg: "get era clones using it's id successfully"
################################################################
-
-- name: get era clones with incorrect name
+- name: Get era clones with incorrect name
ntnx_ndb_clones_info:
name: "abcd"
register: result
no_log: true
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.error is defined
- result.failed == true
- result.changed == false
fail_msg: "module didn't errored out correctly when incorrect name is given"
success_msg: "module errored out correctly when incorrect name is given"
-############################################cleanup###########################################
+############################################ Cleanup ###########################################
-- name: delete clone db
+- name: Delete clone db
ntnx_ndb_database_clones:
state: "absent"
uuid: "{{delete_clone_uuid}}"
delete_from_vm: true
register: result
-
-- name: verify status of db clone delete
- assert:
+- name: Verify status of db clone delete
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -835,16 +805,15 @@
fail_msg: "database delete failed"
success_msg: "database delete successfully"
-
-- name: delete db server vm
+- name: Delete db server vm
ntnx_ndb_db_server_vms:
state: "absent"
uuid: "{{db_server_uuid}}"
delete_from_cluster: true
register: result
-- name: verify status of delete of db server vm used for clone
- assert:
+- name: Verify status of delete of db server vm used for clone
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -852,17 +821,16 @@
fail_msg: "db server vm deleted failed"
success_msg: "db server vm deleted successfully"
-
-- name: delete database created earlier
+- name: Delete database created earlier
ntnx_ndb_databases:
state: "absent"
db_uuid: "{{db_uuid}}"
delete_db_server_vms: true
- delete_time_machine: True
+ delete_time_machine: true
register: result
-- name: verify status of delete of database along with time machine and db server vm delete
- assert:
+- name: Verify status of delete of database along with time machine and db server vm delete
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
diff --git a/tests/integration/targets/ntnx_ndb_database_clones/tasks/main.yml b/tests/integration/targets/ntnx_ndb_database_clones/tasks/main.yml
index 0d3a04a98..0c3e00653 100644
--- a/tests/integration/targets/ntnx_ndb_database_clones/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_database_clones/tasks/main.yml
@@ -1,10 +1,12 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ndb_ip }}"
- nutanix_username: "{{ ndb_username }}"
- nutanix_password: "{{ ndb_password }}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ndb_ip }}"
+ nutanix_username: "{{ ndb_username }}"
+ nutanix_password: "{{ ndb_password }}"
+ validate_certs: false
block:
- - import_tasks: "clones.yml"
+ - name: Import "clones.yml"
+ ansible.builtin.import_tasks: "clones.yml"
diff --git a/tests/integration/targets/ntnx_ndb_databases_actions/tasks/all_actions.yml b/tests/integration/targets/ntnx_ndb_databases_actions/tasks/all_actions.yml
index 273b84718..e75fc9c11 100644
--- a/tests/integration/targets/ntnx_ndb_databases_actions/tasks/all_actions.yml
+++ b/tests/integration/targets/ntnx_ndb_databases_actions/tasks/all_actions.yml
@@ -9,14 +9,16 @@
# 6. Scale database
# 7. Add/Remove linked databases
-- debug:
+- name: Start ndb database day2 actions tests
+ ansible.builtin.debug:
msg: "start ndb database day2 actions tests"
- name: Generate random name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- set_fact:
+- name: Set variables
+ ansible.builtin.set_fact:
db1_name: "{{random_name[0]}}"
vm1_name: "{{random_name[0]}}-vm"
tm1: "{{random_name[0]}}-time-machine"
@@ -24,8 +26,7 @@
############################################ setup db ###########################################
-
-- name: create single instance postgres database on new db server vm
+- name: Create single instance postgres database on new db server vm
ntnx_ndb_databases:
wait: true
name: "{{db1_name}}"
@@ -71,14 +72,16 @@
register: result
-- set_fact:
+- name: Set db_uuid
+ ansible.builtin.set_fact:
db_uuid: "{{result.db_uuid}}"
-- set_fact:
+- name: Set time_machine_uuid
+ ansible.builtin.set_fact:
time_machine_uuid: "{{result.response.timeMachineId}}"
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'READY'
@@ -88,14 +91,14 @@
fail_msg: "Unable to create single instance postgres database"
success_msg: "single instance postgres database created successfully"
-- set_fact:
+- name: Set db server uuid
+ ansible.builtin.set_fact:
db_server_uuid: "{{result.response.databaseNodes[0].dbserverId}}"
-
############################################ snapshots test ###########################################
-- name: create snapshot create spec
- check_mode: yes
+- name: Create snapshot create spec
+ check_mode: true
ntnx_ndb_database_snapshots:
name: "{{snapshot_name}}"
time_machine_uuid: "{{time_machine_uuid}}"
@@ -106,31 +109,28 @@
expiry_days: 4
register: result
-- set_fact:
- expected_response: {
+- name: Set expected response
+ ansible.builtin.set_fact:
+ expected_response:
+ {
"changed": false,
"error": null,
"failed": false,
- "response": {
- "lcmConfig": {
- "snapshotLCMConfig": {
- "expiryDetails": {
- "expireInDays": 4,
- }
- }
- },
+ "response":
+ {
+ "lcmConfig":
+ {
+ "snapshotLCMConfig": { "expiryDetails": { "expireInDays": 4 } },
+ },
"name": "{{snapshot_name}}",
- "replicateToClusterIds": [
- "{{cluster.cluster1.uuid}}",
- "test_uuid2",
- "test_uuid3"
- ]
- },
- "snapshot_uuid": null
- }
+ "replicateToClusterIds":
+ ["{{cluster.cluster1.uuid}}", "test_uuid2", "test_uuid3"],
+ },
+ "snapshot_uuid": null,
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -139,16 +139,14 @@
fail_msg: "Unable to create snapshot create spec"
success_msg: "Snapshot create spec generated successfully using check mode"
-
-- name: create snapshot with minimal spec
+- name: Create snapshot with minimal spec
ntnx_ndb_database_snapshots:
name: "{{snapshot_name}}1"
time_machine_uuid: "{{time_machine_uuid}}"
register: result
-
-- name: snapshot create status
- assert:
+- name: Snapshot create status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -158,19 +156,19 @@
fail_msg: "Unable to create snapshot"
success_msg: "Snapshot created successfully"
-- name: create snapshot with expiry
+- name: Create snapshot with expiry
ntnx_ndb_database_snapshots:
name: "{{snapshot_name}}2"
time_machine_uuid: "{{time_machine_uuid}}"
expiry_days: 4
register: result
-
-- set_fact:
+- name: Set snapshot_uuid
+ ansible.builtin.set_fact:
snapshot_uuid: "{{result.snapshot_uuid}}"
-- name: snapshot create status
- assert:
+- name: Snapshot create status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -181,16 +179,14 @@
fail_msg: "Unable to create snapshot with expiry config"
success_msg: "Snapshot with expiry config created successfully"
-
-
-- name: rename snapshot
+- name: Rename snapshot
ntnx_ndb_database_snapshots:
snapshot_uuid: "{{snapshot_uuid}}"
name: "{{snapshot_name}}2-updated"
register: result
-- name: check rename status
- assert:
+- name: Check rename status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -200,16 +196,14 @@
fail_msg: "Unable to rename snapshot"
success_msg: "Snapshot renamed successfully"
-
-
-- name: update expiry
+- name: Update expiry
ntnx_ndb_database_snapshots:
snapshot_uuid: "{{snapshot_uuid}}"
expiry_days: 5
register: result
-- name: snapshot expiry update status
- assert:
+- name: Snapshot expiry update status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -219,16 +213,14 @@
fail_msg: "Unable to update snapshot expiry"
success_msg: "snapshot expiry updated successfully"
-
-
-- name: remove expiry schedule
+- name: Remove expiry schedule
ntnx_ndb_database_snapshots:
snapshot_uuid: "{{snapshot_uuid}}"
remove_expiry: true
register: result
-- name: snapshot expiry update status
- assert:
+- name: Snapshot expiry update status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -238,7 +230,6 @@
fail_msg: "Unable to remove snapshot expiry schedule"
success_msg: "snapshot expiry schedule removed successfully"
-
- name: Add expiry schedule and rename
ntnx_ndb_database_snapshots:
snapshot_uuid: "{{snapshot_uuid}}"
@@ -246,8 +237,8 @@
expiry_days: 6
register: result
-- name: snapshot update status
- assert:
+- name: Snapshot update status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -259,15 +250,14 @@
fail_msg: "Unable to add expiry schedule and rename it"
success_msg: "Snapshot updated successfully"
-
- name: Idempotency check
ntnx_ndb_database_snapshots:
snapshot_uuid: "{{snapshot_uuid}}"
expiry_days: 6
register: result
-- name: check idempotency status
- assert:
+- name: Check idempotency status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -275,90 +265,80 @@
fail_msg: "snapshot got updated"
success_msg: "snapshot update got skipped due to no state changes"
-
############################################ log catchup ######################################
-- name: create spec for log catchup
- check_mode: yes
+- name: Create spec for log catchup
+ check_mode: true
ntnx_ndb_database_log_catchup:
time_machine_uuid: "{{time_machine_uuid}}"
register: result
-- set_fact:
- expected_response: {
+- name: Set expected response
+ ansible.builtin.set_fact:
+ expected_response:
+ {
"changed": false,
"error": null,
"failed": false,
- "response": {
- "actionArguments": [
- {
- "name": "preRestoreLogCatchup",
- "value": false
- },
- {
- "name": "switch_log",
- "value": true
- }
- ],
- "forRestore": false
- }
- }
-
-
+ "response":
+ {
+ "actionArguments":
+ [
+ { "name": "preRestoreLogCatchup", "value": false },
+ { "name": "switch_log", "value": true },
+ ],
+ "forRestore": false,
+ },
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result == expected_response
fail_msg: "Unable to create log catcup spec"
success_msg: "log catchup spec created successfully"
-
-- name: create spec for log catchup for restore
- check_mode: yes
+- name: Create spec for log catchup for restore
+ check_mode: true
ntnx_ndb_database_log_catchup:
time_machine_uuid: "{{time_machine_uuid}}"
for_restore: true
register: result
-- set_fact:
- expected_response: {
+- name: Set expected response
+ ansible.builtin.set_fact:
+ expected_response:
+ {
"changed": false,
"error": null,
"failed": false,
- "response": {
- "actionArguments": [
- {
- "name": "preRestoreLogCatchup",
- "value": True
- },
- {
- "name": "switch_log",
- "value": true
- }
- ],
- "forRestore": true
- }
- }
-
+ "response":
+ {
+ "actionArguments":
+ [
+ { "name": "preRestoreLogCatchup", "value": true },
+ { "name": "switch_log", "value": true },
+ ],
+ "forRestore": true,
+ },
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result == expected_response
fail_msg: "Unable to create log catcup spec"
success_msg: "log catchup spec created successfully"
-
-- name: perform log catchup
+- name: Perform log catchup
ntnx_ndb_database_log_catchup:
time_machine_uuid: "{{time_machine_uuid}}"
for_restore: true
register: result
-- name: verify log catchup status
- assert:
+- name: Verify log catchup status
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -368,121 +348,110 @@
########################################### restore ###########################################
-- name: create restore database spec using pitr timestamp
- check_mode: yes
+- name: Create restore database spec using pitr timestamp
+ check_mode: true
ntnx_ndb_database_restore:
db_uuid: "{{db_uuid}}"
pitr_timestamp: "2023-01-02 11:02:22"
timezone: "UTC"
register: result
-- set_fact:
- expected_result: {
+- name: Set expected response
+ ansible.builtin.set_fact:
+ expected_result:
+ {
"changed": false,
"db_uuid": null,
"error": null,
"failed": false,
- "response": {
- "actionArguments": [
- {
- "name": "sameLocation",
- "value": true
- }
- ],
+ "response":
+ {
+ "actionArguments": [{ "name": "sameLocation", "value": true }],
"latestSnapshot": null,
"snapshotId": null,
"timeZone": "UTC",
- "userPitrTimestamp": "2023-01-02 11:02:22"
- }
- }
+ "userPitrTimestamp": "2023-01-02 11:02:22",
+ },
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result == expected_result
fail_msg: "Unable to create restore using pitr timestamp spec"
success_msg: "Spec for database restore using pitr timetsmap created successfully"
-
-- name: create restore database spec with latest snapshot
- check_mode: yes
+- name: Create restore database spec with latest snapshot
+ check_mode: true
ntnx_ndb_database_restore:
db_uuid: "{{db_uuid}}"
register: result
-- set_fact:
- expected_result: {
+- name: Set expected response
+ ansible.builtin.set_fact:
+ expected_result:
+ {
"changed": false,
"db_uuid": null,
"error": null,
"failed": false,
- "response": {
- "actionArguments": [
- {
- "name": "sameLocation",
- "value": true
- }
- ],
+ "response":
+ {
+ "actionArguments": [{ "name": "sameLocation", "value": true }],
"latestSnapshot": true,
"snapshotId": null,
"timeZone": null,
- "userPitrTimestamp": null
- }
- }
-
+ "userPitrTimestamp": null,
+ },
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result == expected_result
fail_msg: "Unable to create restore using latest snapshot spec"
success_msg: "Spec for database restore using latest snapshot created successfully"
-
-
-- name: create restore database spec using snapshot uuid
- check_mode: yes
+- name: Create restore database spec using snapshot uuid
+ check_mode: true
ntnx_ndb_database_restore:
db_uuid: "{{db_uuid}}"
snapshot_uuid: "{{snapshot_uuid}}"
register: result
-- set_fact:
- expected_result: {
+- name: Set expected response
+ ansible.builtin.set_fact:
+ expected_result:
+ {
"changed": false,
"db_uuid": null,
"error": null,
"failed": false,
- "response": {
- "actionArguments": [
- {
- "name": "sameLocation",
- "value": true
- }
- ],
+ "response":
+ {
+ "actionArguments": [{ "name": "sameLocation", "value": true }],
"latestSnapshot": null,
"snapshotId": "{{snapshot_uuid}}",
"timeZone": null,
- "userPitrTimestamp": null
- }
- }
+ "userPitrTimestamp": null,
+ },
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result == expected_result
fail_msg: "Unable to create restore using snapshot uuid spec"
success_msg: "Spec for database restore using snapshot uuid created successfully"
-
-- name: perform restore using latest snapshot
+- name: Perform restore using latest snapshot
ntnx_ndb_database_restore:
db_uuid: "{{db_uuid}}"
snapshot_uuid: "{{snapshot_uuid}}"
register: result
-- name: restore status
- assert:
+- name: Restore status
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -490,15 +459,14 @@
fail_msg: "Unable to restore database using latest snapshot"
success_msg: "database restored successfully using latest snapshot"
-
-- name: perform restore using snapshot uuid
+- name: Perform restore using snapshot uuid
ntnx_ndb_database_restore:
db_uuid: "{{db_uuid}}"
snapshot_uuid: "{{snapshot_uuid}}"
register: result
-- name: restore status
- assert:
+- name: Restore status
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -508,8 +476,8 @@
########################################### scaling ###########################################
-- name: create spec for scaling
- check_mode: yes
+- name: Create spec for scaling
+ check_mode: true
ntnx_ndb_database_scale:
db_uuid: "{{db_uuid}}"
storage_gb: 10
@@ -518,44 +486,35 @@
register: result
-- set_fact:
- expected_result: {
+- name: Set expected response
+ ansible.builtin.set_fact:
+ expected_result:
+ {
"changed": false,
"db_uuid": null,
"error": null,
"failed": false,
- "response": {
- "actionArguments": [
- {
- "name": "working_dir",
- "value": "/tmp"
- },
- {
- "name": "data_storage_size",
- "value": 10
- },
- {
- "name": "pre_script_cmd",
- "value": "ls"
- },
- {
- "name": "post_script_cmd",
- "value": "ls -a"
- }
- ],
- "applicationType": "postgres_database"
- }
- }
+ "response":
+ {
+ "actionArguments":
+ [
+ { "name": "working_dir", "value": "/tmp" },
+ { "name": "data_storage_size", "value": 10 },
+ { "name": "pre_script_cmd", "value": "ls" },
+ { "name": "post_script_cmd", "value": "ls -a" },
+ ],
+ "applicationType": "postgres_database",
+ },
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result == expected_result
fail_msg: "Unable to create database scaling spec"
success_msg: "Spec for database scaling with pre post commands created successfully"
-
-- name: extend database storage for scaling database
+- name: Extend database storage for scaling database
ntnx_ndb_database_scale:
db_uuid: "{{db_uuid}}"
storage_gb: 2
@@ -564,8 +523,8 @@
register: result
-- name: database scaling status
- assert:
+- name: Database scaling status
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -575,9 +534,8 @@
############################################ add / remove linked databases ###########################################
-
-- name: create databases in database instance
- check_mode: yes
+- name: Create databases in database instance
+ check_mode: true
ntnx_ndb_linked_databases:
db_instance_uuid: "{{db_uuid}}"
databases:
@@ -586,36 +544,33 @@
- test3
register: result
-- set_fact:
- expected_result: {
+- name: Set expected response
+ ansible.builtin.set_fact:
+ expected_result:
+ {
"changed": false,
"db_instance_uuid": "{{db_uuid}}",
"error": null,
"failed": false,
- "response": {
- "databases": [
- {
- "databaseName": "test1"
- },
- {
- "databaseName": "test2"
- },
- {
- "databaseName": "test3"
- }
- ]
- }
- }
+ "response":
+ {
+ "databases":
+ [
+ { "databaseName": "test1" },
+ { "databaseName": "test2" },
+ { "databaseName": "test3" },
+ ],
+ },
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result == expected_result
fail_msg: "Unable to create spec for adding databases in database instance"
success_msg: "Spec for adding databases in database instance created successfully"
-
-- name: add databases in database instance
+- name: Add databases in database instance
ntnx_ndb_linked_databases:
db_instance_uuid: "{{db_uuid}}"
databases:
@@ -625,16 +580,16 @@
# {% raw %}
-- name: create linked databases to its uuid map
- set_fact:
- linked_databases: "{{ linked_databases | default({}) | combine ({ item['name'] : item['id'] }) }}"
+- name: Create linked databases to its uuid map
+ ansible.builtin.set_fact:
+ linked_databases: "{{ linked_databases | default({}) | combine ({ item['name'] : item['id'] }) }}"
loop: "{{result.response}}"
no_log: true
# {% endraw %}
-- name: check linked database update status
- assert:
+- name: Check linked database update status
+ ansible.builtin.assert:
that:
- result.changed == true
- result.db_instance_uuid is defined
@@ -643,8 +598,7 @@
fail_msg: "Unable to add database to database instance"
success_msg: "databases added to database instance successfully"
-
-- name: remove databases in database instance
+- name: Remove databases in database instance
ntnx_ndb_linked_databases:
state: "absent"
db_instance_uuid: "{{db_uuid}}"
@@ -653,16 +607,16 @@
# {% raw %}
-- name: create linked database map
- set_fact:
- linked_databases: "{{ linked_databases | default({}) | combine ({ item['name'] : item['id'] }) }}"
+- name: Create linked database map
+ ansible.builtin.set_fact:
+ linked_databases: "{{ linked_databases | default({}) | combine ({ item['name'] : item['id'] }) }}"
loop: "{{result.response}}"
no_log: true
# {% endraw %}
-- name: check linked database update status
- assert:
+- name: Check linked database update status
+ ansible.builtin.assert:
that:
- result.changed == true
- result.db_instance_uuid is defined
@@ -670,20 +624,18 @@
fail_msg: "Unable to remove database from database instance"
success_msg: "linked database from database instance removed successfully"
-
############################################ cleanup ###########################################
-
-- name: delete database created earlier
+- name: Delete database created earlier
ntnx_ndb_databases:
state: "absent"
db_uuid: "{{db_uuid}}"
delete_db_server_vms: true
- delete_time_machine: True
+ delete_time_machine: true
register: result
-- name: verify status of delete of database along with time machine and db server vm delete
- assert:
+- name: Verify status of delete of database along with time machine and db server vm delete
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
diff --git a/tests/integration/targets/ntnx_ndb_databases_actions/tasks/main.yml b/tests/integration/targets/ntnx_ndb_databases_actions/tasks/main.yml
index 3525a5c66..f2df84e53 100644
--- a/tests/integration/targets/ntnx_ndb_databases_actions/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_databases_actions/tasks/main.yml
@@ -1,10 +1,12 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ndb_ip }}"
- nutanix_username: "{{ ndb_username }}"
- nutanix_password: "{{ ndb_password }}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ndb_ip }}"
+ nutanix_username: "{{ ndb_username }}"
+ nutanix_password: "{{ ndb_password }}"
+ validate_certs: false
block:
- - import_tasks: "all_actions.yml"
+ - name: Import "all_actions.yml"
+ ansible.builtin.import_tasks: "all_actions.yml"
diff --git a/tests/integration/targets/ntnx_ndb_databases_sanity/tasks/main.yml b/tests/integration/targets/ntnx_ndb_databases_sanity/tasks/main.yml
index d09f77ab1..4edb4f424 100644
--- a/tests/integration/targets/ntnx_ndb_databases_sanity/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_databases_sanity/tasks/main.yml
@@ -1,10 +1,12 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ndb_ip }}"
- nutanix_username: "{{ ndb_username }}"
- nutanix_password: "{{ ndb_password }}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ndb_ip }}"
+ nutanix_username: "{{ ndb_username }}"
+ nutanix_password: "{{ ndb_password }}"
+ validate_certs: false
block:
- - import_tasks: "tests.yml"
+ - name: Import "tests.yml"
+ ansible.builtin.import_tasks: "tests.yml"
diff --git a/tests/integration/targets/ntnx_ndb_databases_sanity/tasks/tests.yml b/tests/integration/targets/ntnx_ndb_databases_sanity/tasks/tests.yml
index 26cc67f06..0829ae360 100644
--- a/tests/integration/targets/ntnx_ndb_databases_sanity/tasks/tests.yml
+++ b/tests/integration/targets/ntnx_ndb_databases_sanity/tasks/tests.yml
@@ -2,24 +2,24 @@
# Summary:
# This playbook will test basic database flows
-
-- debug:
+- name: Start testing ntnx_ndb_databases_sanity
+ ansible.builtin.debug:
msg: "start ndb databases crud tests"
- name: Generate random name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- set_fact:
+- name: Set variables
+ ansible.builtin.set_fact:
db1_name: "{{random_name[0]}}"
db1_name_updated: "{{random_name[0]}}-updated"
vm1_name: "{{random_name[0]}}-vm"
################################### Single instance postgres database tests #############################
-
-- name: create spec for single instance postgres database on new db server vm
- check_mode: yes
+- name: Create spec for single instance postgres database on new db server vm
+ check_mode: true
ntnx_ndb_databases:
wait: true
name: "{{db1_name}}"
@@ -66,7 +66,7 @@
quaterly: JANUARY
log_catchup: 30
snapshots_per_day: 2
- auto_tune_staging_drive: False
+ auto_tune_staging_drive: false
tags:
databases: "single-instance-dbs"
@@ -82,114 +82,78 @@
post_task_cmd: "ls -F"
register: result
-- set_fact:
- expected_action_arguments: [
+- name: Set expected action arguments
+ ansible.builtin.set_fact:
+ expected_action_arguments:
+ [
+ { "name": "dbserver_description", "value": "vm for db server" },
+ { "name": "listener_port", "value": "9999" },
+ { "name": "auto_tune_staging_drive", "value": false },
+ { "name": "allocate_pg_hugepage", "value": true },
+ { "name": "cluster_database", "value": false },
+ { "name": "auth_method", "value": "md5" },
+ {
+ "name": "db_password",
+ "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
+ },
+ { "name": "pre_create_script", "value": "ls" },
+ { "name": "post_create_script", "value": "ls -a" },
+ { "name": "database_names", "value": "testAnsible" },
+ { "name": "database_size", "value": "200" },
+ ]
+
+- name: Set expected time machine info
+ ansible.builtin.set_fact:
+ expected_time_machine_info:
+ {
+ "autoTuneLogDrive": true,
+ "description": "TM-desc",
+ "name": "TM1",
+ "schedule":
+ {
+ "continuousSchedule":
+ {
+ "enabled": true,
+ "logBackupInterval": 30,
+ "snapshotsPerDay": 2,
+ },
+ "monthlySchedule": { "dayOfMonth": 4, "enabled": true },
+ "quartelySchedule":
+ { "dayOfMonth": 4, "enabled": true, "startMonth": "JANUARY" },
+ "snapshotTimeOfDay": { "hours": 11, "minutes": 10, "seconds": 2 },
+ "weeklySchedule": { "dayOfWeek": "WEDNESDAY", "enabled": true },
+ },
+ "slaId": "{{sla.uuid}}",
+ }
+
+- name: Set maintenance tasks
+ ansible.builtin.set_fact:
+ mainetance_tasks:
+ {
+ "maintenanceWindowId": "{{maintenance.window_uuid}}",
+ "tasks":
+ [
+ {
+ "payload":
{
- "name": "dbserver_description",
- "value": "vm for db server"
+ "prePostCommand":
+ { "postCommand": "ls -a", "preCommand": "ls" },
},
+ "taskType": "OS_PATCHING",
+ },
+ {
+ "payload":
{
- "name": "listener_port",
- "value": "9999"
+ "prePostCommand":
+ { "postCommand": "ls -F", "preCommand": "ls -l" },
},
- {
- "name": "auto_tune_staging_drive",
- "value": false
- },
- {
- "name": "allocate_pg_hugepage",
- "value": True
- },
- {
- "name": "cluster_database",
- "value": false
- },
- {
- "name": "auth_method",
- "value": "md5"
- },
- {
- "name": "db_password",
- "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
- },
- {
- "name": "pre_create_script",
- "value": "ls"
- },
- {
- "name": "post_create_script",
- "value": "ls -a"
- },
- {
- "name": "database_names",
- "value": "testAnsible"
- },
- {
- "name": "database_size",
- "value": "200"
- }
- ]
-
-- set_fact:
- expected_time_machine_info: {
- "autoTuneLogDrive": true,
- "description": "TM-desc",
- "name": "TM1",
- "schedule": {
- "continuousSchedule": {
- "enabled": true,
- "logBackupInterval": 30,
- "snapshotsPerDay": 2
- },
- "monthlySchedule": {
- "dayOfMonth": 4,
- "enabled": true
- },
- "quartelySchedule": {
- "dayOfMonth": 4,
- "enabled": true,
- "startMonth": "JANUARY"
- },
- "snapshotTimeOfDay": {
- "hours": 11,
- "minutes": 10,
- "seconds": 2
- },
- "weeklySchedule": {
- "dayOfWeek": "WEDNESDAY",
- "enabled": true
- }
- },
- "slaId": "{{sla.uuid}}"
- }
-
-- set_fact:
- mainetance_tasks: {
- "maintenanceWindowId": "{{maintenance.window_uuid}}",
- "tasks": [
- {
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -a",
- "preCommand": "ls"
- }
- },
- "taskType": "OS_PATCHING"
- },
- {
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -F",
- "preCommand": "ls -l"
- }
- },
- "taskType": "DB_PATCHING"
- }
- ]
- }
+ "taskType": "DB_PATCHING",
+ },
+ ],
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -210,9 +174,7 @@
fail_msg: "Unable to create single instance postgres database provision spec"
success_msg: "single instance postgres database provision spec created successfully"
-
-
-- name: create single instance postgres database on new db server vm
+- name: Create single instance postgres database on new db server vm
ntnx_ndb_databases:
wait: true
name: "{{db1_name}}"
@@ -271,25 +233,26 @@
post_task_cmd: "ls -F"
register: result
-- set_fact:
+- name: Set db uuid
+ ansible.builtin.set_fact:
db_uuid: "{{result.db_uuid}}"
- name: Ensure properties is defined
- set_fact:
+ ansible.builtin.set_fact:
properties: {}
when: properties is undefined
# skip jekyll/Liquid syntax check
#
-- name: create properties map
- set_fact:
- properties: "{{ properties | combine ({ item['name'] : item['value'] }) }}"
+- name: Create properties map
+ ansible.builtin.set_fact:
+ properties: "{{ properties | combine ({ item['name'] : item['value'] }) }}"
loop: "{{result.response.properties}}"
no_log: true
#
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'READY'
@@ -304,22 +267,23 @@
- properties["auth"] == "md5"
- result.response.databaseNodes[0].status == "READY"
- result.response.tags | length == 1
- - result.response.tags[0].tagName == "{{tags.databases.name}}"
+ - result.response.tags[0].tagName == "{{entity_tags.databases.name}}"
- result.response.tags[0].value == "single-instance-dbs"
fail_msg: "Unable to create single instance postgres database"
success_msg: "single instance postgres database created successfully"
-- set_fact:
+- name: Set db server uuid
+ ansible.builtin.set_fact:
db_server_uuid: "{{result.response.databaseNodes[0].dbserverId}}"
-- name: get vm details associated to the database instance created above and verify
+- name: Get vm details associated to the database instance created above and verify
ntnx_ndb_db_servers_info:
uuid: "{{db_server_uuid}}"
register: result
- name: Verify DB server VM status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'UP'
@@ -332,9 +296,8 @@
################################### update tests #############################
-
-- name: update database with check mode
- check_mode: yes
+- name: Update database with check mode
+ check_mode: true
ntnx_ndb_databases:
wait: true
db_uuid: "{{db_uuid}}"
@@ -345,8 +308,8 @@
databases: "single-instance-dbs-updated"
register: result
-- name: check mode status
- assert:
+- name: Check mode status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -356,7 +319,7 @@
fail_msg: "Unable to create single instance postgres database update spec"
success_msg: "single instance postgres database update spec generated successfully"
-- name: update database
+- name: Update database
ntnx_ndb_databases:
wait: true
db_uuid: "{{db_uuid}}"
@@ -367,8 +330,8 @@
databases: "single-instance-dbs-updated"
register: result
-- name: update status
- assert:
+- name: Update status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'READY'
@@ -377,15 +340,13 @@
- result.response.name == db1_name_updated
- result.response.description == "ansible-created-db-desc-updated"
- result.response.tags | length == 1
- - result.response.tags[0].tagName == "{{tags.databases.name}}"
+ - result.response.tags[0].tagName == "{{entity_tags.databases.name}}"
- result.response.tags[0].value == "single-instance-dbs-updated"
-
fail_msg: "Unable to update single instance postgres database"
success_msg: "single instance postgres database updated successfully"
-
-- name: idempotency checks
+- name: Idempotency checks
ntnx_ndb_databases:
wait: true
db_uuid: "{{db_uuid}}"
@@ -396,8 +357,8 @@
databases: "single-instance-dbs-updated"
register: result
-- name: check idempotency status
- assert:
+- name: Check idempotency status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -407,8 +368,8 @@
################################### delete tests #############################
-- name: create spec for delete db from vm
- check_mode: yes
+- name: Create spec for delete db from vm
+ check_mode: true
ntnx_ndb_databases:
state: "absent"
db_uuid: "{{db_uuid}}"
@@ -416,8 +377,8 @@
delete_db_from_vm: true
register: result
-- name: verify delete check mode spec
- assert:
+- name: Verify delete check mode spec
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -427,10 +388,8 @@
fail_msg: "creation of spec for delete db from vm failed"
success_msg: "spec for delete db from vm created successfully"
-
-
-- name: create spec for soft remove
- check_mode: yes
+- name: Create spec for soft remove
+ check_mode: true
ntnx_ndb_databases:
state: "absent"
db_uuid: "{{db_uuid}}"
@@ -439,8 +398,8 @@
delete_time_machine: true
register: result
-- name: verify soft remove check mode spec
- assert:
+- name: Verify soft remove check mode spec
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -451,10 +410,10 @@
fail_msg: "creation of spec for soft remove with time machine delete failed"
success_msg: "spec for soft remove with time machine delete created successfully"
+##################################### INFO Module tests #######################################################
-#####################################INFO Module tests#######################################################
-
-- debug:
+- name: Start testing ntnx_ndb_databases_info
+ ansible.builtin.debug:
msg: Start testing ntnx_ndb_databases_info based on created database
- name: List ndb databases
@@ -462,8 +421,8 @@
register: databases
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- databases.response is defined
- databases.failed == false
@@ -478,8 +437,8 @@
register: result
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -494,8 +453,8 @@
register: result
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -508,13 +467,13 @@
- name: Get era databases using its id and detailed response
ntnx_ndb_databases_info:
filters:
- detailed: True
+ detailed: true
uuid: "{{databases.response[0].id}}"
register: result
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -525,18 +484,17 @@
fail_msg: "Unable to Get era databases using its id"
success_msg: "Get era databases using its id finished successfully"
-
################################################################
-- name: get era database with incorrect name
+- name: Get era database with incorrect name
ntnx_ndb_databases_info:
name: "xxxxxxx"
register: result
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.error is defined
- result.failed == true
@@ -546,8 +504,7 @@
############################################################################################
-
-- name: unregister db along with delete time machine
+- name: Unregister db along with delete time machine
ntnx_ndb_databases:
db_uuid: "{{db_uuid}}"
state: "absent"
@@ -555,8 +512,8 @@
delete_time_machine: true
register: result
-- name: verify status of delete of database along with time machine delete
- assert:
+- name: Verify status of delete of database along with time machine delete
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -564,19 +521,18 @@
fail_msg: "database delete failed"
success_msg: "database deleted successfully"
-
-- name: delete db server vm
+- name: Delete db server vm
ntnx_ndb_db_server_vms:
state: "absent"
- wait: True
+ wait: true
uuid: "{{db_server_uuid}}"
- delete_from_cluster: True
- delete_vgs: True
- delete_vm_snapshots: True
+ delete_from_cluster: true
+ delete_vgs: true
+ delete_vm_snapshots: true
register: result
-- name: check delete status
- assert:
+- name: Check delete status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
diff --git a/tests/integration/targets/ntnx_ndb_databases_single_instance_1/tasks/main.yml b/tests/integration/targets/ntnx_ndb_databases_single_instance_1/tasks/main.yml
index d09f77ab1..4edb4f424 100644
--- a/tests/integration/targets/ntnx_ndb_databases_single_instance_1/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_databases_single_instance_1/tasks/main.yml
@@ -1,10 +1,12 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ndb_ip }}"
- nutanix_username: "{{ ndb_username }}"
- nutanix_password: "{{ ndb_password }}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ndb_ip }}"
+ nutanix_username: "{{ ndb_username }}"
+ nutanix_password: "{{ ndb_password }}"
+ validate_certs: false
block:
- - import_tasks: "tests.yml"
+ - name: Import "tests.yml"
+ ansible.builtin.import_tasks: "tests.yml"
diff --git a/tests/integration/targets/ntnx_ndb_databases_single_instance_1/tasks/tests.yml b/tests/integration/targets/ntnx_ndb_databases_single_instance_1/tasks/tests.yml
index 73de26640..869019bb0 100644
--- a/tests/integration/targets/ntnx_ndb_databases_single_instance_1/tasks/tests.yml
+++ b/tests/integration/targets/ntnx_ndb_databases_single_instance_1/tasks/tests.yml
@@ -6,23 +6,24 @@
# 3. Unregister database instance
# 4. Register the database created in point 1 from the db server vm created earlier
-- debug:
+- name: Start ndb databases test flow 1
+ ansible.builtin.debug:
msg: "start ndb databases test flow 1"
- name: Generate random name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- set_fact:
+- name: Set variables
+ ansible.builtin.set_fact:
db1_name: "{{random_name[0]}}"
db1_name_updated: "{{random_name[0]}}-updated"
vm1_name: "{{random_name[0]}}-vm"
################################### Single instance postgres database tests #############################
-
-- name: create spec for single instance postgres database on new db server vm
- check_mode: yes
+- name: Create spec for single instance postgres database on new db server vm
+ check_mode: true
ntnx_ndb_databases:
wait: true
name: "{{db1_name}}"
@@ -69,7 +70,7 @@
quaterly: JANUARY
log_catchup: 30
snapshots_per_day: 2
- auto_tune_staging_drive: False
+ auto_tune_staging_drive: false
tags:
ansible-databases: "single-instance-dbs"
@@ -85,114 +86,78 @@
post_task_cmd: "ls -F"
register: result
-- set_fact:
- expected_action_arguments: [
- {
- "name": "dbserver_description",
- "value": "vm for db server"
- },
- {
- "name": "listener_port",
- "value": "9999"
- },
- {
- "name": "auto_tune_staging_drive",
- "value": false
- },
- {
- "name": "allocate_pg_hugepage",
- "value": True
- },
- {
- "name": "cluster_database",
- "value": false
- },
+- name: Set expected action arguments
+ ansible.builtin.set_fact:
+ expected_action_arguments:
+ [
+ { "name": "dbserver_description", "value": "vm for db server" },
+ { "name": "listener_port", "value": "9999" },
+ { "name": "auto_tune_staging_drive", "value": false },
+ { "name": "allocate_pg_hugepage", "value": true },
+ { "name": "cluster_database", "value": false },
+ { "name": "auth_method", "value": "md5" },
+ {
+ "name": "db_password",
+ "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
+ },
+ { "name": "pre_create_script", "value": "ls" },
+ { "name": "post_create_script", "value": "ls -a" },
+ { "name": "database_names", "value": "testAnsible" },
+ { "name": "database_size", "value": "200" },
+ ]
+
+- name: Set expected time machine info
+ ansible.builtin.set_fact:
+ expected_time_machine_info:
+ {
+ "autoTuneLogDrive": true,
+ "description": "TM-desc",
+ "name": "TM1",
+ "schedule":
+ {
+ "continuousSchedule":
+ {
+ "enabled": true,
+ "logBackupInterval": 30,
+ "snapshotsPerDay": 2,
+ },
+ "monthlySchedule": { "dayOfMonth": 4, "enabled": true },
+ "quartelySchedule":
+ { "dayOfMonth": 4, "enabled": true, "startMonth": "JANUARY" },
+ "snapshotTimeOfDay": { "hours": 11, "minutes": 10, "seconds": 2 },
+ "weeklySchedule": { "dayOfWeek": "WEDNESDAY", "enabled": true },
+ },
+ "slaId": "{{sla.uuid}}",
+ }
+
+- name: Set maintenance tasks
+ ansible.builtin.set_fact:
+ mainetance_tasks:
+ {
+ "maintenanceWindowId": "{{maintenance.window_uuid}}",
+ "tasks":
+ [
+ {
+ "payload":
{
- "name": "auth_method",
- "value": "md5"
+ "prePostCommand":
+ { "postCommand": "ls -a", "preCommand": "ls" },
},
+ "taskType": "OS_PATCHING",
+ },
+ {
+ "payload":
{
- "name": "db_password",
- "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
+ "prePostCommand":
+ { "postCommand": "ls -F", "preCommand": "ls -l" },
},
- {
- "name": "pre_create_script",
- "value": "ls"
- },
- {
- "name": "post_create_script",
- "value": "ls -a"
- },
- {
- "name": "database_names",
- "value": "testAnsible"
- },
- {
- "name": "database_size",
- "value": "200"
- }
- ]
-
-- set_fact:
- expected_time_machine_info: {
- "autoTuneLogDrive": true,
- "description": "TM-desc",
- "name": "TM1",
- "schedule": {
- "continuousSchedule": {
- "enabled": true,
- "logBackupInterval": 30,
- "snapshotsPerDay": 2
- },
- "monthlySchedule": {
- "dayOfMonth": 4,
- "enabled": true
- },
- "quartelySchedule": {
- "dayOfMonth": 4,
- "enabled": true,
- "startMonth": "JANUARY"
- },
- "snapshotTimeOfDay": {
- "hours": 11,
- "minutes": 10,
- "seconds": 2
- },
- "weeklySchedule": {
- "dayOfWeek": "WEDNESDAY",
- "enabled": true
- }
- },
- "slaId": "{{sla.uuid}}"
- }
-
-- set_fact:
- mainetance_tasks: {
- "maintenanceWindowId": "{{maintenance.window_uuid}}",
- "tasks": [
- {
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -a",
- "preCommand": "ls"
- }
- },
- "taskType": "OS_PATCHING"
- },
- {
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -F",
- "preCommand": "ls -l"
- }
- },
- "taskType": "DB_PATCHING"
- }
- ]
- }
+ "taskType": "DB_PATCHING",
+ },
+ ],
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -213,9 +178,7 @@
fail_msg: "Unable to create single instance postgres database provision spec"
success_msg: "single instance postgres database provision spec created successfully"
-
-
-- name: create single instance postgres database on new db server vm
+- name: Create single instance postgres database on new db server vm
ntnx_ndb_databases:
wait: true
name: "{{db1_name}}"
@@ -274,20 +237,21 @@
post_task_cmd: "ls -F"
register: result
-- set_fact:
+- name: Set db uuid
+ ansible.builtin.set_fact:
db_uuid: "{{result.db_uuid}}"
# skip jekyll/Liquid syntax check
# {% raw %}
-- name: create properties map
- set_fact:
- properties: "{{ properties | default({}) | combine ({ item['name'] : item['value'] }) }}"
+- name: Create properties map
+ ansible.builtin.set_fact:
+ properties: "{{ properties | default({}) | combine ({ item['name'] : item['value'] }) }}"
loop: "{{result.response.properties}}"
no_log: true
# {% endraw %}
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'READY'
@@ -302,22 +266,23 @@
- properties["auth"] == "md5"
- result.response.databaseNodes[0].status == "READY"
- result.response.tags | length == 1
- - result.response.tags[0].tagName == "{{tags.databases.name}}"
+ - result.response.tags[0].tagName == "{{entity_tags.databases.name}}"
- result.response.tags[0].value == "single-instance-dbs"
fail_msg: "Unable to create single instance postgres database"
success_msg: "single instance postgres database created successfully"
-- set_fact:
+- name: Set db server uuid
+ ansible.builtin.set_fact:
db_server_uuid: "{{result.response.databaseNodes[0].dbserverId}}"
-- name: get vm details associated to the database instance created above and verify
+- name: Get vm details associated to the database instance created above and verify
ntnx_ndb_db_servers_info:
uuid: "{{db_server_uuid}}"
register: result
- name: Verify DB server VM status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'UP'
@@ -330,9 +295,8 @@
################################### update tests #############################
-
-- name: update database with check mode
- check_mode: yes
+- name: Update database with check mode
+ check_mode: true
ntnx_ndb_databases:
wait: true
db_uuid: "{{db_uuid}}"
@@ -343,8 +307,8 @@
ansible-databases: "single-instance-dbs-updated"
register: result
-- name: check mode status
- assert:
+- name: Check mode status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -354,7 +318,7 @@
fail_msg: "Unable to create single instance postgres database update spec"
success_msg: "single instance postgres database update spec generated successfully"
-- name: update database
+- name: Update database
ntnx_ndb_databases:
wait: true
db_uuid: "{{db_uuid}}"
@@ -365,8 +329,8 @@
ansible-databases: "single-instance-dbs-updated"
register: result
-- name: update status
- assert:
+- name: Update status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'READY'
@@ -375,15 +339,13 @@
- result.response.name == db1_name_updated
- result.response.description == "ansible-created-db-desc-updated"
- result.response.tags | length == 1
- - result.response.tags[0].tagName == "{{tags.databases.name}}"
+ - result.response.tags[0].tagName == "{{entity_tags.databases.name}}"
- result.response.tags[0].value == "single-instance-dbs-updated"
-
fail_msg: "Unable to update single instance postgres database"
success_msg: "single instance postgres database updated successfully"
-
-- name: idempotency checks
+- name: Idempotency checks
ntnx_ndb_databases:
wait: true
db_uuid: "{{db_uuid}}"
@@ -394,8 +356,8 @@
ansible-databases: "single-instance-dbs-updated"
register: result
-- name: check idempotency status
- assert:
+- name: Check idempotency status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -405,8 +367,8 @@
################################### delete tests #############################
-- name: create spec for delete db from vm
- check_mode: yes
+- name: Create spec for delete db from vm
+ check_mode: true
ntnx_ndb_databases:
state: "absent"
db_uuid: "{{db_uuid}}"
@@ -414,8 +376,8 @@
delete_db_from_vm: true
register: result
-- name: verify delete check mode spec
- assert:
+- name: Verify delete check mode spec
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -425,10 +387,8 @@
fail_msg: "creation of spec for delete db from vm failed"
success_msg: "spec for delete db from vm created successfully"
-
-
-- name: create spec for soft remove
- check_mode: yes
+- name: Create spec for soft remove
+ check_mode: true
ntnx_ndb_databases:
state: "absent"
db_uuid: "{{db_uuid}}"
@@ -437,8 +397,8 @@
delete_time_machine: true
register: result
-- name: verify soft remove check mode spec
- assert:
+- name: Verify soft remove check mode spec
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -449,8 +409,7 @@
fail_msg: "creation of spec for soft remove with time machine delete failed"
success_msg: "spec for soft remove with time machine delete created successfully"
-
-- name: unregister db along with delete time machine
+- name: Unregister db along with delete time machine
ntnx_ndb_databases:
state: "absent"
db_uuid: "{{db_uuid}}"
@@ -458,8 +417,8 @@
delete_time_machine: true
register: result
-- name: verify status of unregister of database with time machine delete
- assert:
+- name: Verify status of unregister of database with time machine delete
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -469,15 +428,14 @@
################################### single instance postgres database registration tests #############################
-
-- name: create spec for registering previously unregistered database from previously created VM's ip
- check_mode: yes
+- name: Create spec for registering previously unregistered database from previously created VM's ip
+ check_mode: true
ntnx_ndb_register_database:
wait: true
name: "{{db1_name}}"
desc: "ansible-created-db-desc"
- auto_tune_staging_drive: False
+ auto_tune_staging_drive: false
db_vm:
registered:
ip: "10.10.10.10"
@@ -518,90 +476,75 @@
register: result
-- set_fact:
- expected_action_arguments: [
- {
- "name": "listener_port",
- "value": "9999"
- },
+- name: Set expected action arguments
+ ansible.builtin.set_fact:
+ expected_action_arguments:
+ [
+ { "name": "listener_port", "value": "9999" },
+ { "name": "db_name", "value": "testAnsible1" },
+ { "name": "db_user", "value": "postgres" },
+ {
+ "name": "db_password",
+ "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
+ },
+ {
+ "name": "postgres_software_home",
+ "value": "{{postgres.software_home}}",
+ },
+ ]
+
+- name: Set expected time machine info
+ ansible.builtin.set_fact:
+ expected_time_machine_info:
+ {
+ "autoTuneLogDrive": true,
+ "description": "TM-desc",
+ "name": "TM1",
+ "schedule":
+ {
+ "continuousSchedule":
+ {
+ "enabled": true,
+ "logBackupInterval": 30,
+ "snapshotsPerDay": 2,
+ },
+ "monthlySchedule": { "dayOfMonth": 4, "enabled": true },
+ "quartelySchedule":
+ { "dayOfMonth": 4, "enabled": true, "startMonth": "JANUARY" },
+ "snapshotTimeOfDay": { "hours": 11, "minutes": 10, "seconds": 2 },
+ "weeklySchedule": { "dayOfWeek": "WEDNESDAY", "enabled": true },
+ },
+ "slaId": "{{sla.uuid}}",
+ }
+
+- name: Set maintenance tasks
+ ansible.builtin.set_fact:
+ mainetance_tasks:
+ {
+ "maintenanceWindowId": "{{maintenance.window_uuid}}",
+ "tasks":
+ [
+ {
+ "payload":
{
- "name": "db_name",
- "value": "testAnsible1"
+ "prePostCommand":
+ { "postCommand": "ls -a", "preCommand": "ls" },
},
+ "taskType": "OS_PATCHING",
+ },
+ {
+ "payload":
{
- "name": "db_user",
- "value": "postgres"
+ "prePostCommand":
+ { "postCommand": "ls -F", "preCommand": "ls -l" },
},
- {
- "name": "db_password",
- "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
- },
- {
- "name": "postgres_software_home",
- "value": "{{postgres.software_home}}"
- }
- ]
-
-- set_fact:
- expected_time_machine_info: {
- "autoTuneLogDrive": true,
- "description": "TM-desc",
- "name": "TM1",
- "schedule": {
- "continuousSchedule": {
- "enabled": true,
- "logBackupInterval": 30,
- "snapshotsPerDay": 2
- },
- "monthlySchedule": {
- "dayOfMonth": 4,
- "enabled": true
- },
- "quartelySchedule": {
- "dayOfMonth": 4,
- "enabled": true,
- "startMonth": "JANUARY"
- },
- "snapshotTimeOfDay": {
- "hours": 11,
- "minutes": 10,
- "seconds": 2
- },
- "weeklySchedule": {
- "dayOfWeek": "WEDNESDAY",
- "enabled": true
- }
- },
- "slaId": "{{sla.uuid}}"
- }
-
-- set_fact:
- mainetance_tasks: {
- "maintenanceWindowId": "{{maintenance.window_uuid}}",
- "tasks": [
- {
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -a",
- "preCommand": "ls"
- }
- },
- "taskType": "OS_PATCHING"
- },
- {
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -F",
- "preCommand": "ls -l"
- }
- },
- "taskType": "DB_PATCHING"
- }
- ]
- }
+ "taskType": "DB_PATCHING",
+ },
+ ],
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -617,8 +560,7 @@
fail_msg: "Unable to create register database spec"
success_msg: "single instance postgres database register spec created successfully"
-
-- name: register previously unregistered database from previously created VM
+- name: Register previously unregistered database from previously created VM
ntnx_ndb_register_database:
wait: true
@@ -665,15 +607,15 @@
# skip jekyll/Liquid syntax check
# {% raw %}
-- name: create properties map
- set_fact:
+- name: Create properties map
+ ansible.builtin.set_fact:
properties: "{{ properties | default({}) | combine ({ item['name'] : item['value'] }) }}"
loop: "{{result.response.properties}}"
no_log: true
# {% endraw %}
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'READY'
@@ -688,18 +630,19 @@
- result.response.databaseNodes[0].dbserverId == db_server_uuid
- result.response.type == "postgres_database"
- result.response.tags | length == 1
- - result.response.tags[0].tagName == "{{tags.databases.name}}"
+ - result.response.tags[0].tagName == "{{entity_tags.databases.name}}"
- result.response.tags[0].value == "single-instance-dbs"
fail_msg: "Unable to register single instance postgres database"
success_msg: "single instance postgres database registered successfully"
-
-- set_fact:
+- name: Set db uuid
+ ansible.builtin.set_fact:
db_uuid: "{{result.db_uuid}}"
-#####################################INFO Module tests#######################################################
+##################################### INFO Module tests #######################################################
-- debug:
+- name: Start testing ntnx_ndb_databases_info based on created database
+ ansible.builtin.debug:
msg: Start testing ntnx_ndb_databases_info based on created database
- name: List ndb databases
@@ -707,8 +650,8 @@
register: databases
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- databases.response is defined
- databases.failed == false
@@ -723,8 +666,8 @@
register: result
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -739,8 +682,8 @@
register: result
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -753,13 +696,13 @@
- name: Get era databases using its id and detailed response
ntnx_ndb_databases_info:
filters:
- detailed: True
+ detailed: true
uuid: "{{databases.response[0].id}}"
register: result
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -770,18 +713,17 @@
fail_msg: "Unable to Get era databases using its id"
success_msg: "Get era databases using its id finished successfully"
-
################################################################
-- name: get era database with incorrect name
+- name: Get era database with incorrect name
ntnx_ndb_databases_info:
name: "xxxxxxx"
register: result
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.error is defined
- result.failed == true
@@ -791,8 +733,7 @@
############################################################################################
-
-- name: unregister db along with delete time machine
+- name: Unregister db along with delete time machine
ntnx_ndb_databases:
db_uuid: "{{db_uuid}}"
state: "absent"
@@ -800,8 +741,8 @@
delete_time_machine: true
register: result
-- name: verify status of delete of database along with time machine delete
- assert:
+- name: Verify status of delete of database along with time machine delete
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -809,19 +750,18 @@
fail_msg: "database delete failed"
success_msg: "database deleted successfully"
-
-- name: delete db server vm
+- name: Delete db server vm
ntnx_ndb_db_server_vms:
state: "absent"
- wait: True
+ wait: true
uuid: "{{db_server_uuid}}"
- delete_from_cluster: True
- delete_vgs: True
- delete_vm_snapshots: True
+ delete_from_cluster: true
+ delete_vgs: true
+ delete_vm_snapshots: true
register: result
-- name: check delete status
- assert:
+- name: Check delete status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
diff --git a/tests/integration/targets/ntnx_ndb_databases_single_instance_2/tasks/main.yml b/tests/integration/targets/ntnx_ndb_databases_single_instance_2/tasks/main.yml
index d09f77ab1..4064ce5a2 100644
--- a/tests/integration/targets/ntnx_ndb_databases_single_instance_2/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_databases_single_instance_2/tasks/main.yml
@@ -1,10 +1,12 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ndb_ip }}"
- nutanix_username: "{{ ndb_username }}"
- nutanix_password: "{{ ndb_password }}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ndb_ip }}"
+ nutanix_username: "{{ ndb_username }}"
+ nutanix_password: "{{ ndb_password }}"
+ validate_certs: false
block:
- - import_tasks: "tests.yml"
+ - name: Import "tests.yml"
+ ansible.builtin.import_taskstin.import_tasks: "tests.yml"
diff --git a/tests/integration/targets/ntnx_ndb_databases_single_instance_2/tasks/tests.yml b/tests/integration/targets/ntnx_ndb_databases_single_instance_2/tasks/tests.yml
index f213c1b8d..8221612b2 100644
--- a/tests/integration/targets/ntnx_ndb_databases_single_instance_2/tasks/tests.yml
+++ b/tests/integration/targets/ntnx_ndb_databases_single_instance_2/tasks/tests.yml
@@ -6,21 +6,23 @@
# 3. Unregister database instance (db1) and db server vm (vm1)
# 4. Register db1 from unregistered vm1
-- debug:
+- name: Start ndb databases test flow 2
+ ansible.builtin.debug:
msg: "start ndb databases test flow 2"
- name: Generate random name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- set_fact:
+- name: Set variables
+ ansible.builtin.set_fact:
db1_name: "{{random_name[0]}}"
db1_name_updated: "{{random_name[0]}}-updated"
vm1_name: "{{random_name[0]}}-vm"
-- name: create db server vm using software profile
+- name: Create db server vm using software profile
ntnx_ndb_db_server_vms:
- wait: True
+ wait: true
name: "{{ vm1_name }}"
desc: "ansible-created-vm1-desc"
software_profile:
@@ -38,7 +40,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'UP'
@@ -47,14 +49,15 @@
fail_msg: "Unable to create db server vm using software profile"
success_msg: "DB server VM created successfully"
-- set_fact:
+- name: Set db server uuid
+ ansible.builtin.set_fact:
db_server_uuid: "{{ result.uuid }}"
-- set_fact:
+- name: Set vm ip address
+ ansible.builtin.set_fact:
_vm_ip: "{{ result.response.ipAddresses[0] }}"
-
-- name: create new single instance postgres database on vm created earlier
+- name: Create new single instance postgres database on vm created earlier
ntnx_ndb_databases:
wait: true
name: "{{db1_name}}"
@@ -89,21 +92,22 @@
ansible-databases: "single-instance-dbs"
register: result
-- set_fact:
+- name: Set db uuid
+ ansible.builtin.set_fact:
db_uuid: "{{result.db_uuid}}"
# skip jekyll/Liquid syntax check
# {% raw %}
-- name: create properties map
- set_fact:
- properties: "{{ properties | default({}) | combine ({ item['name'] : item['value'] }) }}"
+- name: Create properties map
+ ansible.builtin.set_fact:
+ properties: "{{ properties | default({}) | combine ({ item['name'] : item['value'] }) }}"
loop: "{{result.response.properties}}"
no_log: true
# {% endraw %}
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'READY'
@@ -117,7 +121,7 @@
- result.response.databaseNodes[0].status == "READY"
- result.response.databaseNodes[0].dbserverId == db_server_uuid
- result.response.tags | length == 1
- - result.response.tags[0].tagName == "{{tags.databases.name}}"
+ - result.response.tags[0].tagName == "{{entity_tags.databases.name}}"
- result.response.tags[0].value == "single-instance-dbs"
- result.response.timeMachine is defined
- result.response.timeMachine.name == "TM1"
@@ -128,18 +132,17 @@
fail_msg: "Unable to create single instance postgres database"
success_msg: "single instance postgres database created successfully"
-
-- name: unregister db along with delete time machine and unregister db servr vm
+- name: Unregister db along with delete time machine and unregister db servr vm
ntnx_ndb_databases:
state: "absent"
db_uuid: "{{db_uuid}}"
wait: true
delete_time_machine: true
- unregister_db_server_vms: True
+ unregister_db_server_vms: true
register: result
-- name: verify status of unregister of database with time machine delete
- assert:
+- name: Verify status of unregister of database with time machine delete
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -148,9 +151,8 @@
fail_msg: "database unregistration failed"
success_msg: "database unregistered successfully"
-
-- name: create spec for registering previously unregistered DB from previously unregistered DB server vm
- check_mode: yes
+- name: Create spec for registering previously unregistered DB from previously unregistered DB server vm
+ check_mode: true
ntnx_ndb_register_database:
wait: true
name: "{{db1_name}}"
@@ -193,71 +195,63 @@
register: result
-
-- set_fact:
- expected_action_arguments: [
- {
- "name": "vmIp",
- "value": "{{_vm_ip}}"
- },
+- name: Set expected action arguments
+ ansible.builtin.set_fact:
+ expected_action_arguments:
+ [
+ { "name": "vmIp", "value": "{{_vm_ip}}" },
+ { "name": "listener_port", "value": "5432" },
+ { "name": "db_name", "value": "testAnsible1" },
+ { "name": "db_user", "value": "postgres" },
+ {
+ "name": "db_password",
+ "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
+ },
+ {
+ "name": "postgres_software_home",
+ "value": "{{postgres.software_home}}",
+ },
+ ]
+
+- name: Set expected time machine info
+ ansible.builtin.set_fact:
+ expected_time_machine_info:
+ {
+ "autoTuneLogDrive": true,
+ "description": "TM-desc",
+ "name": "TM1",
+ "schedule": {},
+ "slaId": "{{sla.uuid}}",
+ }
+
+- name: Set maintenance tasks
+ ansible.builtin.set_fact:
+ mainetance_tasks:
+ {
+ "maintenanceWindowId": "{{maintenance.window_uuid}}",
+ "tasks":
+ [
+ {
+ "payload":
{
- "name": "listener_port",
- "value": "5432"
+ "prePostCommand":
+ { "postCommand": "ls -a", "preCommand": "ls" },
},
+ "taskType": "OS_PATCHING",
+ },
+ {
+ "payload":
{
- "name": "db_name",
- "value": "testAnsible1"
+ "prePostCommand":
+ { "postCommand": "ls -F", "preCommand": "ls -l" },
},
- {
- "name": "db_user",
- "value": "postgres"
- },
- {
- "name": "db_password",
- "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
- },
- {
- "name": "postgres_software_home",
- "value": "{{postgres.software_home}}"
- }
- ]
-
-- set_fact:
- expected_time_machine_info: {
- "autoTuneLogDrive": true,
- "description": "TM-desc",
- "name": "TM1",
- "schedule": {},
- "slaId": "{{sla.uuid}}"
- }
-
-- set_fact:
- mainetance_tasks: {
- "maintenanceWindowId": "{{maintenance.window_uuid}}",
- "tasks": [
- {
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -a",
- "preCommand": "ls"
- }
- },
- "taskType": "OS_PATCHING"
- },
- {
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -F",
- "preCommand": "ls -l"
- }
- },
- "taskType": "DB_PATCHING"
- }
- ]
- }
+ "taskType": "DB_PATCHING",
+ },
+ ],
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -277,9 +271,7 @@
fail_msg: "Unable to create register database spec"
success_msg: "single instance postgres database register spec created successfully"
-
-
-- name: register previously unregistered DB from previously unregistered DB server vm
+- name: Register previously unregistered DB from previously unregistered DB server vm
ntnx_ndb_register_database:
wait: true
name: "{{db1_name}}"
@@ -291,7 +283,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}}"
@@ -332,8 +324,8 @@
# skip jekyll/Liquid syntax check
# {% raw %}
-- name: create properties map
- set_fact:
+- name: Create properties map
+ ansible.builtin.set_fact:
properties: "{{ properties | default({}) | combine ({ item['name'] : item['value'] }) }}"
loop: "{{result.response.properties}}"
no_log: true
@@ -341,7 +333,7 @@
# {% endraw %}
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'READY'
@@ -355,7 +347,7 @@
- result.response.databaseNodes[0].status == "READY"
- result.response.type == "postgres_database"
- result.response.tags | length == 1
- - result.response.tags[0].tagName == "{{tags.databases.name}}"
+ - result.response.tags[0].tagName == "{{entity_tags.databases.name}}"
- result.response.tags[0].value == "single-instance-dbs"
- result.response.timeMachine is defined
- result.response.timeMachine.name == "TM1"
@@ -366,17 +358,17 @@
fail_msg: "Unable to register single instance postgres database"
success_msg: "single instance postgres database registered successfully"
-- name: delete db along with delete time machine and db server vms
+- name: Delete db along with delete time machine and db server vms
ntnx_ndb_databases:
db_uuid: "{{result.db_uuid}}"
state: "absent"
wait: true
delete_time_machine: true
- unregister_db_server_vms: True
+ unregister_db_server_vms: true
register: result
-- name: verify status of delete of database along with time machine delete
- assert:
+- name: Verify status of delete of database along with time machine delete
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
diff --git a/tests/integration/targets/ntnx_ndb_db_server_vms/tasks/crud.yml b/tests/integration/targets/ntnx_ndb_db_server_vms/tasks/crud.yml
index 60c7fd4e8..7f525625f 100644
--- a/tests/integration/targets/ntnx_ndb_db_server_vms/tasks/crud.yml
+++ b/tests/integration/targets/ntnx_ndb_db_server_vms/tasks/crud.yml
@@ -1,21 +1,22 @@
---
-
-- debug:
+- name: Start testing ntnx_ndb_db_server_vms, ntnx_ndb_register_db_server_vm, ntnx_ndb_db_servers_info and ntnx_ndb_maintenance_tasks
+ ansible.builtin.debug:
msg: "start ntnx_ndb_db_server_vms, ntnx_ndb_register_db_server_vm, ntnx_ndb_db_servers_info and ntnx_ndb_maintenance_tasks tests. Approx Time: < 30 mins"
- name: Generate random name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- set_fact:
+- name: Set vm names
+ ansible.builtin.set_fact:
vm1_name: "{{random_name[0]}}"
vm1_name_updated: "{{random_name[0]}}-updated"
################################### DB server VM Provision tests #############################
-- name: create ndb vm using time machine and check mode
- check_mode: yes
+- name: Create ndb vm using time machine and check mode
+ check_mode: true
ntnx_ndb_db_server_vms:
- wait: True
+ wait: true
name: "ansible-created-vm1-from-time-machine"
desc: "ansible-created-vm1-from-time-machine-time-machine"
time_machine:
@@ -45,81 +46,86 @@
# skip jekyll/Liquid syntax check
# {% raw %}
-- name: create action_arguments map
- set_fact:
+- name: Create action_arguments map
+ ansible.builtin.set_fact:
action_arguments: "{{ action_arguments | default({}) | combine ({ item['name'] : item['value'] }) }}"
loop: "{{check_mode_result.response.actionArguments}}"
no_log: true
# {% endraw %}
-- set_fact:
- mainetance_tasks: {
- "maintenanceWindowId": "test_window_uuid",
- "tasks": [
- {
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -a",
- "preCommand": "ls"
- }
- },
- "taskType": "OS_PATCHING"
- },
- {
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -F",
- "preCommand": "ls -l"
- }
- },
- "taskType": "DB_PATCHING"
- }
- ]
- }
+- name: Set mainetance_tasks
+ ansible.builtin.set_fact:
+ mainetance_tasks:
+ {
+ "maintenanceWindowId": "test_window_uuid",
+ "tasks":
+ [
+ {
+ "payload":
+ {
+ "prePostCommand":
+ { "postCommand": "ls -a", "preCommand": "ls" },
+ },
+ "taskType": "OS_PATCHING",
+ },
+ {
+ "payload":
+ {
+ "prePostCommand":
+ { "postCommand": "ls -F", "preCommand": "ls -l" },
+ },
+ "taskType": "DB_PATCHING",
+ },
+ ],
+ }
-- set_fact:
- expected_result: {
+- name: Set expected result
+ ansible.builtin.set_fact:
+ expected_result:
+ {
"changed": false,
"error": null,
"failed": false,
- "response": {
- "actionArguments": [
+ "response":
+ {
+ "actionArguments":
+ [
{
- "name": "vm_name",
- "value": "ansible-created-vm1-from-time-machine"
+ "name": "vm_name",
+ "value": "ansible-created-vm1-from-time-machine",
},
{
- "name": "client_public_key",
- "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
- }
- ],
+ "name": "client_public_key",
+ "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
+ },
+ ],
"computeProfileId": "test_compute_uuid",
"databaseType": "postgres_database",
"description": "ansible-created-vm1-from-time-machine-time-machine",
"latestSnapshot": false,
- "maintenanceTasks": {
+ "maintenanceTasks":
+ {
"maintenanceWindowId": "test_window_uuid",
- "tasks": [
+ "tasks":
+ [
{
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -a",
- "preCommand": "ls"
- }
+ "payload":
+ {
+ "prePostCommand":
+ { "postCommand": "ls -a", "preCommand": "ls" },
},
- "taskType": "OS_PATCHING"
+ "taskType": "OS_PATCHING",
},
{
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -F",
- "preCommand": "ls -l"
- }
+ "payload":
+ {
+ "prePostCommand":
+ { "postCommand": "ls -F", "preCommand": "ls -l" },
},
- "taskType": "DB_PATCHING"
- }
- ]
- },
+ "taskType": "DB_PATCHING",
+ },
+ ],
+ },
"networkProfileId": "test_network_uuid",
"nxClusterId": "test_cluster_uuid",
"snapshotId": "test_snapshot_uuid",
@@ -127,23 +133,22 @@
"softwareProfileVersionId": "",
"timeMachineId": "test_uuid",
"timeZone": "Asia/Calcutta",
- "vmPassword": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
- },
- "uuid": null
- }
+ "vmPassword": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
+ },
+ "uuid": null,
+ }
- name: Check mode Status
- assert:
+ ansible.builtin.assert:
that:
- check_mode_result == expected_result
fail_msg: "Unable to generate create db server vm spec with time machine as source"
success_msg: "DB server VM spec created successfully"
-
-- name: create spec for db server vm using software profile and names of profile
- check_mode: yes
+- name: Create spec for db server vm using software profile and names of profile
+ check_mode: true
ntnx_ndb_db_server_vms:
- wait: True
+ wait: true
name: "{{ vm1_name }}"
desc: "ansible-created-vm1-desc"
software_profile:
@@ -170,70 +175,70 @@
post_task_cmd: "ls -F"
register: result
-- set_fact:
- expected_result: {
+- name: Set expected result
+ ansible.builtin.set_fact:
+ expected_result:
+ {
"changed": false,
"error": null,
"failed": false,
- "response": {
- "actionArguments": [
+ "response":
+ {
+ "actionArguments":
+ [
+ { "name": "vm_name", "value": "{{ vm1_name }}" },
{
- "name": "vm_name",
- "value": "{{ vm1_name }}"
+ "name": "client_public_key",
+ "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
},
- {
- "name": "client_public_key",
- "value": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
- }
- ],
+ ],
"computeProfileId": "{{ compute_profile.uuid }}",
"databaseType": "postgres_database",
"description": "ansible-created-vm1-desc",
"latestSnapshot": false,
- "maintenanceTasks": {
+ "maintenanceTasks":
+ {
"maintenanceWindowId": "{{ maintenance.window_uuid }}",
- "tasks": [
+ "tasks":
+ [
{
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -a",
- "preCommand": "ls"
- }
+ "payload":
+ {
+ "prePostCommand":
+ { "postCommand": "ls -a", "preCommand": "ls" },
},
- "taskType": "OS_PATCHING"
+ "taskType": "OS_PATCHING",
},
{
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -F",
- "preCommand": "ls -l"
- }
+ "payload":
+ {
+ "prePostCommand":
+ { "postCommand": "ls -F", "preCommand": "ls -l" },
},
- "taskType": "DB_PATCHING"
- }
- ]
- },
+ "taskType": "DB_PATCHING",
+ },
+ ],
+ },
"networkProfileId": "{{ network_profile.uuid }}",
"nxClusterId": "{{ cluster.cluster1.uuid }}",
"softwareProfileId": "{{ software_profile.uuid }}",
"softwareProfileVersionId": "{{ software_profile.latest_version_id }}",
"timeZone": "UTC",
- "vmPassword": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
- },
- "uuid": null
- }
+ "vmPassword": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
+ },
+ "uuid": null,
+ }
- name: Check mode Status
- assert:
+ ansible.builtin.assert:
that:
- result == expected_result
fail_msg: "Unable to generate create db server vm spec with time machine as source and given names of profile"
success_msg: "DB server VM spec created successfully"
-
-- name: create db server vm using software profile
+- name: Create db server vm using software profile
ntnx_ndb_db_server_vms:
- wait: True
+ wait: true
name: "{{ vm1_name }}"
desc: "ansible-created-vm1-desc"
software_profile:
@@ -262,15 +267,15 @@
# skip jekyll/Liquid syntax check
# {% raw %}
-- name: create properties map
- set_fact:
+- name: Create properties map
+ ansible.builtin.set_fact:
properties: "{{ properties | default({}) | combine ({ item['name'] : item['value'] }) }}"
loop: "{{result.response.properties}}"
no_log: true
# {% endraw %}
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'UP'
@@ -286,23 +291,24 @@
fail_msg: "Unable to create db server vm using software profile"
success_msg: "DB server VM created successfully"
-- set_fact:
+- name: Set db server vm uuid
+ ansible.builtin.set_fact:
db_server_uuid: "{{ result.uuid }}"
-- set_fact:
+- name: Set db server vm ip
+ ansible.builtin.set_fact:
vm_ip: "{{ result.response.ipAddresses[0] }}"
-
################################### DB server VM update Tests #############################
-- name: update db server vm name, desc, credentials, tags
+- name: Update db server vm name, desc, credentials, tags
ntnx_ndb_db_server_vms:
- wait: True
+ wait: true
uuid: "{{db_server_uuid}}"
name: "{{vm1_name_updated}}"
desc: "ansible-created-vm1-updated-desc"
- reset_name_in_ntnx_cluster: True
- reset_desc_in_ntnx_cluster: True
+ reset_name_in_ntnx_cluster: true
+ reset_desc_in_ntnx_cluster: true
update_credentials:
- username: "{{vm_username}}"
password: "{{vm_password}}"
@@ -311,7 +317,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'UP'
@@ -321,25 +327,25 @@
- result.response.description == "ansible-created-vm1-updated-desc"
- result.response.ipAddresses | length > 0
- result.response.vmClusterName == vm1_name_updated
- - result.response.tags[0].tagName == tags.db_server_vm.name
- - result.response.tags[0].tagId == tags.db_server_vm.uuid
+ - result.response.tags[0].tagName == entity_tags.db_server_vm.name
+ - result.response.tags[0].tagId == entity_tags.db_server_vm.uuid
- result.response.tags[0].value == "ansible-updated"
fail_msg: "Unable to update db server vm"
success_msg: "DB server VM updated successfully"
-- name: check idempotency
+- name: Check idempotency
ntnx_ndb_db_server_vms:
- wait: True
- uuid: "{{db_server_uuid}}"
- name: "{{vm1_name_updated}}"
- desc: "ansible-created-vm1-updated-desc"
- tags:
- ansible-db-server-vms: "ansible-updated"
+ wait: true
+ uuid: "{{db_server_uuid}}"
+ name: "{{vm1_name_updated}}"
+ desc: "ansible-created-vm1-updated-desc"
+ tags:
+ ansible-db-server-vms: "ansible-updated"
register: result
-- name: check idempotency status
- assert:
+- name: Check idempotency status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -347,19 +353,18 @@
fail_msg: "db server vm got updated"
success_msg: "db server vm update skipped successfully due to no changes in state"
-
-- name: update db server vm name with check mode and check defaults
- check_mode: yes
+- name: Update db server vm name with check mode and check defaults
+ check_mode: true
ntnx_ndb_db_server_vms:
- wait: True
+ wait: true
uuid: "{{db_server_uuid}}"
update_credentials:
- username: "user"
password: "pass"
register: result
-- name: check mode Status
- assert:
+- name: Check mode Status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -379,9 +384,8 @@
ntnx_ndb_db_servers_info:
register: db_servers
-
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- db_servers.response is defined
- db_servers.failed == false
@@ -390,17 +394,17 @@
fail_msg: "Unable to list all NDB db_servers"
success_msg: "NDB db_servers listed successfully"
################################################################
-- name: get NDB db_servers using it's name
+- name: Get NDB db_servers using it's name
ntnx_ndb_db_servers_info:
filters:
load_metrics: true
- load_databases: True
+ load_databases: true
value_type: name
value: "{{db_servers.response[0].name}}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -414,17 +418,17 @@
################################################################
-- name: get NDB db_servers using incorrect name
+- name: Get NDB db_servers using incorrect name
ntnx_ndb_db_servers_info:
filters:
load_metrics: true
- load_databases: True
+ load_databases: true
value_type: name
value: "xxxxxxxxxxxxxx"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -434,15 +438,15 @@
fail_msg: "listing ndb db servers using incorrect name didn't failed"
success_msg: "Got empty response for incorrect name successfully"
################################################################
-- name: get NDB db_servers using it's ip
+- name: Get NDB db_servers using it's ip
ntnx_ndb_db_servers_info:
filters:
value_type: ip
value: "{{db_servers.response[0].ipAddresses[0]}}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -452,13 +456,13 @@
fail_msg: "Unable to get NDB db_servers using it's ip "
success_msg: "get NDB db_server using it's ip finished successfully"
################################################################
-- name: get NDB db_servers using it's name
+- name: Get NDB db_servers using it's name
ntnx_ndb_db_servers_info:
name: "{{db_servers.response[0].name}}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -468,13 +472,13 @@
fail_msg: "Unable to get NDB db_servers using it's name "
success_msg: "get NDB db_server using it's name finished successfully"
################################################################
-- name: get NDB db_servers using it's id
+- name: Get NDB db_servers using it's id
ntnx_ndb_db_servers_info:
uuid: "{{db_servers.response[0].id}}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -484,13 +488,13 @@
fail_msg: "Unable to get NDB db_servers using it's id "
success_msg: "get NDB db_server using it's id finished successfully"
################################################################
-- name: get NDB db_servers using ip
+- name: Get NDB db_servers using ip
ntnx_ndb_db_servers_info:
server_ip: "{{db_servers.response[0].ipAddresses[0]}}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -502,15 +506,15 @@
################################################################
-- name: get NDB db_servers with incorrect name
+- name: Get NDB db_servers with incorrect name
ntnx_ndb_db_servers_info:
name: "abcd"
register: result
no_log: true
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.error is defined
- result.failed == true
@@ -518,11 +522,10 @@
fail_msg: "module didn't errored out correctly when incorrect name is given"
success_msg: "module errored out correctly when incorrect name is given"
-
################################### maintenance tasks update tests #############################
-- name: create spec for adding maintenance window tasks to db server vm
- check_mode: yes
+- name: Create spec for adding maintenance window tasks to db server vm
+ check_mode: true
ntnx_ndb_maintenance_tasks:
db_server_vms:
- name: "{{vm1_name_updated}}"
@@ -541,58 +544,54 @@
post_task_cmd: "ls"
register: result
-- set_fact:
- expected_result: {
+- name: Set expected result
+ ansible.builtin.set_fact:
+ expected_result:
+ {
"changed": false,
"error": null,
"failed": false,
- "response": {
- "entities": {
- "ERA_DBSERVER": [
- "{{db_server_uuid}}",
- "test_vm_1"
- ],
- "ERA_DBSERVER_CLUSTER": [
- "test_cluter_1",
- "test_cluter_2"
- ]
- },
+ "response":
+ {
+ "entities":
+ {
+ "ERA_DBSERVER": ["{{db_server_uuid}}", "test_vm_1"],
+ "ERA_DBSERVER_CLUSTER": ["test_cluter_1", "test_cluter_2"],
+ },
"maintenanceWindowId": "{{maintenance.window_uuid}}",
- "tasks": [
+ "tasks":
+ [
{
- "payload": {
- "prePostCommand": {
- "postCommand": "ls",
- "preCommand": "ls -a"
- }
+ "payload":
+ {
+ "prePostCommand":
+ { "postCommand": "ls", "preCommand": "ls -a" },
},
- "taskType": "OS_PATCHING"
+ "taskType": "OS_PATCHING",
},
{
- "payload": {
- "prePostCommand": {
- "postCommand": "ls",
- "preCommand": "ls -a"
- }
+ "payload":
+ {
+ "prePostCommand":
+ { "postCommand": "ls", "preCommand": "ls -a" },
},
- "taskType": "DB_PATCHING"
- }
- ]
- },
- "uuid": "{{maintenance.window_uuid}}"
- }
+ "taskType": "DB_PATCHING",
+ },
+ ],
+ },
+ "uuid": "{{maintenance.window_uuid}}",
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result == expected_result
fail_msg: "Unable to create spec for adding maintenance tasks for db server vm"
success_msg: "spec for adding maintenance tasks for db server vm created successfully"
-
-- name: create spec for removing maintenance window tasks from above created vm
- check_mode: yes
+- name: Create spec for removing maintenance window tasks from above created vm
+ check_mode: true
ntnx_ndb_maintenance_tasks:
db_server_vms:
- uuid: "{{db_server_uuid}}"
@@ -601,33 +600,31 @@
tasks: []
register: result
-- set_fact:
- expected_result: {
+- name: Set expected result
+ ansible.builtin.set_fact:
+ expected_result:
+ {
"changed": false,
"error": null,
"failed": false,
- "response": {
- "entities": {
- "ERA_DBSERVER": [
- "{{db_server_uuid}}"
- ]
- },
+ "response":
+ {
+ "entities": { "ERA_DBSERVER": ["{{db_server_uuid}}"] },
"maintenanceWindowId": "{{maintenance.window_uuid}}",
"tasks": [],
},
- "uuid": "{{maintenance.window_uuid}}"
- }
+ "uuid": "{{maintenance.window_uuid}}",
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result == expected_result
fail_msg: "Unable to create spec for removing maintenance tasks for db server vm"
success_msg: "spec for removing maintenance tasks for db server vm created successfully"
-
-- name: db server vm already contains some tasks so remove maintenance window tasks from above created vm
+- name: Db server vm already contains some tasks so remove maintenance window tasks from above created vm
ntnx_ndb_maintenance_tasks:
db_server_vms:
- uuid: "{{db_server_uuid}}"
@@ -636,33 +633,33 @@
tasks: []
register: result
-- set_fact:
- tasks: []
+- name: Set variables
+ ansible.builtin.set_fact:
+ tasks_list: []
entity_tasks_associations: "{{result.response.entityTaskAssoc}}"
-- name: entity_tasks_associations can be null so converting it to list
- set_fact:
+- name: Entity_tasks_associations can be null so converting it to list
+ ansible.builtin.set_fact:
entity_tasks_associations: []
when: entity_tasks_associations == ""
-- name: creating list of tasks associated to db server vm
- set_fact:
- tasks: "{{ tasks | default([]) | union ([item]]) }}"
+- name: Creating list of tasks associated to db server vm
+ ansible.builtin.set_fact:
+ tasks_list: "{{ (tasks_list | default([])) | union([item]) }}"
loop: "{{entity_tasks_associations}}"
when: item['entity']['id'] == db_server_uuid
no_log: true
- name: Check update status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == true
- result.failed == false
- - tasks | length == 0
+ - tasks_list | length == 0
fail_msg: "Unable to remove maintenance tasks for given db server vm"
success_msg: "maintenance tasks for given db server vm removed successfully"
-
- name: Add maintenance window task for vm
ntnx_ndb_maintenance_tasks:
db_server_vms:
@@ -678,30 +675,32 @@
post_task_cmd: "ls"
register: result
-- set_fact:
- tasks: []
+- name: Reset tasks variable
+ ansible.builtin.set_fact:
+ tasks_list: []
-- set_fact:
+- name: Set entity_tasks_associations
+ ansible.builtin.set_fact:
entity_tasks_associations: "{{result.response.entityTaskAssoc}}"
-- name: entity_tasks_associations can be null so converting it to list
- set_fact:
+- name: Entity_tasks_associations can be null so converting it to list
+ ansible.builtin.set_fact:
entity_tasks_associations: []
when: entity_tasks_associations == None
-- name: creating list of tasks associated with db server vm
- set_fact:
- tasks: "{{ tasks | default([]) | union ([item]) }}"
+- name: Creating list of tasks associated with db server vm
+ ansible.builtin.set_fact:
+ tasks_list: "{{ tasks_list | default([]) | union ([item]) }}"
loop: "{{entity_tasks_associations}}"
when: item['entity']['id'] == db_server_uuid
no_log: true
- name: Check update status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == true
- result.failed == false
- - tasks | length == 2
+ - tasks_list | length == 2
fail_msg: "Unable to add maintenance tasks for given db server vm"
success_msg: "maintenance tasks for given db server vm added successfully"
@@ -716,7 +715,7 @@
register: result
- name: Check update status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == true
- result.failed == false
@@ -724,19 +723,18 @@
fail_msg: "Unable to remove maintenance tasks for given db server vm"
success_msg: "maintenance tasks for given db server vm removed successfully"
-
################################### DB server VM unregistration tests #############################
-- name: generate check mode spec for unregister with default values
- check_mode: yes
+- name: Generate check mode spec for unregister with default values
+ check_mode: true
ntnx_ndb_db_server_vms:
state: "absent"
- wait: True
+ wait: true
uuid: "{{db_server_uuid}}"
register: result
-- name: check mode Status
- assert:
+- name: Check mode Status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -749,19 +747,18 @@
fail_msg: "Unable to generate check mode spec for unregister"
success_msg: "DB server VM unregister spec generated successfully"
-
-- name: generate check mode spec for delete vm with vgs and snapshots
- check_mode: yes
+- name: Generate check mode spec for delete vm with vgs and snapshots
+ check_mode: true
ntnx_ndb_db_server_vms:
state: "absent"
uuid: "{{db_server_uuid}}"
- delete_from_cluster: True
- delete_vgs: True
- delete_vm_snapshots: True
+ delete_from_cluster: true
+ delete_vgs: true
+ delete_vm_snapshots: true
register: result
-- name: check mode Status
- assert:
+- name: Check mode Status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -774,20 +771,19 @@
fail_msg: "Unable to generate check mode spec for unregister"
success_msg: "DB server VM update spec generated successfully"
-
-- name: unregister vm
+- name: Unregister vm
ntnx_ndb_db_server_vms:
state: "absent"
- wait: True
+ wait: true
uuid: "{{db_server_uuid}}"
- delete_from_cluster: False
- soft_remove: True
- delete_vgs: True
- delete_vm_snapshots: True
+ delete_from_cluster: false
+ soft_remove: true
+ delete_vgs: true
+ delete_vm_snapshots: true
register: result
-- name: check mode Status
- assert:
+- name: Check mode Status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -797,9 +793,8 @@
################################### DB server VM Registration tests #############################
-
-- name: generate spec for registration of the previous unregistered vm using check mode
- check_mode: yes
+- name: Generate spec for registration of the previous unregistered vm using check mode
+ check_mode: true
ntnx_ndb_register_db_server_vm:
ip: "{{vm_ip}}"
desc: "register-vm-desc"
@@ -823,46 +818,48 @@
working_directory: "/check"
register: result
-- set_fact:
+- name: Reset action_arguments
+ ansible.builtin.set_fact:
action_arguments: {}
# skip jekyll/Liquid syntax check
# {% raw %}
-- name: create action_arguments map
- set_fact:
- action_arguments: "{{ action_arguments | default({}) | combine ({ item['name'] : item['value'] }) }}"
+- name: Create action_arguments map
+ ansible.builtin.set_fact:
+ action_arguments: "{{ action_arguments | default({}) | combine ({ item['name'] : item['value'] }) }}"
loop: "{{result.response.actionArguments}}"
no_log: true
# {% endraw %}
-- set_fact:
- maintenance_tasks: {
- "maintenanceWindowId": "{{maintenance.window_uuid}}",
- "tasks": [
- {
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -a",
- "preCommand": "ls"
- }
- },
- "taskType": "OS_PATCHING"
- },
- {
- "payload": {
- "prePostCommand": {
- "postCommand": "ls -F",
- "preCommand": "ls -l"
- }
- },
- "taskType": "DB_PATCHING"
- }
- ]
- }
+- name: Set maintenance_tasks
+ ansible.builtin.set_fact:
+ maintenance_tasks:
+ {
+ "maintenanceWindowId": "{{maintenance.window_uuid}}",
+ "tasks":
+ [
+ {
+ "payload":
+ {
+ "prePostCommand":
+ { "postCommand": "ls -a", "preCommand": "ls" },
+ },
+ "taskType": "OS_PATCHING",
+ },
+ {
+ "payload":
+ {
+ "prePostCommand":
+ { "postCommand": "ls -F", "preCommand": "ls -l" },
+ },
+ "taskType": "DB_PATCHING",
+ },
+ ],
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -879,8 +876,7 @@
fail_msg: "Unable to create spec for db server vm registration"
success_msg: "DB server VM registration spec generated successfully"
-
-- name: register the previous unregistered vm
+- name: Register the previous unregistered vm
ntnx_ndb_register_db_server_vm:
ip: "{{vm_ip}}"
desc: "register-vm-desc"
@@ -906,15 +902,15 @@
# skip jekyll/Liquid syntax check
# {% raw %}
-- name: create properties map
- set_fact:
- properties1: "{{ properties1 | default({}) | combine ({ item['name'] : item['value'] }) }}"
+- name: Create properties map
+ ansible.builtin.set_fact:
+ properties1: "{{ properties1 | default({}) | combine ({ item['name'] : item['value'] }) }}"
loop: "{{result.response.properties}}"
no_log: true
# {% endraw %}
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'UP'
@@ -934,25 +930,24 @@
fail_msg: "Unable to create db server vm using software profile"
success_msg: "DB server VM created successfully"
-
-- set_fact:
+- name: Set db server vm uuid
+ ansible.builtin.set_fact:
db_server_uuid: "{{result.uuid}}"
################################### DB server VM Delete test #############################
-
-- name: unregister db server vm
+- name: Unregister db server vm
ntnx_ndb_db_server_vms:
state: "absent"
- wait: True
+ wait: true
uuid: "{{db_server_uuid}}"
delete_from_cluster: false
- delete_vgs: True
- delete_vm_snapshots: True
+ delete_vgs: true
+ delete_vm_snapshots: true
register: result
-- name: check mode Status
- assert:
+- name: Check mode Status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
diff --git a/tests/integration/targets/ntnx_ndb_db_server_vms/tasks/main.yml b/tests/integration/targets/ntnx_ndb_db_server_vms/tasks/main.yml
index 5216bd0e2..5e1bbbe13 100644
--- a/tests/integration/targets/ntnx_ndb_db_server_vms/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_db_server_vms/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ndb_ip }}"
- nutanix_username: "{{ ndb_username }}"
- nutanix_password: "{{ ndb_password }}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ndb_ip }}"
+ nutanix_username: "{{ ndb_username }}"
+ nutanix_password: "{{ ndb_password }}"
+ validate_certs: false
block:
- - import_tasks: "crud.yml"
+ - name: Import "crud.yml"
+ ansible.builtin.import_tasks: "crud.yml"
diff --git a/tests/integration/targets/ntnx_ndb_maintenance_windows/tasks/crud.yml b/tests/integration/targets/ntnx_ndb_maintenance_windows/tasks/crud.yml
index a73653dd9..a4ae0a587 100644
--- a/tests/integration/targets/ntnx_ndb_maintenance_windows/tasks/crud.yml
+++ b/tests/integration/targets/ntnx_ndb_maintenance_windows/tasks/crud.yml
@@ -1,19 +1,20 @@
---
-
-- debug:
+- name: Start ndb database maintenance window tests
+ ansible.builtin.debug:
msg: "start ndb database maintenance window tests"
- name: Generate random name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- set_fact:
+- name: Set window names
+ ansible.builtin.set_fact:
window1_name: "{{random_name[0]}}1"
window2_name: "{{random_name[0]}}2"
############################################## create tests ####################################
-- name: create spec for maintenance window
- check_mode: yes
+- name: Create spec for maintenance window
+ check_mode: true
ntnx_ndb_maintenance_window:
name: "{{window1_name}}"
desc: "anisble-created-window"
@@ -25,35 +26,38 @@
day_of_week: "tuesday"
register: result
-- set_fact:
- expected_result: {
+- name: Set expected result
+ ansible.builtin.set_fact:
+ expected_result:
+ {
"changed": false,
"error": null,
"failed": false,
- "response": {
+ "response":
+ {
"description": "anisble-created-window",
"name": "{{window1_name}}",
- "schedule": {
+ "schedule":
+ {
"dayOfWeek": "TUESDAY",
"duration": 2,
"recurrence": "WEEKLY",
"startTime": "11:00:00",
- "weekOfMonth": null
- },
- "timezone": "Asia/Calcutta"
- },
- "uuid": null
- }
+ "weekOfMonth": null,
+ },
+ "timezone": "Asia/Calcutta",
+ },
+ "uuid": null,
+ }
- name: Check mode status
- assert:
+ ansible.builtin.assert:
that:
- result == expected_result
fail_msg: "Unable to create spec for creating window"
success_msg: "spec for maintenance window generated successfully"
-
-- name: create window with weekly schedule
+- name: Create window with weekly schedule
ntnx_ndb_maintenance_window:
name: "{{window1_name}}"
desc: "anisble-created-window"
@@ -65,11 +69,12 @@
timezone: "UTC"
register: result
-- set_fact:
+- name: Set window1 uuid
+ ansible.builtin.set_fact:
window1_uuid: "{{result.uuid}}"
-- name: create status
- assert:
+- name: Create status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -88,8 +93,7 @@
fail_msg: "Unable to create maintenance window with weekly schedule"
success_msg: "maintenance window with weekly schedule created successfully"
-
-- name: create window with monthly schedule
+- name: Create window with monthly schedule
ntnx_ndb_maintenance_window:
name: "{{window2_name}}"
desc: "anisble-created-window"
@@ -103,11 +107,12 @@
register: result
-- set_fact:
+- name: Set window2 uuid
+ ansible.builtin.set_fact:
window2_uuid: "{{result.uuid}}"
-- name: create status
- assert:
+- name: Create status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -123,7 +128,6 @@
- result.response.schedule.weekOfMonth == 2
- result.response.schedule.duration == 2
-
fail_msg: "Unable to create maintenance window with monthly schedule"
success_msg: "maintenance window with monthly schedule created successfully"
@@ -136,7 +140,7 @@
register: result
- name: Info module status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -147,12 +151,12 @@
fail_msg: "Unable to fetch window info"
success_msg: "maintenance window info obtained successfully"
-- name: get all windows
+- name: Get all windows
ntnx_ndb_maintenance_windows_info:
register: result
- name: Info module status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -163,8 +167,7 @@
############################################## update tests ####################################
-
-- name: update window schedule
+- name: Update window schedule
ntnx_ndb_maintenance_window:
uuid: "{{window2_uuid}}"
name: "{{window2_name}}-updated"
@@ -178,8 +181,8 @@
week_of_month: 3
register: result
-- name: update status
- assert:
+- name: Update status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -195,11 +198,10 @@
- result.response.schedule.weekOfMonth == 3
- result.response.schedule.duration == 3
-
fail_msg: "Unable to update maintenance window"
success_msg: "maintenance window updated successfully"
-- name: update schedule type
+- name: Update schedule type
ntnx_ndb_maintenance_window:
uuid: "{{window2_uuid}}"
schedule:
@@ -211,8 +213,8 @@
register: result
-- name: create status
- assert:
+- name: Create status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -228,11 +230,10 @@
- result.response.schedule.weekOfMonth == None
- result.response.schedule.duration == 3
-
fail_msg: "Unable to update maintenance window"
success_msg: "maintenance window updated successfully"
-- name: idempotency checks
+- name: Idempotency checks
ntnx_ndb_maintenance_window:
uuid: "{{window2_uuid}}"
name: "{{window2_name}}-updated"
@@ -246,8 +247,8 @@
register: result
-- name: check idempotency status
- assert:
+- name: Check idempotency status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -255,7 +256,7 @@
fail_msg: "window got updated"
success_msg: "window update got skipped due to no state changes"
-- name: updated day of week
+- name: Updated day of week
ntnx_ndb_maintenance_window:
uuid: "{{window2_uuid}}"
schedule:
@@ -263,9 +264,8 @@
register: result
-
-- name: update status
- assert:
+- name: Update status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -280,11 +280,10 @@
- result.response.schedule.weekOfMonth == None
- result.response.schedule.duration == 3
-
fail_msg: "Unable to update maintenance window"
success_msg: "maintenance window updated successfully"
-- name: just update start time
+- name: Just update start time
ntnx_ndb_maintenance_window:
uuid: "{{window2_uuid}}"
schedule:
@@ -293,8 +292,8 @@
register: result
-- name: update status
- assert:
+- name: Update status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
@@ -312,17 +311,16 @@
fail_msg: "Unable to update maintenance window"
success_msg: "maintenance window updated successfully"
-
############################################## delete tests ####################################
-- name: delete window 1
+- name: Delete window 1
ntnx_ndb_maintenance_window:
uuid: "{{window1_uuid}}"
state: "absent"
register: result
-- name: check delete status
- assert:
+- name: Check delete status
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -330,15 +328,14 @@
fail_msg: "unable to delete window"
success_msg: "window deleted successfully"
-- name: delete window 2
+- name: Delete window 2
ntnx_ndb_maintenance_window:
uuid: "{{window2_uuid}}"
state: "absent"
register: result
-
-- name: check delete status
- assert:
+- name: Check delete status
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
diff --git a/tests/integration/targets/ntnx_ndb_maintenance_windows/tasks/main.yml b/tests/integration/targets/ntnx_ndb_maintenance_windows/tasks/main.yml
index abf2644d3..5e1bbbe13 100644
--- a/tests/integration/targets/ntnx_ndb_maintenance_windows/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_maintenance_windows/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ndb_ip }}"
- nutanix_username: "{{ ndb_username }}"
- nutanix_password: "{{ ndb_password }}"
- validate_certs: False
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ndb_ip }}"
+ nutanix_username: "{{ ndb_username }}"
+ nutanix_password: "{{ ndb_password }}"
+ validate_certs: false
block:
- - import_tasks: "crud.yml"
+ - name: Import "crud.yml"
+ ansible.builtin.import_tasks: "crud.yml"
diff --git a/tests/integration/targets/ntnx_ndb_profiles/tasks/compute.yml b/tests/integration/targets/ntnx_ndb_profiles/tasks/compute.yml
index 081e0e8f9..63d546bc4 100644
--- a/tests/integration/targets/ntnx_ndb_profiles/tasks/compute.yml
+++ b/tests/integration/targets/ntnx_ndb_profiles/tasks/compute.yml
@@ -1,17 +1,19 @@
---
-- debug:
+- name: Start testing ntnx_ndb_profiles
+ ansible.builtin.debug:
msg: Start testing ntnx_ndb_profiles
-
################################################################
- name: Generate random profile_name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)[0]}}"
-- set_fact:
+- name: Set suffix name
+ ansible.builtin.set_fact:
suffix_name: "ansible-role-mapping"
-- set_fact:
+- name: Set profile names
+ ansible.builtin.set_fact:
profile1_name: "{{random_name}}{{suffix_name}}1"
profile2_name: "{{random_name}}{{suffix_name}}2"
################################################################
@@ -24,8 +26,8 @@
ignore_errors: true
check_mode: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -42,20 +44,20 @@
fail_msg: "Fail: unable to Verify creation of compute profile with defaults in check mode "
success_msg: "Pass: Verify creation of compute profile with defaults in check mode "
################################################################
-- name: verify creation of compute profile
+- name: Verify creation of compute profile
ntnx_ndb_profiles:
name: "{{profile1_name}}"
desc: "testdesc"
type: compute
compute:
- vcpus: 2
- cores_per_cpu: 4
- memory: 8
+ vcpus: 2
+ cores_per_cpu: 4
+ memory: 8
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -71,11 +73,11 @@
fail_msg: "Fail: create compute profile finished successfully "
success_msg: "Pass: Unable to create compute profile"
-
-- set_fact:
+- name: Add profile_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.profile_uuid ] }}"
################################################################
-- name: verify update of params in compute profile and publish profile
+- name: Verify update of params in compute profile and publish profile
ntnx_ndb_profiles:
name: "{{profile2_name}}"
desc: "newdesc"
@@ -89,9 +91,8 @@
register: result
ignore_errors: true
-
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -107,7 +108,7 @@
fail_msg: "Fail: unable to verify update of params in compute profile and publish profile"
success_msg: "Pass: verify update of params in compute profile and publish profile finished successfully"
################################################################
-- name: verify idempotency check in compute profile
+- name: Verify idempotency check in compute profile
ntnx_ndb_profiles:
profile_uuid: "{{result.profile_uuid}}"
name: "{{profile2_name}}"
@@ -115,8 +116,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -125,7 +126,7 @@
fail_msg: "Fail: unable to verify idempotency check in compute profile"
success_msg: "Pass: verify idempotency check in compute profile finished successfully"
################################################################
-- name: verify unpublish flow in compute profile
+- name: Verify unpublish flow in compute profile
ntnx_ndb_profiles:
profile_uuid: "{{result.profile_uuid}}"
@@ -135,9 +136,8 @@
register: result
ignore_errors: true
-
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -153,10 +153,10 @@
profile_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed is defined
- result.changed == true
@@ -164,5 +164,6 @@
fail_msg: "unable to delete all created compute profiles"
success_msg: "All compute profiles deleted successfully"
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_ndb_profiles/tasks/db_params.yml b/tests/integration/targets/ntnx_ndb_profiles/tasks/db_params.yml
index 69c8634a8..9e7d661c2 100644
--- a/tests/integration/targets/ntnx_ndb_profiles/tasks/db_params.yml
+++ b/tests/integration/targets/ntnx_ndb_profiles/tasks/db_params.yml
@@ -1,8 +1,9 @@
- name: Generate random profile_name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)[0]}}"
-- set_fact:
+- name: Set variables
+ ansible.builtin.set_fact:
suffix_name: "ansible-role-mapping"
max_connections: 50
max_replication_slots: 5
@@ -23,12 +24,13 @@
autovacuum_vacuum_scale_factor: 0.3
autovacuum_work_mem: 1
autovacuum_max_workers: 2
- autovacuum_vacuum_cost_delay: 22
+ autovacuum_vacuum_cost_delay: 22
wal_buffers: 1
synchronous_commit: local
random_page_cost: 3
-- set_fact:
+- name: Set profile names
+ ansible.builtin.set_fact:
profile1_name: "{{random_name}}{{suffix_name}}1"
profile2_name: "{{random_name}}{{suffix_name}}2"
profile3_name: "{{random_name}}{{suffix_name}}3"
@@ -61,16 +63,15 @@
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}}"
register: result
ignore_errors: true
-
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -104,10 +105,11 @@
fail_msg: "Fail: Unable to create db params profile "
success_msg: "Pass: Creation of db params profile finished successfully "
-- set_fact:
+- name: Add profile_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.profile_uuid ] }}"
################################################################
-- name: verify update of params in database_parameter profile and publish profile
+- name: Verify update of params in database_parameter profile and publish profile
ntnx_ndb_profiles:
name: "{{profile2_name}}"
desc: "newdesc"
@@ -124,8 +126,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -141,7 +143,7 @@
fail_msg: "Fail: unable to verify update of params in database_parameter profile and publish profile "
success_msg: "Pass: verify update of params in database_parameter profile and publish profile finished successfully"
################################################################
-- name: verify unpublish flow in database_parameter profile
+- name: Verify unpublish flow in database_parameter profile
ntnx_ndb_profiles:
profile_uuid: "{{result.profile_uuid}}"
database_parameter:
@@ -151,9 +153,8 @@
register: result
ignore_errors: true
-
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -162,7 +163,7 @@
fail_msg: "Fail: verify unpublish flow in database_parameter profile "
success_msg: "Pass: verify unpublish flow in database_parameter profile finished successfully "
################################################################
-- name: verify creatition of db params profile with defaults
+- name: Verify creatition of db params profile with defaults
ntnx_ndb_profiles:
name: "{{profile3_name}}"
desc: "testdesc"
@@ -171,8 +172,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -184,10 +185,11 @@
fail_msg: "Fail: Unable to verify creatition of db params profile with defaults "
success_msg: "Pass: verify creatition of db params profile with defaults finished successfully "
-- set_fact:
+- name: Add profile_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.profile_uuid ] }}"
################################################################
-- name: verify idempotency check
+- name: Verify idempotency check
ntnx_ndb_profiles:
name: "{{profile3_name}}"
desc: "testdesc"
@@ -195,8 +197,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -213,10 +215,10 @@
profile_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed is defined
- result.changed == true
@@ -224,5 +226,6 @@
fail_msg: "unable to delete all created Database_Parameter profiles"
success_msg: "All Database_Parameter profiles deleted successfully"
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_ndb_profiles/tasks/main.yml b/tests/integration/targets/ntnx_ndb_profiles/tasks/main.yml
index 43729cff4..dcf037fa1 100644
--- a/tests/integration/targets/ntnx_ndb_profiles/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_profiles/tasks/main.yml
@@ -1,11 +1,15 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ndb_ip}}"
- nutanix_username: "{{ndb_username}}"
- nutanix_password: "{{ndb_password}}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ndb_ip}}"
+ nutanix_username: "{{ndb_username}}"
+ nutanix_password: "{{ndb_password}}"
+ validate_certs: false
block:
- - import_tasks: "compute.yml"
- - import_tasks: "db_params.yml"
- - import_tasks: "network_profile.yml"
+ - name: Import "compute.yml"
+ ansible.builtin.import_tasks: "compute.yml"
+ - name: Import "db_params.yml"
+ ansible.builtin.import_tasks: "db_params.yml"
+ - name: Import "network_profile.yml"
+ ansible.builtin.import_tasks: "network_profile.yml"
diff --git a/tests/integration/targets/ntnx_ndb_profiles/tasks/network_profile.yml b/tests/integration/targets/ntnx_ndb_profiles/tasks/network_profile.yml
index 27549a765..0c8da92e4 100644
--- a/tests/integration/targets/ntnx_ndb_profiles/tasks/network_profile.yml
+++ b/tests/integration/targets/ntnx_ndb_profiles/tasks/network_profile.yml
@@ -1,17 +1,19 @@
- name: Generate random profile_name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)[0]}}"
-- set_fact:
+- name: Set suffix name
+ ansible.builtin.set_fact:
suffix_name: "ansible-role-mapping"
-- set_fact:
+- name: Set profile names
+ ansible.builtin.set_fact:
todelete: []
profile1_name: "{{random_name}}{{suffix_name}}1"
profile2_name: "{{random_name}}{{suffix_name}}2"
profile3_name: "{{random_name}}{{suffix_name}}3"
################################################################
-- name: verify create of single cluster network profile
+- name: Verify create of single cluster network profile
ntnx_ndb_profiles:
name: "{{profile1_name}}"
desc: "testdesc"
@@ -20,16 +22,15 @@
network:
topology: single
vlans:
- -
- cluster:
+ - cluster:
name: "{{network_profile.single.cluster.name}}"
vlan_name: "{{network_profile.single.vlan_name}}"
enable_ip_address_selection: true
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -44,7 +45,7 @@
fail_msg: "Fail: unable to verify create of single cluster network profile"
success_msg: "Pass: verify create of single cluster network profile finished successfully "
################################################################
-- name: update the profile for single cluster by name , desc , publish
+- name: Update the profile for single cluster by name , desc , publish
ntnx_ndb_profiles:
name: "{{profile2_name}}"
desc: "testdesc2"
@@ -54,8 +55,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -70,10 +71,11 @@
fail_msg: "Fail: unable to update the profile for single cluster by name , desc , publish "
success_msg: "Pass: update the profile for single cluster by name , desc , publish finished successfully "
-- set_fact:
+- name: Add profile_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.profile_uuid ] }}"
################################################################
-- name: verify idempotency check
+- name: Verify idempotency check
ntnx_ndb_profiles:
name: "{{profile2_name}}"
desc: "testdesc2"
@@ -81,8 +83,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -91,7 +93,7 @@
fail_msg: "Fail: unable to verify idempotency check"
success_msg: "Pass: verify idempotency check finished successfully "
################################################################
-# - name: verify create of multiple cluster network profile
+# - name: Verify create of multiple cluster network profile
# ntnx_ndb_profiles:
# name: "{{profile3_name}}"
# desc: "testdesc"
@@ -112,8 +114,8 @@
# register: result
# ignore_errors: true
-# - name: check listing status
-# assert:
+# - name: Check listing status
+# ansible.builtin.assert:
# that:
# - result.response is defined
# - result.failed == false
@@ -130,10 +132,10 @@
# fail_msg: "Fail: unable to verify create of multiple cluster network profile "
# success_msg: "Pass: verify create of multiple cluster network profile finished successfully"
-# - set_fact:
+# - ansible.builtin.set_fact:
# todelete: "{{ todelete + [ result.profile_uuid ] }}"
################################################################
-# - name: update the profile for multiple cluster by subnets, publish
+# - name: Update the profile for multiple cluster by subnets, publish
# ntnx_ndb_profiles:
# type: network
# profile_uuid: "{{result.profile_uuid}}"
@@ -152,8 +154,8 @@
# register: result
# ignore_errors: true
-# - name: check listing status
-# assert:
+# - name: Check listing status
+# ansible.builtin.assert:
# that:
# - result.response is defined
# - result.failed == false
@@ -177,10 +179,10 @@
profile_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed is defined
- result.changed == true
@@ -188,5 +190,6 @@
fail_msg: "unable to delete all created network profiles"
success_msg: "All network profiles deleted successfully"
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_ndb_profiles_info/tasks/info.yml b/tests/integration/targets/ntnx_ndb_profiles_info/tasks/info.yml
index 8d6837be7..5f3f97de7 100644
--- a/tests/integration/targets/ntnx_ndb_profiles_info/tasks/info.yml
+++ b/tests/integration/targets/ntnx_ndb_profiles_info/tasks/info.yml
@@ -1,5 +1,6 @@
---
-- debug:
+- name: Start testing ntnx_ndb_profiles_info
+ ansible.builtin.debug:
msg: Start testing ntnx_ndb_profiles_info
- name: List profiles
@@ -7,9 +8,8 @@
register: profiles
ignore_errors: true
-
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- profiles.response is defined
- profiles.failed == false
@@ -25,8 +25,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -42,8 +42,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -59,8 +59,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -70,15 +70,15 @@
success_msg: "Network NDB profiles listed successfully"
################################################################
-- name: get network profile with available IPs
+- name: Get network profile with available IPs
ntnx_ndb_profiles_info:
name: "{{static_network_profile.name}}"
include_available_ips: true
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -89,15 +89,15 @@
fail_msg: "Unable to list network profile with available IPs"
success_msg: "Network NDB profiles along with available IPs obtained successfully"
-- name: get network profile with available IPs
+- name: Get network profile with available IPs
ntnx_ndb_profiles_info:
uuid: "{{static_network_profile.uuid}}"
include_available_ips: true
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -114,8 +114,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -131,8 +131,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -141,14 +141,14 @@
fail_msg: "Unable to list all Software NDB profile"
success_msg: "Software NDB profiles listed successfully"
################################################################
-- name: get NDB profile using NDB profile name
+- name: Get NDB profile using NDB profile name
ntnx_ndb_profiles_info:
name: "{{profiles.response[0].name}}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -164,8 +164,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -175,16 +175,15 @@
success_msg: "get NDB profile using NDB profile id finished successfully"
################################################################
-
-- name: get NDB profiles with incorrect name
+- name: Get NDB profiles with incorrect name
ntnx_ndb_profiles_info:
name: "abcd"
register: result
no_log: true
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.error is defined
- result.failed == true
diff --git a/tests/integration/targets/ntnx_ndb_profiles_info/tasks/main.yml b/tests/integration/targets/ntnx_ndb_profiles_info/tasks/main.yml
index da502fcc5..8e7493b9f 100644
--- a/tests/integration/targets/ntnx_ndb_profiles_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_profiles_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ndb_ip}}"
- nutanix_username: "{{ndb_username}}"
- nutanix_password: "{{ndb_password}}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ndb_ip}}"
+ nutanix_username: "{{ndb_username}}"
+ nutanix_password: "{{ndb_password}}"
+ validate_certs: false
block:
- - import_tasks: "info.yml"
+ - name: Import "info.yml"
+ ansible.builtin.import_tasks: "info.yml"
diff --git a/tests/integration/targets/ntnx_ndb_slas/tasks/CRUD.yml b/tests/integration/targets/ntnx_ndb_slas/tasks/CRUD.yml
index 48bc70291..072c25f38 100644
--- a/tests/integration/targets/ntnx_ndb_slas/tasks/CRUD.yml
+++ b/tests/integration/targets/ntnx_ndb_slas/tasks/CRUD.yml
@@ -1,15 +1,18 @@
---
-- debug:
+- name: Start testing ntnx_ndb_slas and ntnx_ndb_slas_info
+ ansible.builtin.debug:
msg: Start testing ntnx_ndb_slas and ntnx_ndb_slas_info
- name: Generate random profile_name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)[0]}}"
-- set_fact:
+- name: Set suffix name
+ ansible.builtin.set_fact:
suffix_name: "ansible-role-mapping"
-- set_fact:
+- name: Set variables
+ ansible.builtin.set_fact:
todelete: []
profile1_name: "{{random_name}}{{suffix_name}}1"
profile2_name: "{{random_name}}{{suffix_name}}2"
@@ -36,8 +39,8 @@
ignore_errors: true
check_mode: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -67,8 +70,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -83,10 +86,12 @@
- result.sla_uuid is defined
fail_msg: "Fail: Unable to create sla "
success_msg: "Pass: sla is created successfully "
-- set_fact:
+- name: Add sla_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.sla_uuid ] }}"
################################################################
-- set_fact:
+- name: Set variables
+ ansible.builtin.set_fact:
frequency:
logs_retention: 10
snapshots_retention:
@@ -95,7 +100,7 @@
monthly: 13
quarterly: 14
-- name: verify slas update flow
+- name: Verify slas update flow
ntnx_ndb_slas:
sla_uuid: "{{result.sla_uuid}}"
name: "{{profile2_name}}"
@@ -110,8 +115,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -127,7 +132,7 @@
fail_msg: "Fail: Unable to update sla "
success_msg: "Pass: verify slas update flow finished successfully"
################################################################ update flow #########################################
-- name: verify slas update flow with check mode
+- name: Verify slas update flow with check mode
ntnx_ndb_slas:
sla_uuid: "{{result.sla_uuid}}"
name: "{{profile2_name}}"
@@ -143,8 +148,8 @@
ignore_errors: true
check_mode: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -160,7 +165,7 @@
fail_msg: "Fail: verify slas update flow with check mode "
success_msg: "Pass: verify slas update flow with check mode finished successfully"
################################################################
-- name: verify idempotency
+- name: Verify idempotency
ntnx_ndb_slas:
sla_uuid: "{{result.sla_uuid}}"
name: "{{profile2_name}}"
@@ -175,8 +180,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.msg == "Nothing to change."
- result.failed == false
@@ -186,15 +191,16 @@
######################################################################## Info module tests #################################################
-- debug:
+- name: Start testing ntnx_ndb_slas_info
+ ansible.builtin.debug:
msg: Start testing ntnx_ndb_slas_info
- name: List all era slas
ntnx_ndb_slas_info:
register: slas
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- slas.response is defined
- slas.failed == false
@@ -203,13 +209,13 @@
fail_msg: "Unable to list all era slas"
success_msg: "era slas listed successfully"
################################################################
-- name: get era slas using it's name
+- name: Get era slas using it's name
ntnx_ndb_slas_info:
name: "{{slas.response[0].name}}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -223,8 +229,8 @@
uuid: "{{slas.response[0].id}}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -234,16 +240,15 @@
success_msg: "get era slas using it's id successfully"
################################################################
-
-- name: get era slas with incorrect name
+- name: Get era slas with incorrect name
ntnx_ndb_slas_info:
name: "abcd"
register: result
no_log: true
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.error is defined
- result.failed == true
@@ -252,16 +257,16 @@
success_msg: "module errored out correctly when incorrect name is given"
######################################################################## Delete flow #################################################
-- name: verify slas delete flow
+- name: Verify slas delete flow
ntnx_ndb_slas:
state: absent
sla_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed is defined
- result.changed == true
@@ -269,5 +274,6 @@
fail_msg: "unable to delete all created slas"
success_msg: "All slas deleted successfully"
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_ndb_slas/tasks/main.yml b/tests/integration/targets/ntnx_ndb_slas/tasks/main.yml
index cbd87d175..99508b383 100644
--- a/tests/integration/targets/ntnx_ndb_slas/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_slas/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ndb_ip}}"
- nutanix_username: "{{ndb_username}}"
- nutanix_password: "{{ndb_password}}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ndb_ip}}"
+ nutanix_username: "{{ndb_username}}"
+ nutanix_password: "{{ndb_password}}"
+ validate_certs: false
block:
- - import_tasks: "CRUD.yml"
+ - name: Import "CRUD.yml"
+ ansible.builtin.import_tasks: "CRUD.yml"
diff --git a/tests/integration/targets/ntnx_ndb_snapshots_info/tasks/info.yml b/tests/integration/targets/ntnx_ndb_snapshots_info/tasks/info.yml
index 43463a9c7..892dea62d 100644
--- a/tests/integration/targets/ntnx_ndb_snapshots_info/tasks/info.yml
+++ b/tests/integration/targets/ntnx_ndb_snapshots_info/tasks/info.yml
@@ -1,13 +1,14 @@
---
-- debug:
+- name: Start testing ntnx_ndb_snapshots_info
+ ansible.builtin.debug:
msg: Start testing ntnx_ndb_snapshots_info
- name: List all NDB snapshots
ntnx_ndb_snapshots_info:
register: snapshots
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- snapshots.response is defined
- snapshots.failed == false
@@ -16,15 +17,15 @@
fail_msg: "Unable to list all NDB snapshots"
success_msg: "NDB snapshots listed successfully"
################################################################
-- name: get NDB snapshots using it's UTC time_zone
+- name: Get NDB snapshots using it's UTC time_zone
ntnx_ndb_snapshots_info:
filters:
time_zone: UTC
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -34,7 +35,7 @@
success_msg: "get NDB snapshots using with utc time_zone"
################################################################
-- name: get NDB snapshots with time-machine id
+- name: Get NDB snapshots with time-machine id
ntnx_ndb_snapshots_info:
filters:
value: "{{snapshots.response[0].timeMachineId}}"
@@ -42,8 +43,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -52,14 +53,14 @@
fail_msg: "Unable to get NDB snapshots with time-machine id "
success_msg: "get NDB snapshots using with time-machine id"
################################################################
-- name: get NDB snapshots using it's uuid
+- name: Get NDB snapshots using it's uuid
ntnx_ndb_snapshots_info:
uuid: "{{snapshots.response[0].id}}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -75,8 +76,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -86,15 +87,15 @@
fail_msg: "Unable to get NDB snapshots using it's id and get files "
success_msg: "get NDB snapshots using it's id and get files successfully"
# ################################################################
-- name: get NDB snapshots with incorrect uuid
+- name: Get NDB snapshots with incorrect uuid
ntnx_ndb_snapshots_info:
uuid: "abcd"
register: result
no_log: true
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.error is defined
- result.failed == true
diff --git a/tests/integration/targets/ntnx_ndb_snapshots_info/tasks/main.yml b/tests/integration/targets/ntnx_ndb_snapshots_info/tasks/main.yml
index da502fcc5..8e7493b9f 100644
--- a/tests/integration/targets/ntnx_ndb_snapshots_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_snapshots_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ndb_ip}}"
- nutanix_username: "{{ndb_username}}"
- nutanix_password: "{{ndb_password}}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ndb_ip}}"
+ nutanix_username: "{{ndb_username}}"
+ nutanix_password: "{{ndb_password}}"
+ validate_certs: false
block:
- - import_tasks: "info.yml"
+ - name: Import "info.yml"
+ ansible.builtin.import_tasks: "info.yml"
diff --git a/tests/integration/targets/ntnx_ndb_software_profiles/tasks/crud.yml b/tests/integration/targets/ntnx_ndb_software_profiles/tasks/crud.yml
index aec103c53..9d755e704 100644
--- a/tests/integration/targets/ntnx_ndb_software_profiles/tasks/crud.yml
+++ b/tests/integration/targets/ntnx_ndb_software_profiles/tasks/crud.yml
@@ -8,22 +8,22 @@
# 5. Replicate profiles to multi clusters
# 6. Delete of profile
-- debug:
+- name: Start testing ntnx_ndb_software_profiles
+ ansible.builtin.debug:
msg: "start ndb software profile tests"
- name: Generate random name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- set_fact:
+- name: Set profile names
+ ansible.builtin.set_fact:
profile1_name: "{{random_name[0]}}"
- profile1_name_updated: "{{random_name[0]}}-updated"
+ profile1_name_updated: "{{random_name[0]}}-updated"
profile2_name: "{{random_name[0]}}2"
-
-
-- name: create software profile create spec
- check_mode: yes
+- name: Create software profile create spec
+ check_mode: true
ntnx_ndb_profiles:
name: "{{profile1_name}}"
desc: "{{profile1_name}}-desc"
@@ -43,59 +43,50 @@
- uuid: "{{cluster.cluster2.uuid}}"
register: result
-
-
-- set_fact:
- expected_result: {
+- name: Set expected result
+ ansible.builtin.set_fact:
+ expected_result:
+ {
"changed": false,
"error": null,
"failed": false,
"profile_uuid": null,
- "response": {
- "availableClusterIds": [
- "{{cluster.cluster1.uuid}}",
- "{{cluster.cluster2.uuid}}"
- ],
+ "response":
+ {
+ "availableClusterIds":
+ ["{{cluster.cluster1.uuid}}", "{{cluster.cluster2.uuid}}"],
"description": "{{profile1_name}}-desc",
"engineType": "postgres_database",
"name": "{{profile1_name}}",
- "properties": [
- {
- "name": "BASE_PROFILE_VERSION_NAME",
- "value": "v1.0"
- },
+ "properties":
+ [
+ { "name": "BASE_PROFILE_VERSION_NAME", "value": "v1.0" },
{
- "name": "BASE_PROFILE_VERSION_DESCRIPTION",
- "value": "v1.0-desc"
+ "name": "BASE_PROFILE_VERSION_DESCRIPTION",
+ "value": "v1.0-desc",
},
+ { "name": "OS_NOTES", "value": "os_notes" },
+ { "name": "DB_SOFTWARE_NOTES", "value": "db_notes" },
{
- "name": "OS_NOTES",
- "value": "os_notes"
+ "name": "SOURCE_DBSERVER_ID",
+ "value": "{{db_server_vm.uuid}}",
},
- {
- "name": "DB_SOFTWARE_NOTES",
- "value": "db_notes"
- },
- {
- "name": "SOURCE_DBSERVER_ID",
- "value": "{{db_server_vm.uuid}}"
- }
- ],
+ ],
"systemProfile": false,
"topology": "cluster",
- "type": "Software"
- }
- }
+ "type": "Software",
+ },
+ }
-- name: check spec for creating software profile
- assert:
+- name: Check spec for creating software profile
+ ansible.builtin.assert:
that:
- result == expected_result
fail_msg: "Fail: Unable to create spec for software profile create"
success_msg: "Pass: Spec for creating software profile generated successfully"
-- name: create software profile with base version and cluster instance topology. Replicated to multiple clusters
+- name: Create software profile with base version and cluster instance topology. Replicated to multiple clusters
ntnx_ndb_profiles:
name: "{{profile1_name}}-replicated"
desc: "{{profile1_name}}-desc-replicated"
@@ -115,13 +106,12 @@
- uuid: "{{cluster.cluster2.uuid}}"
register: result
-
-
-- set_fact:
+- name: Set clusters uuids
+ ansible.builtin.set_fact:
clusters: ["{{cluster.cluster1.uuid}}", "{{cluster.cluster2.uuid}}"]
-- name: check status of creation
- assert:
+- name: Check status of creation
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == False
@@ -142,8 +132,7 @@
fail_msg: "Fail: Unable to create software profile with base version and cluster instance topology with replicating to multiple clusters."
success_msg: "Pass: Software profile with base version, cluster instance topology and replicated to multiple clusters created successfully"
-
-- name: create software profile with base version and single instance topology
+- name: Create software profile with base version and single instance topology
ntnx_ndb_profiles:
name: "{{profile2_name}}"
desc: "{{profile2_name}}-desc"
@@ -162,10 +151,8 @@
- name: "{{cluster.cluster1.name}}"
register: result
-
-
-- name: check status of creation
- assert:
+- name: Check status of creation
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == False
@@ -185,21 +172,19 @@
fail_msg: "Fail: Unable to create software profile with base version and single instance topology"
success_msg: "Pass: Software profile with base version and single instance topology created successfully"
-
-- set_fact:
+- name: Set profile_uuid
+ ansible.builtin.set_fact:
profile_uuid: "{{result.profile_uuid}}"
-- name: update software profile
+- name: Update software profile
ntnx_ndb_profiles:
profile_uuid: "{{profile_uuid}}"
name: "{{profile1_name}}-updated1"
desc: "{{profile1_name}}-desc-updated"
register: result
-
-
-- name: check status of creation
- assert:
+- name: Check status of creation
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == False
@@ -212,18 +197,15 @@
fail_msg: "Fail: Unable to update software profile"
success_msg: "Pass: Software profile updated successfully"
-
-- name: idempotency checks
+- name: Idempotency checks
ntnx_ndb_profiles:
profile_uuid: "{{profile_uuid}}"
name: "{{profile1_name}}-updated1"
desc: "{{profile1_name}}-desc-updated"
register: result
-
-
-- name: check status of creation
- assert:
+- name: Check status of creation
+ ansible.builtin.assert:
that:
- result.changed == False
- result.failed == False
@@ -236,8 +218,8 @@
fail_msg: "Fail: Update didn't get skipped due to no state changes"
success_msg: "Pass: Update skipped successfully due to no state changes"
-- name: create software profile version spec
- check_mode: yes
+- name: Create software profile version spec
+ check_mode: true
ntnx_ndb_profiles:
profile_uuid: "{{profile_uuid}}"
database_type: "postgres"
@@ -252,54 +234,53 @@
register: result
-- set_fact:
- expected_result: {
+- name: Set expected result
+ ansible.builtin.set_fact:
+ expected_result:
+ {
"changed": false,
"error": null,
"failed": false,
"profile_type": "software",
"profile_uuid": "{{profile_uuid}}",
- "response": {
- "profile": {
+ "response":
+ {
+ "profile":
+ {
"description": "{{profile1_name}}-desc-updated",
"engineType": "postgres_database",
- "name": "{{profile1_name}}-updated1"
- },
- "version": {
+ "name": "{{profile1_name}}-updated1",
+ },
+ "version":
+ {
"description": "v2.0-desc",
"engineType": "postgres_database",
"name": "v2.0",
- "properties": [
- {
- "name": "OS_NOTES",
- "value": "os_notes for v2"
- },
+ "properties":
+ [
+ { "name": "OS_NOTES", "value": "os_notes for v2" },
+ { "name": "DB_SOFTWARE_NOTES", "value": "db_notes for v2" },
{
- "name": "DB_SOFTWARE_NOTES",
- "value": "db_notes for v2"
+ "name": "SOURCE_DBSERVER_ID",
+ "value": "{{db_server_vm.uuid}}",
},
- {
- "name": "SOURCE_DBSERVER_ID",
- "value": "{{db_server_vm.uuid}}"
- }
- ],
+ ],
"systemProfile": false,
"topology": null,
- "type": "Software"
- }
- }
- }
+ "type": "Software",
+ },
+ },
+ }
-- name: check spec for creating spec for software profile version
- assert:
+- name: Check spec for creating spec for software profile version
+ ansible.builtin.assert:
that:
- result == expected_result
fail_msg: "Fail: Unable to create spec for software profile version create"
success_msg: "Pass: Spec for creating software profile version generated successfully"
-
-- name: create software profile version
+- name: Create software profile version
ntnx_ndb_profiles:
profile_uuid: "{{profile_uuid}}"
database_type: "postgres"
@@ -314,10 +295,8 @@
register: result
-
-
-- name: check status of version create
- assert:
+- name: Check status of version create
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == False
@@ -334,11 +313,12 @@
fail_msg: "Fail: Unable to create software profile version"
success_msg: "Pass: Software profile version created successfully"
-- set_fact:
+- name: Set version_uuid
+ ansible.builtin.set_fact:
version_uuid: "{{result.version_uuid}}"
-- name: create spec for update software profile version
- check_mode: yes
+- name: Create spec for update software profile version
+ check_mode: true
ntnx_ndb_profiles:
profile_uuid: "{{profile_uuid}}"
database_type: "postgres"
@@ -349,10 +329,8 @@
register: result
-
-
-- name: check status of spec
- assert:
+- name: Check status of spec
+ ansible.builtin.assert:
that:
- result.changed == False
- result.failed == False
@@ -366,8 +344,7 @@
fail_msg: "Fail: Unable to create spec for updating software profile version"
success_msg: "Pass: Spec for updating software profile version created successfully"
-
-- name: update software profile version
+- name: Update software profile version
ntnx_ndb_profiles:
profile_uuid: "{{profile_uuid}}"
database_type: "postgres"
@@ -378,10 +355,8 @@
register: result
-
-
-- name: check status of update
- assert:
+- name: Check status of update
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == False
@@ -401,22 +376,20 @@
fail_msg: "Fail: Unable to update software profile version"
success_msg: "Pass: Software profile version updated successfully"
-
-- set_fact:
+- name: Set version_uuid
+ ansible.builtin.set_fact:
version_uuid: "{{result.version_uuid}}"
-- name: publish software profile version
+- name: Publish software profile version
ntnx_ndb_profiles:
profile_uuid: "{{profile_uuid}}"
software:
version_uuid: "{{version_uuid}}"
- publish: True
+ publish: true
register: result
-
-
-- name: check status of update
- assert:
+- name: Check status of update
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == False
@@ -431,7 +404,7 @@
fail_msg: "Fail: Unable to publish software profile version"
success_msg: "Pass: Software profile version published successfully"
-- name: unpublish software profile version
+- name: Unpublish software profile version
ntnx_ndb_profiles:
profile_uuid: "{{profile_uuid}}"
software:
@@ -439,8 +412,8 @@
publish: false
register: result
-- name: check status of update
- assert:
+- name: Check status of update
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == False
@@ -455,19 +428,16 @@
fail_msg: "Fail: Unable to unpublish software profile version"
success_msg: "Pass: Software version unpublished successfully"
-
-- name: deprecate software profile version
+- name: Deprecate software profile version
ntnx_ndb_profiles:
profile_uuid: "{{profile_uuid}}"
software:
version_uuid: "{{version_uuid}}"
- deprecate: True
+ deprecate: true
register: result
-
-
-- name: check status of update
- assert:
+- name: Check status of update
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == False
@@ -482,9 +452,7 @@
fail_msg: "Fail: Unable to deprecate software profile version"
success_msg: "Pass: Software version deprecated successfully"
-
-
-- name: delete software profile version
+- name: Delete software profile version
ntnx_ndb_profiles:
profile_uuid: "{{profile_uuid}}"
software:
@@ -492,9 +460,8 @@
state: "absent"
register: result
-
-- name: check status of update
- assert:
+- name: Check status of update
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == False
@@ -506,33 +473,32 @@
fail_msg: "Fail: Unable to delete software profile version"
success_msg: "Pass: Software version deleted successfully"
-
-- name: replicate software profile
+- name: Replicate software profile
ntnx_ndb_profiles:
profile_uuid: "{{profile_uuid}}"
clusters:
- name: "{{cluster.cluster2.name}}"
register: result
-- name: wait for 3 minutes for replication to finish from source cluster to cluster2
+- name: Wait for 3 minutes for replication to finish from source cluster to cluster2
ansible.builtin.pause:
minutes: 3
-
-- set_fact:
+- name: Reset clusters variable
+ ansible.builtin.set_fact:
clusters: {}
# skip jekyll/Liquid syntax check
# {% raw %}
-- name: create clusters status map
- set_fact:
+- name: Create clusters status map
+ ansible.builtin.set_fact:
clusters: "{{ clusters | default({}) | combine ({ item['nxClusterId'] : item['status'] }) }}"
loop: "{{result.response.profile.clusterAvailability}}"
- no_log: True
+ no_log: true
# {% endraw %}
-- name: check status of replication
- assert:
+- name: Check status of replication
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == False
@@ -545,15 +511,14 @@
fail_msg: "Fail: Unable to replicate software profile"
success_msg: "Pass: Software profile replicated successfully"
-- name: delete software profile
+- name: Delete software profile
ntnx_ndb_profiles:
profile_uuid: "{{profile_uuid}}"
state: "absent"
register: result
-
-- name: check status of delete
- assert:
+- name: Check status of delete
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == False
diff --git a/tests/integration/targets/ntnx_ndb_software_profiles/tasks/main.yml b/tests/integration/targets/ntnx_ndb_software_profiles/tasks/main.yml
index b25157ea7..d46f619db 100644
--- a/tests/integration/targets/ntnx_ndb_software_profiles/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_software_profiles/tasks/main.yml
@@ -1,10 +1,12 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ndb_ip }}"
- nutanix_username: "{{ ndb_username }}"
- nutanix_password: "{{ ndb_password }}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ndb_ip }}"
+ nutanix_username: "{{ ndb_username }}"
+ nutanix_password: "{{ ndb_password }}"
+ validate_certs: false
block:
- - import_tasks: "crud.yml"
+ - name: Import "crud.yml"
+ ansible.builtin.import_tasks: "crud.yml"
diff --git a/tests/integration/targets/ntnx_ndb_tags/tasks/crud.yml b/tests/integration/targets/ntnx_ndb_tags/tasks/crud.yml
index b719db279..d07476437 100644
--- a/tests/integration/targets/ntnx_ndb_tags/tasks/crud.yml
+++ b/tests/integration/targets/ntnx_ndb_tags/tasks/crud.yml
@@ -1,37 +1,40 @@
---
-
-- debug:
+- name: Start testing ntnx_ndb_tags
+ ansible.builtin.debug:
msg: "start ntnx_ndb_tags"
- name: Generate random name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)}}"
-- set_fact:
+- name: Set tag names
+ ansible.builtin.set_fact:
tag_name: "{{random_name[0]}}"
tag_name_updated: "{{random_name[0]}}-updated"
############################# Create tests ########################
-- name: check mode for creation
- check_mode: yes
+- name: Check mode for creation
+ check_mode: true
ntnx_ndb_tags:
name: "{{tag_name}}-timemachine"
desc: tag-created-by-ansible
- tag_value_required: True
+ tag_value_required: true
entity_type: TIME_MACHINE
register: result
-- set_fact:
- expected_response: {
- "description": "tag-created-by-ansible",
- "entityType": "TIME_MACHINE",
- "name": "{{tag_name}}-timemachine",
- "required": true
- }
+- name: Set expected_response
+ ansible.builtin.set_fact:
+ expected_response:
+ {
+ "description": "tag-created-by-ansible",
+ "entityType": "TIME_MACHINE",
+ "name": "{{tag_name}}-timemachine",
+ "required": true,
+ }
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -40,17 +43,16 @@
fail_msg: "Unable to create spec for tag"
success_msg: "Spec generated successfully for tag creation"
-
-- name: create tags for clone
+- name: Create tags for clone
ntnx_ndb_tags:
name: "{{tag_name}}-clone"
desc: tag-created-by-ansible
- tag_value_required: True
+ tag_value_required: true
entity_type: CLONE
register: result
- name: Check create status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -63,19 +65,20 @@
fail_msg: "Tag for clone create failed"
success_msg: "Tag for clone created successfully"
-- set_fact:
+- name: Set clone tag uuid
+ ansible.builtin.set_fact:
clone_tag_uuid: "{{result.uuid}}"
-- name: create tags for database server
+- name: Create tags for database server
ntnx_ndb_tags:
name: "{{tag_name}}-database-server"
desc: tag-created-by-ansible
- tag_value_required: True
+ tag_value_required: true
entity_type: DATABASE_SERVER
register: result
- name: Check create status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -88,19 +91,20 @@
fail_msg: "Tag for database server create failed"
success_msg: "Tag for clone created successfully"
-- set_fact:
+- name: Set database server tag uuid
+ ansible.builtin.set_fact:
db_server_tag_uuid: "{{result.uuid}}"
-- name: create tags for time machine
+- name: Create tags for time machine
ntnx_ndb_tags:
name: "{{tag_name}}-time-machine"
desc: tag-created-by-ansible
- tag_value_required: True
+ tag_value_required: true
entity_type: TIME_MACHINE
register: result
- name: Check create status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -113,22 +117,24 @@
fail_msg: "Tag for time machine create failed"
success_msg: "Tag for time machine created successfully"
-- set_fact:
+- name: Set time machine tag uuid
+ ansible.builtin.set_fact:
time_machine_tag_uuid: "{{result.uuid}}"
-- name: create tags for databases
+- name: Create tags for databases
ntnx_ndb_tags:
name: "{{tag_name}}-database"
desc: tag-created-by-ansible
- tag_value_required: False
+ tag_value_required: false
entity_type: DATABASE
register: result
-- set_fact:
+- name: Set database tag uuid
+ ansible.builtin.set_fact:
database_tag_uuid: "{{result.uuid}}"
-- name: check create status
- assert:
+- name: Check create status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -140,19 +146,20 @@
fail_msg: "Tag create for databases failed"
success_msg: "Tag created successfully"
-- name: create another tag for databases
+- name: Create another tag for databases
ntnx_ndb_tags:
name: "{{tag_name}}-database2"
desc: tag-created-by-ansible
- tag_value_required: False
+ tag_value_required: false
entity_type: DATABASE
register: result
-- set_fact:
+- name: Set database tag uuid
+ ansible.builtin.set_fact:
database_tag2_uuid: "{{result.uuid}}"
-- name: check create status
- assert:
+- name: Check create status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -164,15 +171,14 @@
fail_msg: "Tag create for databases failed"
success_msg: "Tag created successfully"
-
################################# Info Module tests ##########################
-- name: get all tags
+- name: Get all tags
ntnx_ndb_tags_info:
register: result
- name: Check info status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -181,13 +187,13 @@
fail_msg: "Fetching all tags failed"
success_msg: "All tags obtained successfully"
-- name: get tag based on uuid
+- name: Get tag based on uuid
ntnx_ndb_tags_info:
uuid: "{{database_tag_uuid}}"
register: result
- name: Check info status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -197,14 +203,14 @@
fail_msg: "get tag based on uuid failed"
success_msg: "tag based on uuid obtained successfully"
-- name: get all tags based on DATABASE entity type
+- name: Get all tags based on DATABASE entity type
ntnx_ndb_tags_info:
filters:
entity_type: "DATABASE"
register: result
- name: Check info status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -214,14 +220,14 @@
fail_msg: "get all tags based on DATABASE entity type failed"
success_msg: "all tags based on DATABASE entity type obtained successfully"
-- name: get all tags based on CLONE entity type
+- name: Get all tags based on CLONE entity type
ntnx_ndb_tags_info:
filters:
entity_type: "CLONE"
register: result
- name: Check info status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -231,14 +237,14 @@
fail_msg: "get all tags based on CLONE entity type failed"
success_msg: "all tags based on CLONE entity type obtained successfully"
-- name: get all tags based on TIME_MACHINE entity type
+- name: Get all tags based on TIME_MACHINE entity type
ntnx_ndb_tags_info:
filters:
entity_type: "TIME_MACHINE"
register: result
- name: Check info status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -248,15 +254,14 @@
fail_msg: "get all tags based on TIME_MACHINE entity type failed"
success_msg: "all tags based on TIME_MACHINE entity type obtained successfully"
-
-- name: get all tags based on DATABASE_SERVER entity type
+- name: Get all tags based on DATABASE_SERVER entity type
ntnx_ndb_tags_info:
filters:
entity_type: "DATABASE_SERVER"
register: result
- name: Check info status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -266,17 +271,15 @@
fail_msg: "get all tags based on DATABASE_SERVER entity type failed"
success_msg: "all tags based on DATABASE_SERVER entity type obtained successfully"
-
-- name: get tag based on DATABASE entity type and name
+- name: Get tag based on DATABASE entity type and name
ntnx_ndb_tags_info:
filters:
entity_type: "DATABASE"
name: "{{tag_name}}-database2"
register: result
-
- name: Check info status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -287,10 +290,11 @@
success_msg: "tags based on DATABASE entity type and name obtained successfully"
################################## Update tests ########################
-- set_fact:
+- name: Set database tag uuid
+ ansible.builtin.set_fact:
tag_uuid: "{{database_tag_uuid}}"
-- name: update tag
+- name: Update tag
ntnx_ndb_tags:
uuid: "{{tag_uuid}}"
name: "{{tag_name_updated}}"
@@ -300,7 +304,7 @@
register: result
- name: Check update status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -312,9 +316,7 @@
fail_msg: "tag update failed"
success_msg: "tag updated successfully"
-
-
-- name: idempotency checks
+- name: Idempotency checks
ntnx_ndb_tags:
uuid: "{{tag_uuid}}"
name: "{{tag_name_updated}}"
@@ -323,10 +325,8 @@
status: "DEPRECATED"
register: result
-
-
-- name: check idempotency status
- assert:
+- name: Check idempotency status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -334,18 +334,15 @@
fail_msg: "tag got updated"
success_msg: "tag update skipped due to no state changes"
-
-- name: enable tag
+- name: Enable tag
ntnx_ndb_tags:
uuid: "{{tag_uuid}}"
tag_value_required: true
status: "ENABLED"
register: result
-
-
-- name: check status changes
- assert:
+- name: Check status changes
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -356,16 +353,14 @@
############################################################### delete tests ########################################
-
-- name: delete the database based tag
+- name: Delete the database based tag
ntnx_ndb_tags:
state: "absent"
uuid: "{{database_tag_uuid}}"
register: result
-
- name: Check delete status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -373,14 +368,14 @@
fail_msg: "Unable to delete tag"
success_msg: "tag deleted successfully"
-- name: delete the database based tag
+- name: Delete the database based tag
ntnx_ndb_tags:
state: "absent"
uuid: "{{database_tag2_uuid}}"
register: result
- name: Check delete status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -388,15 +383,14 @@
fail_msg: "Unable to delete tag"
success_msg: "tag deleted successfully"
-
-- name: delete the clone tag
+- name: Delete the clone tag
ntnx_ndb_tags:
state: "absent"
uuid: "{{clone_tag_uuid}}"
register: result
- name: Check delete status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -404,15 +398,14 @@
fail_msg: "Unable to delete tag"
success_msg: "tag deleted successfully"
-
-- name: delete the time machine based tag
+- name: Delete the time machine based tag
ntnx_ndb_tags:
state: "absent"
uuid: "{{time_machine_tag_uuid}}"
register: result
- name: Check delete status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -420,15 +413,14 @@
fail_msg: "Unable to delete tag"
success_msg: "tag deleted successfully"
-
-- name: delete the database server based tag
+- name: Delete the database server based tag
ntnx_ndb_tags:
state: "absent"
uuid: "{{db_server_tag_uuid}}"
register: result
- name: Check delete status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
diff --git a/tests/integration/targets/ntnx_ndb_tags/tasks/main.yml b/tests/integration/targets/ntnx_ndb_tags/tasks/main.yml
index 5216bd0e2..5e1bbbe13 100644
--- a/tests/integration/targets/ntnx_ndb_tags/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_tags/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ndb_ip }}"
- nutanix_username: "{{ ndb_username }}"
- nutanix_password: "{{ ndb_password }}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ndb_ip }}"
+ nutanix_username: "{{ ndb_username }}"
+ nutanix_password: "{{ ndb_password }}"
+ validate_certs: false
block:
- - import_tasks: "crud.yml"
+ - name: Import "crud.yml"
+ ansible.builtin.import_tasks: "crud.yml"
diff --git a/tests/integration/targets/ntnx_ndb_time_machines_info/tasks/info.yml b/tests/integration/targets/ntnx_ndb_time_machines_info/tasks/info.yml
index c76966670..29cb5cc47 100644
--- a/tests/integration/targets/ntnx_ndb_time_machines_info/tasks/info.yml
+++ b/tests/integration/targets/ntnx_ndb_time_machines_info/tasks/info.yml
@@ -1,13 +1,14 @@
---
-- debug:
+- name: Start testing ntnx_ndb_time_machines_info
+ ansible.builtin.debug:
msg: Start testing ntnx_ndb_time_machines_info
- name: List all NDB tms
ntnx_ndb_time_machines_info:
register: tms
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- tms.response is defined
- tms.failed == false
@@ -23,8 +24,8 @@
value: "{{tms.response[0].name}}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -34,14 +35,13 @@
fail_msg: "Unable to list all NDB tms using filter"
success_msg: "NDB tms listed successfully using filter"
################################################################
-- name: get NDB tms using it's name
+- name: Get NDB tms using it's name
ntnx_ndb_time_machines_info:
name: "{{tms.response[0].name}}"
register: result
-
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -55,8 +55,8 @@
uuid: "{{tms.response[0].id}}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -74,8 +74,8 @@
load_database: true
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -87,15 +87,15 @@
################################################################
-- name: get NDB timemachine with incorrect name
+- name: Get NDB timemachine with incorrect name
ntnx_ndb_time_machines_info:
name: "abcd"
register: result
no_log: true
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.error is defined
- result.failed == true
diff --git a/tests/integration/targets/ntnx_ndb_time_machines_info/tasks/main.yml b/tests/integration/targets/ntnx_ndb_time_machines_info/tasks/main.yml
index da502fcc5..8e7493b9f 100644
--- a/tests/integration/targets/ntnx_ndb_time_machines_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_time_machines_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ndb_ip}}"
- nutanix_username: "{{ndb_username}}"
- nutanix_password: "{{ndb_password}}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ndb_ip}}"
+ nutanix_username: "{{ndb_username}}"
+ nutanix_password: "{{ndb_password}}"
+ validate_certs: false
block:
- - import_tasks: "info.yml"
+ - name: Import "info.yml"
+ ansible.builtin.import_tasks: "info.yml"
diff --git a/tests/integration/targets/ntnx_ndb_time_machines_with_multi_clusters/tasks/data_access_management_and_snapshots.yml b/tests/integration/targets/ntnx_ndb_time_machines_with_multi_clusters/tasks/data_access_management_and_snapshots.yml
index 57ced74b3..bae26d95c 100644
--- a/tests/integration/targets/ntnx_ndb_time_machines_with_multi_clusters/tasks/data_access_management_and_snapshots.yml
+++ b/tests/integration/targets/ntnx_ndb_time_machines_with_multi_clusters/tasks/data_access_management_and_snapshots.yml
@@ -1,8 +1,9 @@
---
-- debug:
+- name: Start testing ntnx_ndb_time_machine_clusters
+ ansible.builtin.debug:
msg: Start testing ntnx_ndb_time_machine_clusters
-- name: create data access instance with cluster name and sla name
+- name: Create data access instance with cluster name and sla name
ntnx_ndb_time_machine_clusters:
time_machine_uuid: "{{time_machine.uuid}}"
cluster:
@@ -11,9 +12,8 @@
name: "{{sla.name}}"
register: out
-
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- out.response is defined
- out.time_machine_uuid is defined
@@ -23,19 +23,17 @@
fail_msg: "fail: Unable create data access instance with cluster name and sla name"
success_msg: "pass: create data access instance with cluster name and sla name finished successfully"
#######################
-- name: update data access instance with new sla name
+- name: Update data access instance with new sla name
ntnx_ndb_time_machine_clusters:
- time_machine_uuid: "{{time_machine.uuid}}"
- cluster:
- name: "{{cluster.cluster2.name}}"
- sla:
- name: "{{sla2.name}}"
+ time_machine_uuid: "{{time_machine.uuid}}"
+ cluster:
+ name: "{{cluster.cluster2.name}}"
+ sla:
+ name: "{{sla2.name}}"
register: result
-
-
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.time_machine_uuid is defined
@@ -46,18 +44,17 @@
fail_msg: "fail: Unable to update data access instance with new sla name"
success_msg: "pass: update data access instance with new sla name finished successfully"
-
-- name: idempotency checks
+- name: Idempotency checks
ntnx_ndb_time_machine_clusters:
- time_machine_uuid: "{{time_machine.uuid}}"
- cluster:
- name: "{{cluster.cluster2.name}}"
- sla:
- name: "{{sla2.name}}"
+ time_machine_uuid: "{{time_machine.uuid}}"
+ cluster:
+ name: "{{cluster.cluster2.name}}"
+ sla:
+ name: "{{sla2.name}}"
register: result
-- name: check idempotency status
- assert:
+- name: Check idempotency status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -65,13 +62,12 @@
fail_msg: "clusters in time machine go updated"
success_msg: "update of clusters in time machine skipped due to no state changes"
-
############################################## multicluster snapshots and replication tests #########################
# cluster1: primary cluster
# cluster2: secondary cluster
-- name: create snapshot on cluster2
+- name: Create snapshot on cluster2
ntnx_ndb_database_snapshots:
name: "ansible-created-snapshot-on-{{cluster.cluster2.name}}"
time_machine_uuid: "{{time_machine.uuid}}"
@@ -79,8 +75,8 @@
- name: "{{cluster.cluster2.name}}"
register: result
-- name: check snapshot status
- assert:
+- name: Check snapshot status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.snapshot_uuid is defined
@@ -92,27 +88,24 @@
fail_msg: "fail: Unable to create snapshot for secondary cluster"
success_msg: "pass: snapshot created successfully for secondary cluster"
-
-- name: wait for 2 minutes for replication to finish from source cluster to cluster2
+- name: Wait for 2 minutes for replication to finish from source cluster to cluster2
ansible.builtin.pause:
minutes: 2
-- name: check the status of post of replication if snapshot is active
+- name: Check the status of post of replication if snapshot is active
ntnx_ndb_snapshots_info:
uuid: "{{result.snapshot_uuid}}"
register: result
-- name: check snapshot status
- assert:
+- name: Check snapshot status
+ ansible.builtin.assert:
that:
- result.response.name == "ansible-created-snapshot-on-{{cluster.cluster2.name}}"
- result.response.status == "ACTIVE"
fail_msg: "fail: Unable to check snapshot status post internal replication"
success_msg: "pass: snapshot replicated successfully on secondary cluster"
-
-
-- name: create a snapshot on cluster1
+- name: Create a snapshot on cluster1
ntnx_ndb_database_snapshots:
name: "ansible-created-snapshot-on-{{cluster.cluster1.name}}"
time_machine_uuid: "{{time_machine.uuid}}"
@@ -120,8 +113,8 @@
- uuid: "{{cluster.cluster1.uuid}}"
register: result
-- name: check snapshot status on cluster2
- assert:
+- name: Check snapshot status on cluster2
+ ansible.builtin.assert:
that:
- result.response is defined
- result.snapshot_uuid is defined
@@ -132,12 +125,12 @@
fail_msg: "fail: Unable to create snapshot on primary cluster"
success_msg: "pass: snapshot created successfully on primary cluster"
-- name: setting snapshot uuid for replication
- set_fact:
+- name: Setting snapshot uuid for replication
+ ansible.builtin.set_fact:
snapshot_uuid: "{{result.snapshot_uuid}}"
-- name: create spec for replicating snapshot from cluster1 on cluster2
- check_mode: yes
+- name: Create spec for replicating snapshot from cluster1 on cluster2
+ check_mode: true
ntnx_ndb_replicate_database_snapshots:
snapshot_uuid: "{{snapshot_uuid}}"
clusters:
@@ -145,37 +138,33 @@
expiry_days: 20
register: result
-- set_fact:
- expected_result: {
+- name: Set expected result
+ ansible.builtin.set_fact:
+ expected_result:
+ {
"changed": false,
"error": null,
"failed": false,
- "response": {
- "lcmConfig": {
- "snapshotLCMConfig": {
- "expiryDetails": {
- "expireInDays": 20
- }
- }
- },
- "nxClusterIds": [
- "{{cluster.cluster2.uuid}}"
- ]
- },
- "snapshot_uuid": "{{snapshot_uuid}}"
- }
-
-
-
-- name: check snapshot replication spec
- assert:
+ "response":
+ {
+ "lcmConfig":
+ {
+ "snapshotLCMConfig":
+ { "expiryDetails": { "expireInDays": 20 } },
+ },
+ "nxClusterIds": ["{{cluster.cluster2.uuid}}"],
+ },
+ "snapshot_uuid": "{{snapshot_uuid}}",
+ }
+
+- name: Check snapshot replication spec
+ ansible.builtin.assert:
that:
- result == expected_result
fail_msg: "fail: Unable to create snapshot replication snapshot"
success_msg: "pass: snapshot replication spec created successfully"
-
-- name: replicate snapshot on cluster2
+- name: Replicate snapshot on cluster2
ntnx_ndb_replicate_database_snapshots:
snapshot_uuid: "{{snapshot_uuid}}"
clusters:
@@ -183,10 +172,8 @@
expiry_days: 20
register: result
-
-
-- name: verify status of snapshot replication
- assert:
+- name: Verify status of snapshot replication
+ ansible.builtin.assert:
that:
- result.changed == True
- result.failed == false
@@ -196,16 +183,16 @@
#######################
-- name: delete time machine
+- name: Delete time machine
ntnx_ndb_time_machine_clusters:
- state: absent
- time_machine_uuid: "{{time_machine.uuid}}"
- cluster:
- uuid: "{{cluster.cluster2.uuid}}"
+ state: absent
+ time_machine_uuid: "{{time_machine.uuid}}"
+ cluster:
+ uuid: "{{cluster.cluster2.uuid}}"
register: result
-- name: check delete status
- assert:
+- name: Check delete status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.time_machine_uuid is defined
@@ -214,22 +201,22 @@
fail_msg: "fail: Unable to remove cluster from time machine"
success_msg: "pass: cluster from time machine removed successfully"
-- name: wait for 2 minutes for internal cleanup to finish
+- name: Wait for 2 minutes for internal cleanup to finish
ansible.builtin.pause:
minutes: 5
#####################
-- name: create data access instance with cluster uuid and sla uuid
+- name: Create data access instance with cluster uuid and sla uuid
ntnx_ndb_time_machine_clusters:
- time_machine_uuid: "{{time_machine.uuid}}"
- cluster:
- uuid: "{{cluster.cluster2.uuid}}"
- sla:
- uuid: "{{sla.uuid}}"
+ time_machine_uuid: "{{time_machine.uuid}}"
+ cluster:
+ uuid: "{{cluster.cluster2.uuid}}"
+ sla:
+ uuid: "{{sla.uuid}}"
register: out
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- out.response is defined
- out.time_machine_uuid is defined
@@ -239,17 +226,17 @@
fail_msg: "fail: Unable create data access instance with cluster uuid and sla uuid"
success_msg: "pass: create data access instance with cluster uuid and sla uuid finished successfully"
#######################
-- name: update data access instance with sla uuid
+- name: Update data access instance with sla uuid
ntnx_ndb_time_machine_clusters:
- time_machine_uuid: "{{time_machine.uuid}}"
- cluster:
- uuid: "{{cluster.cluster2.uuid}}"
- sla:
- uuid: "{{sla2.uuid}}"
+ time_machine_uuid: "{{time_machine.uuid}}"
+ cluster:
+ uuid: "{{cluster.cluster2.uuid}}"
+ sla:
+ uuid: "{{sla2.uuid}}"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.time_machine_uuid is defined
@@ -260,16 +247,16 @@
fail_msg: "fail: Unable to update data access instance with sla uuid"
success_msg: "pass: update data access instance with sla uuid finished successfully"
-- name: delete time machine
+- name: Delete time machine
ntnx_ndb_time_machine_clusters:
- state: absent
- time_machine_uuid: "{{result.time_machine_uuid}}"
- cluster:
- uuid: "{{cluster.cluster2.uuid}}"
+ state: absent
+ time_machine_uuid: "{{result.time_machine_uuid}}"
+ cluster:
+ uuid: "{{cluster.cluster2.uuid}}"
register: result
-- name: check delete status
- assert:
+- name: Check delete status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.time_machine_uuid is defined
@@ -277,5 +264,4 @@
- result.failed == false
fail_msg: "fail: Unable to remove cluster from time machine"
success_msg: "pass: cluster from time machine removed successfully"
-
#######################
diff --git a/tests/integration/targets/ntnx_ndb_time_machines_with_multi_clusters/tasks/main.yml b/tests/integration/targets/ntnx_ndb_time_machines_with_multi_clusters/tasks/main.yml
index df1211a7a..e360a1556 100644
--- a/tests/integration/targets/ntnx_ndb_time_machines_with_multi_clusters/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_time_machines_with_multi_clusters/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ndb_ip}}"
- nutanix_username: "{{ndb_username}}"
- nutanix_password: "{{ndb_password}}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ndb_ip}}"
+ nutanix_username: "{{ndb_username}}"
+ nutanix_password: "{{ndb_password}}"
+ validate_certs: false
block:
- - import_tasks: "data_access_management_and_snapshots.yml"
+ - name: Import "data_access_management_and_snapshots.yml"
+ ansible.builtin.import_tasks: "data_access_management_and_snapshots.yml"
diff --git a/tests/integration/targets/ntnx_ndb_vlans/tasks/create_vlans.yml b/tests/integration/targets/ntnx_ndb_vlans/tasks/create_vlans.yml
index adcdcc300..37f2bf73e 100644
--- a/tests/integration/targets/ntnx_ndb_vlans/tasks/create_vlans.yml
+++ b/tests/integration/targets/ntnx_ndb_vlans/tasks/create_vlans.yml
@@ -1,19 +1,20 @@
---
-- debug:
+- name: Start testing ntnx_ndb_vlans
+ ansible.builtin.debug:
msg: Start testing ntnx_ndb_vlans
-- name: create Dhcp ndb vlan
+- name: Create Dhcp ndb vlan
ntnx_ndb_vlans:
- name: "{{ndb_vlan.name}}"
+ name: "{{ndb_vlan.name}}"
vlan_type: DHCP
cluster:
uuid: "{{cluster.cluster2.uuid}}"
register: result
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -28,30 +29,26 @@
################################################################
-
-- name: update ndb vlan type for static
+- name: Update ndb vlan type for static
ntnx_ndb_vlans:
vlan_uuid: "{{result.vlan_uuid}}"
vlan_type: Static
gateway: "{{ndb_vlan.gateway}}"
subnet_mask: "{{ndb_vlan.subnet_mask}}"
ip_pools:
- -
- start_ip: "{{ndb_vlan.ip_pools.0.start_ip}}"
+ - start_ip: "{{ndb_vlan.ip_pools.0.start_ip}}"
end_ip: "{{ndb_vlan.ip_pools.0.end_ip}}"
- -
- start_ip: "{{ndb_vlan.ip_pools.1.start_ip}}"
+ - start_ip: "{{ndb_vlan.ip_pools.1.start_ip}}"
end_ip: "{{ndb_vlan.ip_pools.1.end_ip}}"
primary_dns: "{{ndb_vlan.primary_dns}}"
secondary_dns: "{{ndb_vlan.secondary_dns}}"
dns_domain: "{{ndb_vlan.dns_domain}}"
register: result
- ignore_errors: True
+ ignore_errors: true
no_log: true
-
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vlan_uuid is defined
@@ -72,20 +69,22 @@
fail_msg: "fail: unable to update ndb vlan type for static"
success_msg: "pass: update ndb vlan type for static finished successfully"
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
-- set_fact:
+- name: Add vlan_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.vlan_uuid ] }}"
################################################################
- name: List all NDB vlans
ntnx_ndb_vlans_info:
register: vlans
no_log: true
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- vlans.response is defined
- vlans.failed == false
@@ -96,15 +95,15 @@
################################################################
-- name: get NDB vlans using it's name
+- name: Get NDB vlans using it's name
ntnx_ndb_vlans_info:
name: "{{vlans.response[0].name}}"
register: result
no_log: true
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -120,10 +119,10 @@
uuid: "{{vlans.response[0].id}}"
register: result
no_log: true
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -134,15 +133,15 @@
################################################################
-- name: get NDB vlans with incorrect name
+- name: Get NDB vlans with incorrect name
ntnx_ndb_vlans_info:
name: "abcd"
register: result
no_log: true
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.error is defined
- result.failed == true
@@ -157,37 +156,36 @@
vlan_uuid: "{{ todelete[0]}}"
register: result
no_log: true
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
################################################################
-- name: create static ndb vlan
+- name: Create static ndb vlan
ntnx_ndb_vlans:
- name: "{{ndb_vlan.name}}"
+ name: "{{ndb_vlan.name}}"
vlan_type: Static
cluster:
uuid: "{{cluster.cluster2.uuid}}"
gateway: "{{ndb_vlan.gateway}}"
subnet_mask: "{{ndb_vlan.subnet_mask}}"
ip_pools:
- -
- start_ip: "{{ndb_vlan.ip_pools.0.start_ip}}"
+ - start_ip: "{{ndb_vlan.ip_pools.0.start_ip}}"
end_ip: "{{ndb_vlan.ip_pools.0.end_ip}}"
- -
- start_ip: "{{ndb_vlan.ip_pools.1.start_ip}}"
+ - start_ip: "{{ndb_vlan.ip_pools.1.start_ip}}"
end_ip: "{{ndb_vlan.ip_pools.1.end_ip}}"
primary_dns: "{{ndb_vlan.primary_dns}}"
secondary_dns: "{{ndb_vlan.secondary_dns}}"
dns_domain: "{{ndb_vlan.dns_domain}}"
register: result
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vlan_uuid is defined
@@ -207,23 +205,24 @@
- result.response.ipPools[1].startIP == "{{ndb_vlan.ip_pools.1.start_ip}}"
fail_msg: "fail: unable to create static ndb vlan"
success_msg: "pass: create static ndb vlan finished successfully"
-- set_fact:
+- name: Add vlan_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.vlan_uuid ] }}"
################################################################
-- name: update ndb vlan by removing ip pool
+- name: Update ndb vlan by removing ip pool
ntnx_ndb_vlans:
vlan_uuid: "{{result.vlan_uuid}}"
remove_ip_pools:
- "{{result.response.ipPools[0].id}}"
- "{{result.response.ipPools[1].id}}"
register: result
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vlan_uuid is defined
@@ -243,19 +242,18 @@
################################################################
-- name: update ndb vlan by adding a pool
+- name: Update ndb vlan by adding a pool
ntnx_ndb_vlans:
vlan_uuid: "{{result.vlan_uuid}}"
ip_pools:
- -
- start_ip: "{{ndb_vlan.ip_pools.0.start_ip}}"
+ - start_ip: "{{ndb_vlan.ip_pools.0.start_ip}}"
end_ip: "{{ndb_vlan.ip_pools.0.end_ip}}"
register: result
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -277,7 +275,7 @@
################################################################
-- name: update ndb vLAN Configuration
+- name: Update ndb vLAN Configuration
ntnx_ndb_vlans:
vlan_uuid: "{{result.vlan_uuid}}"
gateway: "{{ndb_vlan.updated_gateway}}"
@@ -286,11 +284,11 @@
secondary_dns: "{{ndb_vlan.updated_secondary_dns}}"
dns_domain: "{{ndb_vlan.updated_dns_domain}}"
register: result
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -307,16 +305,16 @@
################################################################
-- name: update ndb vlan type
+- name: Update ndb vlan type
ntnx_ndb_vlans:
vlan_uuid: "{{result.vlan_uuid}}"
vlan_type: DHCP
register: result
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -331,7 +329,7 @@
################################################################
-# - name: create ndb_stretched vlan
+# - name: Create ndb_stretched vlan
# ntnx_ndb_stretched_vlans:
# name: "{{st_vlan.name}}"
# desc: "{{st_vlan.desc}}"
@@ -340,10 +338,10 @@
# - "{{st_vlan.vlans_subnet1[1]}}"
# register: result
# ignore_errors: true
-# - debug:
+# - ansible.builtin.debug:
# var: result
-# - name: check listing status
-# assert:
+# - name: Check listing status
+# ansible.builtin.assert:
# that:
# - result.response is defined
# - result.changed == true
@@ -356,13 +354,12 @@
# fail_msg: "fail: Unable to create ndb_stretched vlan"
# success_msg: "pass: create ndb_stretched vlan finished successfully"
-# - set_fact:
+# - ansible.builtin.set_fact:
# todelete: "{{ todelete + [ result.vlan_uuid ] }}"
# ################################################################
-
-# - name: update ndb_stretched vlan name, desc and vlans
+# - name: Update ndb_stretched vlan name, desc and vlans
# ntnx_ndb_stretched_vlans:
# name: newname
# desc: newdesc
@@ -372,10 +369,10 @@
# - "{{st_vlan.vlans_subnet2[1]}}"
# register: result
# ignore_errors: true
-# - debug:
+# - ansible.builtin.debug:
# var: result
-# - name: check listing status
-# assert:
+# - name: Check listing status
+# ansible.builtin.assert:
# that:
# - result.response is defined
# - result.changed == true
@@ -390,17 +387,17 @@
# ################################################################
-# - name: update ndb_stretched vlan subnet_mask, gateway
+# - name: Update ndb_stretched vlan subnet_mask, gateway
# ntnx_ndb_stretched_vlans:
# vlan_uuid: "{{result.vlan_uuid}}"
# gateway: "{{st_vlan.gateway}}"
# subnet_mask: "{{st_vlan.subnet_mask}}"
# register: result
# ignore_errors: true
-# - debug:
+# - ansible.builtin.debug:
# var: result
-# - name: check listing status
-# assert:
+# - name: Check listing status
+# ansible.builtin.assert:
# that:
# - result.response is defined
# - result.changed == true
@@ -419,16 +416,17 @@
vlan_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed is defined
- result.changed == true
- result.msg == "All items completed"
fail_msg: "unable to delete all created vlan's"
success_msg: "All vlan'sdeleted successfully"
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_ndb_vlans/tasks/main.yml b/tests/integration/targets/ntnx_ndb_vlans/tasks/main.yml
index 2ffefe7dc..a7173d6ab 100644
--- a/tests/integration/targets/ntnx_ndb_vlans/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ndb_vlans/tasks/main.yml
@@ -1,10 +1,13 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ndb_ip}}"
- nutanix_username: "{{ndb_username}}"
- nutanix_password: "{{ndb_password}}"
- validate_certs: false
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ndb_ip}}"
+ nutanix_username: "{{ndb_username}}"
+ nutanix_password: "{{ndb_password}}"
+ validate_certs: false
block:
- - import_tasks: "create_vlans.yml"
- - import_tasks: "negativ_scenarios.yml"
+ - name: Import "create_vlans.yml"
+ ansible.builtin.import_tasks: "create_vlans.yml"
+ - name: Import "negative_scenarios.yml""
+ ansible.builtin.import_tasks: "negative_scenarios.yml"
diff --git a/tests/integration/targets/ntnx_ndb_vlans/tasks/negativ_scenarios.yml b/tests/integration/targets/ntnx_ndb_vlans/tasks/negative_scenarios.yml
old mode 100644
new mode 100755
similarity index 73%
rename from tests/integration/targets/ntnx_ndb_vlans/tasks/negativ_scenarios.yml
rename to tests/integration/targets/ntnx_ndb_vlans/tasks/negative_scenarios.yml
index ad41fd7eb..3b964c5b0
--- a/tests/integration/targets/ntnx_ndb_vlans/tasks/negativ_scenarios.yml
+++ b/tests/integration/targets/ntnx_ndb_vlans/tasks/negative_scenarios.yml
@@ -1,26 +1,26 @@
---
-- debug:
+- name: Start negative secanrios ntnx_ndb_vlans
+ ansible.builtin.debug:
msg: Start negative secanrios ntnx_ndb_vlans
-- name: create Dhcp ndb vlan with static Configuration
+- name: Create Dhcp ndb vlan with static Configuration
ntnx_ndb_vlans:
- name: "{{ndb_vlan.name}}"
+ name: "{{ndb_vlan.name}}"
vlan_type: DHCP
gateway: "{{ndb_vlan.gateway}}"
subnet_mask: "{{ndb_vlan.subnet_mask}}"
ip_pools:
- -
- start_ip: "{{ndb_vlan.ip_pools.0.start_ip}}"
+ - start_ip: "{{ndb_vlan.ip_pools.0.start_ip}}"
end_ip: "{{ndb_vlan.ip_pools.0.end_ip}}"
primary_dns: "{{ndb_vlan.primary_dns}}"
secondary_dns: "{{ndb_vlan.secondary_dns}}"
dns_domain: "{{ndb_vlan.dns_domain}}"
register: result
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == true
@@ -28,17 +28,17 @@
fail_msg: "fail: create Dhcp ndb vlan with static Configuration finished successfully"
success_msg: "pass: Returnerd error as expected"
# ###############################
-- name: create static ndb vlan with missing Configuration
+- name: Create static ndb vlan with missing Configuration
ntnx_ndb_vlans:
- name: "{{ndb_vlan.name}}"
+ name: "{{ndb_vlan.name}}"
vlan_type: Static
gateway: "{{ndb_vlan.gateway}}"
register: result
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == true
@@ -47,18 +47,18 @@
success_msg: "pass: Returnerd error as expected"
###########
-- name: create Dhcp ndb vlan
+- name: Create Dhcp ndb vlan
ntnx_ndb_vlans:
- name: "{{ndb_vlan.name}}"
+ name: "{{ndb_vlan.name}}"
vlan_type: DHCP
cluster:
uuid: "{{cluster.cluster2.uuid}}"
register: result
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -71,30 +71,29 @@
fail_msg: "fail: Unable to create Dhcp ndb vlan"
success_msg: "pass: create Dhcp ndb vlan finished successfully"
-- set_fact:
+- name: Add vlan_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.vlan_uuid ] }}"
######################
-- name: update dhcp ndb vlan with static Configuration
+- name: Update dhcp ndb vlan with static Configuration
ntnx_ndb_vlans:
vlan_uuid: "{{result.vlan_uuid}}"
gateway: "{{ndb_vlan.gateway}}"
subnet_mask: "{{ndb_vlan.subnet_mask}}"
ip_pools:
- -
- start_ip: "{{ndb_vlan.ip_pools.0.start_ip}}"
+ - start_ip: "{{ndb_vlan.ip_pools.0.start_ip}}"
end_ip: "{{ndb_vlan.ip_pools.0.end_ip}}"
- -
- start_ip: "{{ndb_vlan.ip_pools.1.start_ip}}"
+ - start_ip: "{{ndb_vlan.ip_pools.1.start_ip}}"
end_ip: "{{ndb_vlan.ip_pools.1.end_ip}}"
primary_dns: "{{ndb_vlan.primary_dns}}"
secondary_dns: "{{ndb_vlan.secondary_dns}}"
dns_domain: "{{ndb_vlan.dns_domain}}"
register: result
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == true
@@ -110,11 +109,11 @@
vlan_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
no_log: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed is defined
- result.changed == true
@@ -122,5 +121,6 @@
fail_msg: "unable to delete all created vlan's"
success_msg: "All vlan'sdeleted successfully"
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_ova/tasks/create_ova.yml b/tests/integration/targets/ntnx_ova/tasks/create_ova.yml
index 8b66c26a8..27d289ee6 100644
--- a/tests/integration/targets/ntnx_ova/tasks/create_ova.yml
+++ b/tests/integration/targets/ntnx_ova/tasks/create_ova.yml
@@ -1,73 +1,74 @@
-- debug:
+- name: Start testing create ova for vm
+ ansible.builtin.debug:
msg: Start testing create ova for vm
- name: VM with minimum requirements
ntnx_vms:
- state: present
- name: integration_test_ova_vm
- cluster:
- name: "{{ cluster.name }}"
+ state: present
+ name: integration_test_ova_vm
+ cluster:
+ name: "{{ cluster.name }}"
register: vm
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- vm.response is defined
- vm.response.status.state == 'COMPLETE'
fail_msg: 'Fail: Unable to create VM with minimum requirements '
success_msg: 'Success: VM with minimum requirements created successfully '
#########################################
-- name: create_ova_image with check mode
+- name: Create ova image with check mode
ntnx_vms_ova:
- src_vm_uuid: "{{ vm.vm_uuid }}"
- name: integration_test_VMDK_ova
- file_format: VMDK
+ src_vm_uuid: "{{ vm.vm_uuid }}"
+ name: integration_test_VMDK_ova
+ file_format: VMDK
register: result
ignore_errors: true
- check_mode: yes
+ check_mode: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
- result.failed == false
- result.task_uuid != ""
- success_msg: ' Success: returned as expected '
- fail_msg: ' Fail: create_ova_image with check mode '
+ success_msg: " Success: returned as expected "
+ fail_msg: " Fail: create_ova_image with check mode "
#########################################
-- name: create QCOW2 ova_image
+- name: Create QCOW2 ova_image
ntnx_vms_ova:
- src_vm_uuid: "{{ vm.vm_uuid }}"
- name: integration_test_QCOW2_ova
- file_format: QCOW2
+ src_vm_uuid: "{{ vm.vm_uuid }}"
+ name: integration_test_QCOW2_ova
+ file_format: QCOW2
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- fail_msg: 'Fail: Unable to create QCOW2 ova_image '
- success_msg: 'Success: create QCOW2 ova_image successfully '
+ fail_msg: "Fail: Unable to create QCOW2 ova_image "
+ success_msg: "Success: create QCOW2 ova_image successfully "
#########################################
-- name: create VMDK ova_image
+- name: Create VMDK ova_image
ntnx_vms_ova:
- src_vm_uuid: "{{ vm.vm_uuid }}"
- name: integration_test_VMDK_ova
- file_format: VMDK
+ src_vm_uuid: "{{ vm.vm_uuid }}"
+ name: integration_test_VMDK_ova
+ file_format: VMDK
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- fail_msg: 'Fail: Unable to create VMDK ova_image '
- success_msg: 'Success: create VMDK ova_image successfully '
+ fail_msg: "Fail: Unable to create VMDK ova_image "
+ success_msg: "Success: create VMDK ova_image successfully "
#########################################
- name: Delete all Created VMs
ntnx_vms:
diff --git a/tests/integration/targets/ntnx_ova/tasks/main.yml b/tests/integration/targets/ntnx_ova/tasks/main.yml
index da181200b..3560275ce 100644
--- a/tests/integration/targets/ntnx_ova/tasks/main.yml
+++ b/tests/integration/targets/ntnx_ova/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create_ova.yml"
+ - name: Import create_ova.yml
+ ansible.builtin.import_tasks: "create_ova.yml"
diff --git a/tests/integration/targets/ntnx_permissions_info/tasks/main.yml b/tests/integration/targets/ntnx_permissions_info/tasks/main.yml
index 2280180dd..94d926a05 100644
--- a/tests/integration/targets/ntnx_permissions_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_permissions_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "permissions_info.yml"
+ - name: Import permissions_info.yml
+ ansible.builtin.import_tasks: "permissions_info.yml"
diff --git a/tests/integration/targets/ntnx_permissions_info/tasks/permissions_info.yml b/tests/integration/targets/ntnx_permissions_info/tasks/permissions_info.yml
index 0a91ee46d..4969cb44e 100644
--- a/tests/integration/targets/ntnx_permissions_info/tasks/permissions_info.yml
+++ b/tests/integration/targets/ntnx_permissions_info/tasks/permissions_info.yml
@@ -1,14 +1,15 @@
-- debug:
+- name: Start testing ntnx_permissions_info
+ ansible.builtin.debug:
msg: start testing ntnx_permissions_info
##################################################
- name: List all permissions
ntnx_permissions_info:
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.metadata.total_matches > 0
@@ -19,7 +20,8 @@
##################################################
-- set_fact:
+- name: Set permission name
+ ansible.builtin.set_fact:
test_permission_name: "Create_Playbook"
- name: List permissions using filter criteria
@@ -27,10 +29,10 @@
filter:
name: "{{ test_permission_name }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -41,7 +43,8 @@
fail_msg: "Unable to list permissions using filter"
success_msg: "permission info obtained successfully"
-- set_fact:
+- name: Set permission uuid
+ ansible.builtin.set_fact:
test_permission_uuid: "{{result.response.entities.0.metadata.uuid}}"
##################################################
@@ -50,10 +53,10 @@
ntnx_permissions_info:
permission_uuid: "{{ test_permission_uuid }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -63,7 +66,6 @@
fail_msg: "Unable to list permission using uuid"
success_msg: "permission info obtained successfully"
-
##################################################
- name: List permissions using length and offset
@@ -71,10 +73,10 @@
length: 1
offset: 1
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
diff --git a/tests/integration/targets/ntnx_projects/tasks/create_project.yml b/tests/integration/targets/ntnx_projects/tasks/create_project.yml
index c4265c4dc..b11176e39 100644
--- a/tests/integration/targets/ntnx_projects/tasks/create_project.yml
+++ b/tests/integration/targets/ntnx_projects/tasks/create_project.yml
@@ -1,19 +1,20 @@
-- name:
- debug:
+- name: Start ntnx_project create tests
+ ansible.builtin.debug:
msg: "Start ntnx_project create tests"
- name: Generate random project_name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)[0]}}"
-- set_fact:
+- name: Set suffix name
+ ansible.builtin.set_fact:
suffix_name: "ansible-role-mapping"
-- set_fact:
+- name: Set project names
+ ansible.builtin.set_fact:
project1_name: "{{random_name}}{{suffix_name}}1"
project2_name: "{{random_name}}{{suffix_name}}2"
-
- name: Create Project with minimal spec
ntnx_projects:
name: "{{project1_name}}"
@@ -21,7 +22,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -30,13 +31,14 @@
fail_msg: "Unable to create project with minimal spec"
success_msg: "Project with minimal spec created successfully"
-- set_fact:
+- name: Add project to delete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.project_uuid ] }}"
#################################################################
- name: Create Project with check mode
- check_mode: yes
+ check_mode: true
ntnx_projects:
name: "{{project2_name}}"
desc: desc-123
@@ -57,7 +59,7 @@
ignore_errors: true
- name: Check mode Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -104,12 +106,14 @@
register: result
ignore_errors: true
-- set_fact:
- expected_subnets: ["{{ network.dhcp.uuid }}", "{{ static.uuid }}", "{{ overlay.uuid }}"]
+- name: Set expected subnets and users
+ ansible.builtin.set_fact:
+ expected_subnets:
+ ["{{ network.dhcp.uuid }}", "{{ static.uuid }}", "{{ overlay.uuid }}"]
expected_users: ["{{ users[0] }}", "{{ users[1] }}"]
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -132,7 +136,8 @@
fail_msg: "Unable to create project with all specifications"
success_msg: "Project with all specifications created successfully"
-- set_fact:
+- name: Add project to delete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.project_uuid ] }}"
#################################################################
@@ -143,7 +148,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == false
- "'Project with given name already exists' in result.msg"
@@ -157,7 +162,8 @@
project_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_projects/tasks/delete_project.yml b/tests/integration/targets/ntnx_projects/tasks/delete_project.yml
index e1fc273be..6fc65d686 100644
--- a/tests/integration/targets/ntnx_projects/tasks/delete_project.yml
+++ b/tests/integration/targets/ntnx_projects/tasks/delete_project.yml
@@ -1,5 +1,5 @@
-- name:
- debug:
+- name: Start ntnx_project delete tests
+ ansible.builtin.debug:
msg: "Start ntnx_project delete tests"
- name: Create Project for delete
@@ -9,7 +9,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -22,10 +22,10 @@
project_uuid: "{{ result.project_uuid }}"
wait: true
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Delete Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'SUCCEEDED'
diff --git a/tests/integration/targets/ntnx_projects/tasks/main.yml b/tests/integration/targets/ntnx_projects/tasks/main.yml
index eddf0a46d..82acf4be3 100644
--- a/tests/integration/targets/ntnx_projects/tasks/main.yml
+++ b/tests/integration/targets/ntnx_projects/tasks/main.yml
@@ -1,12 +1,17 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create_project.yml"
- - import_tasks: "delete_project.yml"
- - import_tasks: "update_project.yml"
- - import_tasks: "projects_with_role_mappings.yml"
+ - name: Import create_project.yml
+ ansible.builtin.import_tasks: "create_project.yml"
+ - name: Import delete_project.yml
+ ansible.builtin.import_tasks: "delete_project.yml"
+ - name: Import update_project.yml
+ ansible.builtin.import_tasks: "update_project.yml"
+ - name: Import projects_with_role_mappings.yml
+ ansible.builtin.import_tasks: "projects_with_role_mappings.yml"
diff --git a/tests/integration/targets/ntnx_projects/tasks/projects_with_role_mappings.yml b/tests/integration/targets/ntnx_projects/tasks/projects_with_role_mappings.yml
index dca268c0d..815357b3b 100644
--- a/tests/integration/targets/ntnx_projects/tasks/projects_with_role_mappings.yml
+++ b/tests/integration/targets/ntnx_projects/tasks/projects_with_role_mappings.yml
@@ -1,40 +1,40 @@
-- name:
- debug:
+- name: Start ntnx_project tests with role mappings
+ ansible.builtin.debug:
msg: "Start ntnx_project tests with role mappings"
- name: Generate random project_name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)[0]}}"
-- set_fact:
+- name: Set suffix name
+ ansible.builtin.set_fact:
suffix_name: "ansible-role-mapping"
-- set_fact:
+- name: Set project names
+ ansible.builtin.set_fact:
project1_name: "{{random_name}}{{suffix_name}}1"
project2_name: "{{random_name}}{{suffix_name}}2"
project3_name: "{{random_name}}{{suffix_name}}3"
-- set_fact:
- ignore_errors: false
-
- name: Create Project with min spec
ntnx_projects:
name: "{{project1_name}}"
desc: "project with role mappings"
- collaboration: True
+ collaboration: true
role_mappings:
- role:
- name: "{{roles[0]}}"
+ name: "{{test_roles[0]}}"
user:
uuid: "{{users[0]}}"
register: result
- ignore_errors: "{{ignore_errors}}"
+ ignore_errors: true
-- set_fact:
+- name: Set response acp
+ ansible.builtin.set_fact:
response_acp: "{{result.response.status.access_control_policy_list_status[0].access_control_policy_status.resources}}"
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -44,17 +44,18 @@
- result.response.status.access_control_policy_list_status | length == 1
- response_acp.filter_list.context_list[0].entity_filter_expression_list[0].left_hand_side.entity_type == "ALL"
- response_acp.filter_list.context_list | length == 3
- - response_acp.role_reference.name == "{{roles[0]}}"
+ - response_acp.role_reference.name == "{{test_roles[0]}}"
- response_acp.user_reference_list[0].uuid == "{{users[0]}}"
fail_msg: "Unable to create project with minimal spec of role mappings"
success_msg: "Project with minimal spec of role mappings created successfully"
-- set_fact:
+- name: Add project uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.project_uuid ] }}"
################################################################
-- name: Creat project with all specs
+- name: Create project with all specs
ntnx_projects:
name: "{{project2_name}}"
desc: desc-123
@@ -78,29 +79,31 @@
- user:
uuid: "{{users[0]}}"
role:
- name: "{{roles[0]}}"
+ name: "{{test_roles[0]}}"
- user:
uuid: "{{users[1]}}"
role:
- name: "{{roles[1]}}"
+ name: "{{test_roles[1]}}"
- user:
principal_name: "{{new_user}}"
directory_service_uuid: "{{directory_service_uuid}}"
role:
- name: "{{roles[2]}}"
+ name: "{{test_roles[2]}}"
- user_group:
distinguished_name: "{{new_user_group}}"
role:
- name: "{{roles[3]}}"
+ name: "{{test_roles[3]}}"
register: result
- ignore_errors: "{{ignore_errors}}"
+ ignore_errors: true
-- set_fact:
- expected_subnets: ["{{ network.dhcp.uuid }}", "{{ static.uuid }}", "{{ overlay.uuid }}"]
+- name: Set expected subnets and acp
+ ansible.builtin.set_fact:
+ expected_subnets:
+ ["{{ network.dhcp.uuid }}", "{{ static.uuid }}", "{{ overlay.uuid }}"]
response_acp: "{{result.response.status.access_control_policy_list_status[0].access_control_policy_status.resources}}"
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -124,14 +127,14 @@
fail_msg: "Unable to create project with all specifications"
success_msg: "Project with all specifications created successfully"
-
-- set_fact:
+- name: Add project uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.project_uuid ] }}"
-- set_fact:
+- name: Set user group to delete variable
+ ansible.builtin.set_fact:
user_group_to_delete: "{{result.response.status.project_status.resources.external_user_group_reference_list[0].uuid}}"
-
- name: Update Project role mappings and subnets and quotas
ntnx_projects:
project_uuid: "{{result.project_uuid}}"
@@ -148,7 +151,7 @@
limit: 2147483648
- resource_type: MEMORY
limit: 2147483648
- collaboration: True
+ collaboration: true
role_mappings:
- role:
name: "{{acp.role.name}}"
@@ -164,54 +167,69 @@
uuid: "{{user_groups[0]}}"
register: result
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Set expected subnets
+ ansible.builtin.set_fact:
expected_subnets: ["{{ network.dhcp.uuid }}", "{{ static.uuid }}"]
-- set_fact:
+- name: Set response acp
+ ansible.builtin.set_fact:
response_acp: "{{result.response.status.access_control_policy_list_status[0].access_control_policy_status.resources}}"
-- set_fact:
- acp_users: ["{{response_acp.user_reference_list[0].uuid}}", "{{response_acp.user_reference_list[1].uuid}}"]
-- set_fact:
- sorted_acp_users: '{{ acp_users | sort() }}'
-- set_fact:
+- name: Set acp users
+ ansible.builtin.set_fact:
+ acp_users:
+ [
+ "{{response_acp.user_reference_list[0].uuid}}",
+ "{{response_acp.user_reference_list[1].uuid}}",
+ ]
+- name: Set sorted acp users
+ ansible.builtin.set_fact:
+ sorted_acp_users: "{{ acp_users | sort() }}"
+- name: Set expected users
+ ansible.builtin.set_fact:
expected_users: ["{{users[0]}}", "{{users[1]}}"]
-- set_fact:
- expected_users_sorted: '{{ expected_users | sort() }}'
-- set_fact:
- project_user_reference_list: ["{{result.response.status.project_status.resources.user_reference_list[0].uuid}}", "{{result.response.status.project_status.resources.user_reference_list[1].uuid}}"]
-- set_fact:
- project_user_references_sorted: '{{ project_user_reference_list|sort() }}'
-- set_fact:
- expected_quotas: [
- {
- "limit": 5,
- "resource_type": "VCPUS",
- "units": "COUNT",
- "value": 0
- },
- {
- "limit": 2147483648,
- "resource_type": "STORAGE",
- "units": "BYTES",
- "value": 0
- },
- {
- "limit": 2147483648,
- "resource_type": "MEMORY",
- "units": "BYTES",
- "value": 0
- }
- ]
-- set_fact:
+- name: Set expected users sorted
+ ansible.builtin.set_fact:
+ expected_users_sorted: "{{ expected_users | sort() }}"
+- name: Set project user reference list
+ ansible.builtin.set_fact:
+ project_user_reference_list:
+ [
+ "{{result.response.status.project_status.resources.user_reference_list[0].uuid}}",
+ "{{result.response.status.project_status.resources.user_reference_list[1].uuid}}",
+ ]
+- name: Set project user references sorted
+ ansible.builtin.set_fact:
+ project_user_references_sorted: "{{ project_user_reference_list|sort() }}"
+- name: Set expected quotas
+ ansible.builtin.set_fact:
+ expected_quotas:
+ [
+ { "limit": 5, "resource_type": "VCPUS", "units": "COUNT", "value": 0 },
+ {
+ "limit": 2147483648,
+ "resource_type": "STORAGE",
+ "units": "BYTES",
+ "value": 0,
+ },
+ {
+ "limit": 2147483648,
+ "resource_type": "MEMORY",
+ "units": "BYTES",
+ "value": 0,
+ },
+ ]
+- name: Set quotas
+ ansible.builtin.set_fact:
quotas: "{{result.response.status.project_status.resources.resource_domain.resources}}"
-- set_fact:
+- name: Set sorted quotas
+ ansible.builtin.set_fact:
sorted_quotas: "{{ quotas| sort(attribute='resource_type') }}"
sorted_expected_quotas: "{{ expected_quotas | sort(attribute='resource_type') }}"
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -254,7 +272,7 @@
limit: 2147483648
- resource_type: MEMORY
limit: 2147483648
- collaboration: True
+ collaboration: true
role_mappings:
- role:
name: "{{acp.role.name}}"
@@ -272,18 +290,17 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == false
- "'Nothing to update' in result.msg"
fail_msg: "Project update didn't got skipped for update spec same as existing project"
success_msg: "Project got skipped successfully for no change in spec"
-
- name: Create project with existing name
ntnx_projects:
name: "{{project3_name}}"
- collaboration: True
+ collaboration: true
role_mappings:
- role:
name: "{{acp.role.name}}"
@@ -296,9 +313,8 @@
register: result
ignore_errors: true
-
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == false
- "'Project with given name already exists' in result.msg"
@@ -312,20 +328,21 @@
project_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
-- name: delete user group
+- name: Delete user group
ntnx_user_groups:
state: absent
user_group_uuid: "{{user_group_to_delete}}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
diff --git a/tests/integration/targets/ntnx_projects/tasks/update_project.yml b/tests/integration/targets/ntnx_projects/tasks/update_project.yml
index 1919e2c8c..7764bf26c 100644
--- a/tests/integration/targets/ntnx_projects/tasks/update_project.yml
+++ b/tests/integration/targets/ntnx_projects/tasks/update_project.yml
@@ -1,18 +1,19 @@
-- name:
- debug:
+- name: Start ntnx_project update tests
+ ansible.builtin.debug:
msg: "Start ntnx_project update tests"
- name: Generate random project_name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)[0]}}"
-- set_fact:
+- name: Set suffix name
+ ansible.builtin.set_fact:
suffix_name: "ansible-role-mapping"
-- set_fact:
+- name: Set project names
+ ansible.builtin.set_fact:
project1_name: "{{random_name}}{{suffix_name}}1"
-
- name: Create Project
ntnx_projects:
name: "{{project1_name}}"
@@ -30,19 +31,20 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: "Unable to create project"
success_msg: "Project created successfully"
-- set_fact:
+- name: Add project to delete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.project_uuid ] }}"
#################################################################
- name: Check check mode for update
- check_mode: yes
+ check_mode: true
ntnx_projects:
project_uuid: "{{ result.project_uuid }}"
desc: desc-123-updated
@@ -63,7 +65,7 @@
ignore_errors: true
- name: Check mode Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -106,7 +108,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -150,7 +152,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == false
- "'Nothing to update' in result.msg"
@@ -165,7 +167,8 @@
project_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_projects_info/tasks/main.yml b/tests/integration/targets/ntnx_projects_info/tasks/main.yml
index 63f4b1464..82c408051 100644
--- a/tests/integration/targets/ntnx_projects_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_projects_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "projects_info.yml"
+ - name: Import projects_info.yml
+ ansible.builtin.import_tasks: "projects_info.yml"
diff --git a/tests/integration/targets/ntnx_projects_info/tasks/projects_info.yml b/tests/integration/targets/ntnx_projects_info/tasks/projects_info.yml
index bba5652d0..5d327fb35 100644
--- a/tests/integration/targets/ntnx_projects_info/tasks/projects_info.yml
+++ b/tests/integration/targets/ntnx_projects_info/tasks/projects_info.yml
@@ -1,19 +1,20 @@
-- name:
- debug:
+- name: Start ntnx_project update tests
+ ansible.builtin.debug:
msg: "Start ntnx_project_info tests"
- name: Generate random project_name
- set_fact:
+ ansible.builtin.set_fact:
random_name: "{{query('community.general.random_string',numbers=false, special=false,length=12)[0]}}"
-- set_fact:
+- name: Set suffix name
+ ansible.builtin.set_fact:
suffix_name: "ansible-role-mapping"
-- set_fact:
+- name: Set project names
+ ansible.builtin.set_fact:
project1_name: "{{random_name}}{{suffix_name}}1"
project2_name: "{{random_name}}{{suffix_name}}2"
-
- name: Create Project with minimal spec
ntnx_projects:
name: "{{project1_name}}"
@@ -23,19 +24,21 @@
- name: Create Project with role mappings
ntnx_projects:
name: "{{project2_name}}"
- collaboration: True
+ collaboration: true
role_mappings:
- role:
- name: "{{roles[0]}}"
+ name: "{{test_roles[0]}}"
user:
uuid: "{{users[0]}}"
register: project_2
ignore_errors: true
-- set_fact:
+- name: Add project uuid to delete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ project_1.project_uuid ] }}"
-- set_fact:
+- name: Add project uuid to delete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ project_2.project_uuid ] }}"
##################################################
@@ -45,10 +48,10 @@
filter:
name: "{{project1_name}}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.entities[0].status.name == "{{project1_name}}"
@@ -60,10 +63,10 @@
- name: List all projects
ntnx_projects_info:
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.metadata.total_matches > 2
@@ -76,10 +79,10 @@
ntnx_projects_info:
project_uuid: "{{ project_2.project_uuid }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.name == "{{ project2_name }}"
@@ -92,12 +95,12 @@
- name: List project using project uuid criteria including acps
ntnx_projects_info:
project_uuid: "{{ project_2.project_uuid }}"
- include_acps: True
+ include_acps: true
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.name == "{{ project2_name }}"
@@ -113,10 +116,10 @@
length: 1
offset: 1
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: "Unable to list projects using length and offset"
@@ -129,10 +132,10 @@
sort_attribute: "name"
kind: project
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: "Unable to list projects"
@@ -145,7 +148,8 @@
project_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_protection_rules/tasks/main.yml b/tests/integration/targets/ntnx_protection_rules/tasks/main.yml
index f3dd0eaf9..aaca6047f 100644
--- a/tests/integration/targets/ntnx_protection_rules/tasks/main.yml
+++ b/tests/integration/targets/ntnx_protection_rules/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "protection_rules.yml"
+ - name: Import protection_rules.yml
+ ansible.builtin.import_tasks: "protection_rules.yml"
diff --git a/tests/integration/targets/ntnx_protection_rules/tasks/protection_rules.yml b/tests/integration/targets/ntnx_protection_rules/tasks/protection_rules.yml
index 0c2d9e7ce..8ba5e456a 100644
--- a/tests/integration/targets/ntnx_protection_rules/tasks/protection_rules.yml
+++ b/tests/integration/targets/ntnx_protection_rules/tasks/protection_rules.yml
@@ -1,13 +1,14 @@
---
-- debug:
+- name: Start testing protection policies crud tests
+ ansible.builtin.debug:
msg: Start testing protection policies crud tests
-############################################################### CREATE Protection Policy tests ###########################################################################################
+######################### CREATE Protection Policy tests ##########################
- name: Create protection rule with synchronous schedule and check mode
- check_mode: yes
+ check_mode: true
ntnx_protection_rules:
state: present
- wait: True
+ wait: true
name: test-ansible
desc: test-ansible-desc
protected_categories:
@@ -32,7 +33,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -58,7 +59,7 @@
- name: Create protection rule with sync schedule
ntnx_protection_rules:
state: present
- wait: True
+ wait: true
name: test-ansible
desc: test-ansible-desc
protected_categories:
@@ -83,7 +84,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.rule_uuid == result.response.metadata.uuid
@@ -106,22 +107,19 @@
fail_msg: "Unable to create protection rule with synchronous schedule"
success_msg: "Protection policy with with synchronous schedule created successfully"
-
- name: Delete created protection policy inorder to avoid conflict in further tests
ntnx_protection_rules:
state: absent
- wait: True
+ wait: true
rule_uuid: "{{ result.rule_uuid }}"
register: result
-
##########################################################################################################################################################
-
- name: Create protection rule with async schedule
ntnx_protection_rules:
state: present
- wait: True
+ wait: true
name: test-ansible
desc: test-ansible-desc
protected_categories:
@@ -132,7 +130,7 @@
availability_zone_url: "{{dr.primary_az_url}}"
schedules:
- source:
- availability_zone_url: "{{dr.primary_az_url}}"
+ availability_zone_url: "{{dr.primary_az_url}}"
destination:
availability_zone_url: "{{dr.recovery_az_url}}"
protection_type: ASYNC
@@ -161,7 +159,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.rule_uuid == result.response.metadata.uuid
@@ -176,26 +174,39 @@
- result.response.status.resources.availability_zone_connectivity_list[0]["source_availability_zone_index"] == 0
- result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]["snapshot_type"] == "CRASH_CONSISTENT"
- result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]["recovery_point_objective_secs"] == 3600
- - result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]["local_snapshot_retention_policy"]["num_snapshots"] == 1
- - result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]["remote_snapshot_retention_policy"]["rollup_retention_policy"]["snapshot_interval_type"] == "HOURLY"
- - result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]["remote_snapshot_retention_policy"]["rollup_retention_policy"]["multiple"] == 2
- - result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]["snapshot_type"] == "CRASH_CONSISTENT"
- - result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]["recovery_point_objective_secs"] == 3600
- - result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]["local_snapshot_retention_policy"]["num_snapshots"] == 2
- - result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]["remote_snapshot_retention_policy"]["num_snapshots"] == 1
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]
+ ["local_snapshot_retention_policy"]["num_snapshots"] == 1
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]
+ ["remote_snapshot_retention_policy"]["rollup_retention_policy"]["snapshot_interval_type"] == "HOURLY"
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]
+ ["remote_snapshot_retention_policy"]["rollup_retention_policy"]["multiple"] == 2
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]
+ ["snapshot_type"] == "CRASH_CONSISTENT"
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]
+ ["recovery_point_objective_secs"] == 3600
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]
+ ["local_snapshot_retention_policy"]["num_snapshots"] == 2
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]
+ ["remote_snapshot_retention_policy"]["num_snapshots"] == 1
- result.response.status.resources.availability_zone_connectivity_list[1]["destination_availability_zone_index"] == 0
- result.response.status.resources.availability_zone_connectivity_list[1]["source_availability_zone_index"] == 1
fail_msg: "Unable to create protection rule with asynchronous schedule"
success_msg: "Protection policy with with asynchronous schedule created successfully"
-
############################################################## UPDATE Protection Policy Tests ##################################################################
- name: Update previously created protection policy
ntnx_protection_rules:
state: present
- wait: True
+ wait: true
rule_uuid: "{{result.rule_uuid}}"
name: test-ansible-updated
desc: test-ansible-desc-updated
@@ -206,7 +217,7 @@
availability_zone_url: "{{dr.primary_az_url}}"
schedules:
- source:
- availability_zone_url: "{{dr.primary_az_url}}"
+ availability_zone_url: "{{dr.primary_az_url}}"
destination:
availability_zone_url: "{{dr.recovery_az_url}}"
protection_type: ASYNC
@@ -235,7 +246,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.rule_uuid == result.response.metadata.uuid
@@ -244,19 +255,39 @@
- result.response.status.description == "test-ansible-desc-updated"
- result.response.status.name == "test-ansible-updated"
- result.response.status.resources.ordered_availability_zone_list[0]["availability_zone_url"] == "{{dr.primary_az_url}}"
- - result.response.status.resources.ordered_availability_zone_list[1]["availability_zone_url"] == "{{dr.recovery_az_url}}"
+ - >
+ result.response.status.resources.ordered_availability_zone_list[1]
+ ["availability_zone_url"] == "{{dr.recovery_az_url}}"
- result.response.status.resources.category_filter.params["Environment"] == ["Production"]
- result.response.status.resources.availability_zone_connectivity_list[0]["destination_availability_zone_index"] == 1
- result.response.status.resources.availability_zone_connectivity_list[0]["source_availability_zone_index"] == 0
- - result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]["snapshot_type"] == "APPLICATION_CONSISTENT"
- - result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]["recovery_point_objective_secs"] == 172800
- - result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]["local_snapshot_retention_policy"]["num_snapshots"] == 1
- - result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]["remote_snapshot_retention_policy"]["rollup_retention_policy"]["snapshot_interval_type"] == "YEARLY"
- - result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]["remote_snapshot_retention_policy"]["rollup_retention_policy"]["multiple"] == 2
- - result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]["snapshot_type"] == "APPLICATION_CONSISTENT"
- - result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]["recovery_point_objective_secs"] == 172800
- - result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]["local_snapshot_retention_policy"]["num_snapshots"] == 1
- - result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]["remote_snapshot_retention_policy"]["num_snapshots"] == 2
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]
+ ["snapshot_type"] == "APPLICATION_CONSISTENT"
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]
+ ["recovery_point_objective_secs"] == 172800
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]
+ ["local_snapshot_retention_policy"]["num_snapshots"] == 1
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]
+ ["remote_snapshot_retention_policy"]["rollup_retention_policy"]["snapshot_interval_type"] == "YEARLY"
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[0]["snapshot_schedule_list"][0]
+ ["remote_snapshot_retention_policy"]["rollup_retention_policy"]["multiple"] == 2
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]
+ ["snapshot_type"] == "APPLICATION_CONSISTENT"
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]
+ ["recovery_point_objective_secs"] == 172800
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]
+ ["local_snapshot_retention_policy"]["num_snapshots"] == 1
+ - >
+ result.response.status.resources.availability_zone_connectivity_list[1]["snapshot_schedule_list"][0]
+ ["remote_snapshot_retention_policy"]["num_snapshots"] == 2
- result.response.status.resources.availability_zone_connectivity_list[1]["destination_availability_zone_index"] == 0
- result.response.status.resources.availability_zone_connectivity_list[1]["source_availability_zone_index"] == 1
@@ -268,7 +299,7 @@
- name: Idempotency Check
ntnx_protection_rules:
state: present
- wait: True
+ wait: true
rule_uuid: "{{result.rule_uuid}}"
name: test-ansible-updated
desc: test-ansible-desc-updated
@@ -279,7 +310,7 @@
availability_zone_url: "{{dr.primary_az_url}}"
schedules:
- source:
- availability_zone_url: "{{dr.primary_az_url}}"
+ availability_zone_url: "{{dr.primary_az_url}}"
destination:
availability_zone_url: "{{dr.recovery_az_url}}"
protection_type: ASYNC
@@ -307,8 +338,8 @@
num_snapshots: 2
register: temp_result
-- name: idempotency check status
- assert:
+- name: Idempotency check status
+ ansible.builtin.assert:
that:
- temp_result.changed == False
- temp_result.failed == False
@@ -319,19 +350,18 @@
##################################################################################################################################################################
-
- name: Check Mode while update
- check_mode: yes
+ check_mode: true
ntnx_protection_rules:
state: present
- wait: True
+ wait: true
rule_uuid: "{{result.rule_uuid}}"
name: test-ansible-updated-check-mode
desc: test-ansible-desc-updated
register: temp_result
- name: Check mode Status
- assert:
+ ansible.builtin.assert:
that:
- temp_result.response is defined
- temp_result.changed == false
@@ -339,18 +369,17 @@
fail_msg: "Unable to generate update spec using check mode"
success_msg: "Protection policy update spec generated successfully"
-
############################################################## DELETE Protection Policy Tests ##################################################################
- name: Delete created protection policy
ntnx_protection_rules:
state: absent
- wait: True
+ wait: true
rule_uuid: "{{ result.rule_uuid }}"
register: result
-- name: delete Status
- assert:
+- name: Delete Status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
diff --git a/tests/integration/targets/ntnx_protection_rules_info/tasks/main.yml b/tests/integration/targets/ntnx_protection_rules_info/tasks/main.yml
index 255ab0f69..9ca06bf3e 100644
--- a/tests/integration/targets/ntnx_protection_rules_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_protection_rules_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "rules_info.yml"
+ - name: Import rules_info.yml
+ ansible.builtin.import_tasks: "rules_info.yml"
diff --git a/tests/integration/targets/ntnx_protection_rules_info/tasks/rules_info.yml b/tests/integration/targets/ntnx_protection_rules_info/tasks/rules_info.yml
index f4eb5e680..fb067ba11 100644
--- a/tests/integration/targets/ntnx_protection_rules_info/tasks/rules_info.yml
+++ b/tests/integration/targets/ntnx_protection_rules_info/tasks/rules_info.yml
@@ -1,11 +1,12 @@
-- debug:
+- name: Start ntnx_protection_rules_info tests
+ ansible.builtin.debug:
msg: start testing ntnx_protection_rules_info
##################################################
- name: Create protection rule with async schedule
ntnx_protection_rules:
state: present
- wait: True
+ wait: true
name: test-ansible-info-1
desc: test-ansible-desc-1
protected_categories:
@@ -15,7 +16,7 @@
availability_zone_url: "{{dr.primary_az_url}}"
schedules:
- source:
- availability_zone_url: "{{dr.primary_az_url}}"
+ availability_zone_url: "{{dr.primary_az_url}}"
destination:
availability_zone_url: "{{dr.recovery_az_url}}"
protection_type: ASYNC
@@ -46,7 +47,7 @@
- name: Create protection rule with async schedule
ntnx_protection_rules:
state: present
- wait: True
+ wait: true
name: test-ansible-info-2
desc: test-ansible-desc-2
protected_categories:
@@ -56,7 +57,7 @@
availability_zone_url: "{{dr.primary_az_url}}"
schedules:
- source:
- availability_zone_url: "{{dr.primary_az_url}}"
+ availability_zone_url: "{{dr.primary_az_url}}"
destination:
availability_zone_url: "{{dr.recovery_az_url}}"
protection_type: ASYNC
@@ -89,10 +90,10 @@
- name: List all Protection rules
ntnx_protection_rules_info:
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.metadata.total_matches > 0
@@ -100,9 +101,11 @@
fail_msg: "Unable to list all protection rules"
success_msg: "protection rule info obtained successfully"
-- set_fact:
+- name: Set rule name
+ ansible.builtin.set_fact:
test_rule_name: "{{result.response.entities.1.status.name}}"
-- set_fact:
+- name: Set rule uuid
+ ansible.builtin.set_fact:
test_rule_uuid: "{{result.response.entities.1.metadata.uuid}}"
##################################################
@@ -111,10 +114,10 @@
ntnx_protection_rules_info:
rule_uuid: "{{ test_rule_uuid }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -133,10 +136,10 @@
filter:
name: "{{ test_rule_name }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -154,10 +157,10 @@
length: 1
offset: 1
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -171,13 +174,13 @@
- name: Delete created protection policy
ntnx_protection_rules:
state: absent
- wait: True
+ wait: true
rule_uuid: "{{ rule_1.rule_uuid }}"
register: result
- name: Delete created protection policy
ntnx_protection_rules:
state: absent
- wait: True
+ wait: true
rule_uuid: "{{ rule_2.rule_uuid }}"
register: result
diff --git a/tests/integration/targets/ntnx_recovery_plans_and_jobs/tasks/crud.yml b/tests/integration/targets/ntnx_recovery_plans_and_jobs/tasks/crud.yml
index 7b8f22eb5..10e4b670c 100644
--- a/tests/integration/targets/ntnx_recovery_plans_and_jobs/tasks/crud.yml
+++ b/tests/integration/targets/ntnx_recovery_plans_and_jobs/tasks/crud.yml
@@ -1,173 +1,172 @@
---
-- debug:
+- name: Start testing recovery plan and recovery plan jobs
+ ansible.builtin.debug:
msg: Start testing recovery plan and recovery plan jobs
-############################################################### CREATE Recovery Plan ###########################################################################################
-
-- set_fact:
- expected_availability_zone_list: [
+################################ CREATE Recovery Plan #########################################################
+
+- name: Set variables
+ ansible.builtin.set_fact:
+ expected_availability_zone_list:
+ [
+ { "availability_zone_url": "{{dr.primary_az_url}}" },
+ { "availability_zone_url": "{{dr.recovery_az_url}}" },
+ ]
+ expected_network_mapping_list_for_check_mode:
+ [
+ {
+ "are_networks_stretched": true,
+ "availability_zone_network_mapping_list":
+ [
+ {
+ "availability_zone_url": "{{dr.primary_az_url}}",
+ "recovery_network": { "name": "{{network.dhcp.name}}" },
+ "test_network": { "name": "{{network.dhcp.name}}" },
+ },
+ {
+ "availability_zone_url": "{{dr.recovery_az_url}}",
+ "recovery_network": { "name": "{{dr.recovery_site_network}}" },
+ "test_network": { "name": "{{dr.recovery_site_network}}" },
+ },
+ ],
+ },
+ ]
+ expected_network_mapping_list:
+ [
+ {
+ "are_networks_stretched": false,
+ "availability_zone_network_mapping_list":
+ [
{
- "availability_zone_url": "{{dr.primary_az_url}}"
+ "availability_zone_url": "{{dr.primary_az_url}}",
+ "recovery_ip_assignment_list":
+ [
+ {
+ "ip_config_list":
+ [{ "ip_address": "{{dr.recovery_ip2}}" }],
+ "vm_reference":
+ {
+ "kind": "vm",
+ "name": "{{dr_vm_name}}",
+ "uuid": "{{dr_vm.uuid}}",
+ },
+ },
+ ],
+ "recovery_network":
+ {
+ "name": "{{network.dhcp.name}}",
+ "subnet_list":
+ [
+ {
+ "external_connectivity_state": "DISABLED",
+ "gateway_ip": "{{dr.gateway_ip}}",
+ "prefix_length": 24,
+ },
+ ],
+ },
+ "test_ip_assignment_list":
+ [
+ {
+ "ip_config_list":
+ [{ "ip_address": "{{dr.recovery_ip1}}" }],
+ "vm_reference":
+ {
+ "kind": "vm",
+ "name": "{{dr_vm_name}}",
+ "uuid": "{{dr_vm.uuid}}",
+ },
+ },
+ ],
+ "test_network":
+ {
+ "name": "{{network.dhcp.name}}",
+ "subnet_list":
+ [
+ {
+ "external_connectivity_state": "DISABLED",
+ "gateway_ip": "{{dr.gateway_ip}}",
+ "prefix_length": 24,
+ },
+ ],
+ },
},
{
- "availability_zone_url": "{{dr.recovery_az_url}}"
- }
- ]
- expected_network_mapping_list_for_check_mode: [
- {
- "are_networks_stretched": True,
- "availability_zone_network_mapping_list": [
- {
- "availability_zone_url": "{{dr.primary_az_url}}",
- "recovery_network": {
- "name": "{{network.dhcp.name}}"
- },
- "test_network": {
- "name": "{{network.dhcp.name}}"
- }
- },
- {
- "availability_zone_url": "{{dr.recovery_az_url}}",
- "recovery_network": {
- "name": "{{dr.recovery_site_network}}"
- },
- "test_network": {
- "name": "{{dr.recovery_site_network}}"
- }
- }
- ]
- }
- ]
- expected_network_mapping_list: [
- {
- "are_networks_stretched": False,
- "availability_zone_network_mapping_list": [
- {
- "availability_zone_url": "{{dr.primary_az_url}}",
- "recovery_ip_assignment_list": [
- {
- "ip_config_list": [
- {
- "ip_address": "{{dr.recovery_ip2}}"
- }
- ],
- "vm_reference": {
- "kind": "vm",
- "name": "{{dr_vm_name}}",
- "uuid": "{{dr_vm.uuid}}"
- }
- }
- ],
- "recovery_network": {
- "name": "{{network.dhcp.name}}",
- "subnet_list": [
- {
- "external_connectivity_state": "DISABLED",
- "gateway_ip": "{{dr.gateway_ip}}",
- "prefix_length": 24
- }
- ]
- },
- "test_ip_assignment_list": [
- {
- "ip_config_list": [
- {
- "ip_address": "{{dr.recovery_ip1}}"
- }
- ],
- "vm_reference": {
- "kind": "vm",
- "name": "{{dr_vm_name}}",
- "uuid": "{{dr_vm.uuid}}"
- }
- }
- ],
- "test_network": {
- "name": "{{network.dhcp.name}}",
- "subnet_list": [
- {
- "external_connectivity_state": "DISABLED",
- "gateway_ip": "{{dr.gateway_ip}}",
- "prefix_length": 24
- }
- ]
- }
- },
- {
- "availability_zone_url": "{{dr.recovery_az_url}}",
- "recovery_ip_assignment_list": [
- {
- "ip_config_list": [
- {
- "ip_address": "{{dr.recovery_ip2}}"
- }
- ],
- "vm_reference": {
- "kind": "vm",
- "name": "{{dr_vm_name}}",
- "uuid": "{{dr_vm.uuid}}"
- }
- }
- ],
- "recovery_network": {
- "name": "{{dr.recovery_site_network}}",
- "subnet_list": [
- {
- "external_connectivity_state": "DISABLED",
- "gateway_ip": "{{dr.gateway_ip}}",
- "prefix_length": 24
- }
- ]
- },
- "test_ip_assignment_list": [
- {
- "ip_config_list": [
- {
- "ip_address": "{{dr.recovery_ip1}}"
- }
- ],
- "vm_reference": {
- "kind": "vm",
- "name": "{{dr_vm_name}}",
- "uuid": "{{dr_vm.uuid}}"
- }
- }
- ],
- "test_network": {
- "name": "{{dr.recovery_site_network}}",
- "subnet_list": [
- {
- "external_connectivity_state": "DISABLED",
- "gateway_ip": "{{dr.gateway_ip}}",
- "prefix_length": 24
- }
- ]
- }
- }
- ]
- }
- ]
- expected_stage_work_0: {
- "recover_entities": {
- "entity_info_list": [
- {
- "any_entity_reference": {
- "kind": "vm",
- "name": "{{dr_vm_name}}",
- "uuid": "{{dr_vm.uuid}}"
- },
- "script_list": [
- {
- "enable_script_exec": true
- }
- ]
- }
- ]
- }
- }
+ "availability_zone_url": "{{dr.recovery_az_url}}",
+ "recovery_ip_assignment_list":
+ [
+ {
+ "ip_config_list":
+ [{ "ip_address": "{{dr.recovery_ip2}}" }],
+ "vm_reference":
+ {
+ "kind": "vm",
+ "name": "{{dr_vm_name}}",
+ "uuid": "{{dr_vm.uuid}}",
+ },
+ },
+ ],
+ "recovery_network":
+ {
+ "name": "{{dr.recovery_site_network}}",
+ "subnet_list":
+ [
+ {
+ "external_connectivity_state": "DISABLED",
+ "gateway_ip": "{{dr.gateway_ip}}",
+ "prefix_length": 24,
+ },
+ ],
+ },
+ "test_ip_assignment_list":
+ [
+ {
+ "ip_config_list":
+ [{ "ip_address": "{{dr.recovery_ip1}}" }],
+ "vm_reference":
+ {
+ "kind": "vm",
+ "name": "{{dr_vm_name}}",
+ "uuid": "{{dr_vm.uuid}}",
+ },
+ },
+ ],
+ "test_network":
+ {
+ "name": "{{dr.recovery_site_network}}",
+ "subnet_list":
+ [
+ {
+ "external_connectivity_state": "DISABLED",
+ "gateway_ip": "{{dr.gateway_ip}}",
+ "prefix_length": 24,
+ },
+ ],
+ },
+ },
+ ],
+ },
+ ]
+ expected_stage_work_0:
+ {
+ "recover_entities":
+ {
+ "entity_info_list":
+ [
+ {
+ "any_entity_reference":
+ {
+ "kind": "vm",
+ "name": "{{dr_vm_name}}",
+ "uuid": "{{dr_vm.uuid}}",
+ },
+ "script_list": [{ "enable_script_exec": true }],
+ },
+ ],
+ },
+ }
- name: Create checkmode spec for recovery plan with networks and 2 stage
- check_mode: yes
+ check_mode: true
ntnx_recovery_plans:
state: "present"
name: test-integration-rp
@@ -195,9 +194,8 @@
name: "{{dr.recovery_site_network}}"
register: result
-
- name: Checkmode spec assert
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed is false
@@ -209,8 +207,8 @@
- result.response.spec.resources.stage_list[0]["stage_work"] == expected_stage_work_0
- result.response.spec.resources.parameters.availability_zone_list == expected_availability_zone_list
- result.response.spec.resources.parameters.network_mapping_list == expected_network_mapping_list_for_check_mode
- fail_msg: 'Unable to create recovery plan check mode spec'
- success_msg: 'Recovery plan check mode spec created successfully'
+ fail_msg: "Unable to create recovery plan check mode spec"
+ success_msg: "Recovery plan check mode spec created successfully"
- name: Create recovery plan with networks and 2 stage
ntnx_recovery_plans:
@@ -265,11 +263,12 @@
register: result
-- set_fact:
+- name: Set plan_uuid
+ ansible.builtin.set_fact:
plan_uuid: "{{result.plan_uuid}}"
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed is true
@@ -284,138 +283,128 @@
- result.response.status.resources.stage_list[0]["stage_work"] == expected_stage_work_0
- result.response.status.resources.parameters.availability_zone_list == expected_availability_zone_list
- result.response.status.resources.parameters.network_mapping_list == expected_network_mapping_list
- fail_msg: 'Unable to create recovery plans'
- success_msg: 'Recovery plan created successfully'
-
-############################################################### Update Recovery Plan ###########################################################################################
-
-- set_fact:
- expected_availability_zone_list: [
+ fail_msg: "Unable to create recovery plans"
+ success_msg: "Recovery plan created successfully"
+
+############################################ Update Recovery Plan ########################################
+
+- name: Set variables
+ ansible.builtin.set_fact:
+ expected_availability_zone_list:
+ [
+ { "availability_zone_url": "{{dr.primary_az_url}}" },
+ { "availability_zone_url": "{{dr.recovery_az_url}}" },
+ ]
+ expected_network_mapping_list_in_check_mode:
+ [
+ {
+ "are_networks_stretched": false,
+ "availability_zone_network_mapping_list":
+ [
+ {
+ "availability_zone_url": "{{dr.primary_az_url}}",
+ "recovery_network":
+ {
+ "name": "{{static.name}}",
+ "subnet_list":
+ [
+ {
+ "gateway_ip": "{{static.gateway_ip}}",
+ "prefix_length": 24,
+ },
+ ],
+ },
+ "test_network":
+ {
+ "name": "{{static.name}}",
+ "subnet_list":
+ [
+ {
+ "gateway_ip": "{{static.gateway_ip}}",
+ "prefix_length": 24,
+ },
+ ],
+ },
+ },
+ {
+ "availability_zone_url": "{{dr.recovery_az_url}}",
+ "recovery_network": { "name": "{{dr.recovery_site_network}}" },
+ "test_network": { "name": "{{dr.recovery_site_network}}" },
+ },
+ ],
+ },
+ ]
+ expected_network_mapping_list:
+ [
+ {
+ "are_networks_stretched": false,
+ "availability_zone_network_mapping_list":
+ [
{
- "availability_zone_url": "{{dr.primary_az_url}}"
+ "availability_zone_url": "{{dr.primary_az_url}}",
+ "recovery_network":
+ {
+ "name": "{{static.name}}",
+ "subnet_list":
+ [
+ {
+ "external_connectivity_state": "DISABLED",
+ "gateway_ip": "{{static.gateway_ip}}",
+ "prefix_length": 24,
+ },
+ ],
+ },
+ "test_network":
+ {
+ "name": "{{static.name}}",
+ "subnet_list":
+ [
+ {
+ "external_connectivity_state": "DISABLED",
+ "gateway_ip": "{{static.gateway_ip}}",
+ "prefix_length": 24,
+ },
+ ],
+ },
},
{
- "availability_zone_url": "{{dr.recovery_az_url}}"
- }
- ]
- expected_network_mapping_list_in_check_mode: [
- {
- "are_networks_stretched": false,
- "availability_zone_network_mapping_list": [
- {
- "availability_zone_url": "{{dr.primary_az_url}}",
- "recovery_network": {
- "name": "{{static.name}}",
- "subnet_list": [
- {
- "gateway_ip": "{{static.gateway_ip}}",
- "prefix_length": 24
- }
- ]
- },
- "test_network": {
- "name": "{{static.name}}",
- "subnet_list": [
- {
- "gateway_ip": "{{static.gateway_ip}}",
- "prefix_length": 24
- }
- ]
- }
- },
- {
- "availability_zone_url": "{{dr.recovery_az_url}}",
- "recovery_network": {
- "name": "{{dr.recovery_site_network}}"
- },
- "test_network": {
- "name": "{{dr.recovery_site_network}}"
- }
- }
- ]
- }
- ]
- expected_network_mapping_list: [
- {
- "are_networks_stretched": false,
- "availability_zone_network_mapping_list": [
- {
- "availability_zone_url": "{{dr.primary_az_url}}",
- "recovery_network": {
- "name": "{{static.name}}",
- "subnet_list": [
- {
- "external_connectivity_state": "DISABLED",
- "gateway_ip": "{{static.gateway_ip}}",
- "prefix_length": 24
- }
- ]
- },
- "test_network": {
- "name": "{{static.name}}",
- "subnet_list": [
- {
- "external_connectivity_state": "DISABLED",
- "gateway_ip": "{{static.gateway_ip}}",
- "prefix_length": 24
- }
- ]
- }
- },
- {
- "availability_zone_url": "{{dr.recovery_az_url}}",
- "recovery_network": {
- "name": "{{dr.recovery_site_network}}"
- },
- "test_network": {
- "name": "{{dr.recovery_site_network}}"
- }
- }
- ]
- }
- ]
- exepected_stage_work_0: {
- "recover_entities": {
- "entity_info_list": [
- {
- "any_entity_reference": {
- "kind": "vm",
- "name": "{{dr_vm.name}}",
- "uuid": "{{dr_vm.uuid}}"
- },
- "script_list": [
- {
- "enable_script_exec": true
- }
- ]
- },
- {
- "categories": {
- "Environment": "Staging"
- },
- "script_list": [
- {
- "enable_script_exec": true
- }
- ]
- }
- ]
- }
- }
- exepected_stage_work_1: {
- "recover_entities": {
- "entity_info_list": [
- {
- "categories": {
- "Environment": "Dev"
- }
- }
- ]
- }
- }
+ "availability_zone_url": "{{dr.recovery_az_url}}",
+ "recovery_network": { "name": "{{dr.recovery_site_network}}" },
+ "test_network": { "name": "{{dr.recovery_site_network}}" },
+ },
+ ],
+ },
+ ]
+ exepected_stage_work_0:
+ {
+ "recover_entities":
+ {
+ "entity_info_list":
+ [
+ {
+ "any_entity_reference":
+ {
+ "kind": "vm",
+ "name": "{{dr_vm.name}}",
+ "uuid": "{{dr_vm.uuid}}",
+ },
+ "script_list": [{ "enable_script_exec": true }],
+ },
+ {
+ "categories": { "Environment": "Staging" },
+ "script_list": [{ "enable_script_exec": true }],
+ },
+ ],
+ },
+ }
+ exepected_stage_work_1:
+ {
+ "recover_entities":
+ { "entity_info_list": [{ "categories": { "Environment": "Dev" } }] },
+ }
- name: Checkmode spec for Update recovery plan. Update networks and stages.
- check_mode: yes
+ check_mode: true
ntnx_recovery_plans:
plan_uuid: "{{plan_uuid}}"
state: "present"
@@ -456,8 +445,8 @@
register: result
-- name: check mode spec for Update status
- assert:
+- name: Check mode spec for Update status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed is false
@@ -470,9 +459,8 @@
- result.response.spec.resources.stage_list[1]["stage_work"] == exepected_stage_work_1
- result.response.spec.resources.stage_list[0]["delay_time_secs"] == 2
- fail_msg: 'Unable to create update recovery plan checkmode spec'
- success_msg: 'Recovery plan update spec created successfully'
-
+ fail_msg: "Unable to create update recovery plan checkmode spec"
+ success_msg: "Recovery plan update spec created successfully"
- name: Update recovery plan. Add another stage, vm and update networks.
ntnx_recovery_plans:
@@ -515,7 +503,7 @@
register: recovery_plan
- name: Update status
- assert:
+ ansible.builtin.assert:
that:
- recovery_plan.response is defined
- recovery_plan.changed is true
@@ -533,7 +521,6 @@
fail_msg: 'Unable to update recovery plans'
success_msg: 'Recovery plan updated successfully'
-
- name: Idempotency Check
ntnx_recovery_plans:
plan_uuid: "{{plan_uuid}}"
@@ -575,8 +562,8 @@
register: result
-- name: idempotency check status
- assert:
+- name: Idempotency check status
+ ansible.builtin.assert:
that:
- result.changed == False
- result.failed == False
@@ -585,8 +572,7 @@
fail_msg: "Idempotency check failed"
success_msg: "Idempotency check passed"
-############################################################### Run Recovery Plan Jobs###########################################################################################
-
+############################ Run Recovery Plan Jobs#########################################
- name: Run Test Failover with validation errors for checking negative scenario. It will fail in validation phase
ntnx_recovery_plan_jobs:
@@ -605,8 +591,8 @@
register: result
-- name: assert job status
- assert:
+- name: Assert job status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == true
@@ -632,9 +618,8 @@
register: test_failover_job
-
-- name: assert job status
- assert:
+- name: Assert job status
+ ansible.builtin.assert:
that:
- test_failover_job.changed == true
- test_failover_job.failed == false
@@ -649,7 +634,6 @@
fail_msg: "Test failover job failed"
success_msg: "Test failover job run successfully"
-
- name: Run Cleanup
ntnx_recovery_plan_jobs:
job_uuid: "{{test_failover_job.job_uuid}}"
@@ -658,9 +642,8 @@
action: CLEANUP
register: result
-
-- name: assert job status
- assert:
+- name: Assert job status
+ ansible.builtin.assert:
that:
- result.changed == true
- result.failed == false
@@ -672,7 +655,7 @@
fail_msg: "Cleanup job failed"
success_msg: "Cleanup job run successfully"
-############################################################### Delete Recovery Plan Test###########################################################################################
+############################## Delete Recovery Plan Test######################################
- name: Delete recovery plan
ntnx_recovery_plans:
@@ -680,8 +663,8 @@
state: "absent"
register: result
-- name: delete Status
- assert:
+- name: Delete Status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
diff --git a/tests/integration/targets/ntnx_recovery_plans_and_jobs/tasks/main.yml b/tests/integration/targets/ntnx_recovery_plans_and_jobs/tasks/main.yml
index 2369b4b0b..075f510f4 100644
--- a/tests/integration/targets/ntnx_recovery_plans_and_jobs/tasks/main.yml
+++ b/tests/integration/targets/ntnx_recovery_plans_and_jobs/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "crud.yml"
+ - name: Import crud.yml
+ ansible.builtin.import_tasks: "crud.yml"
diff --git a/tests/integration/targets/ntnx_recovery_plans_and_jobs_info/tasks/info.yml b/tests/integration/targets/ntnx_recovery_plans_and_jobs_info/tasks/info.yml
index 654b50050..cdf7d464d 100644
--- a/tests/integration/targets/ntnx_recovery_plans_and_jobs_info/tasks/info.yml
+++ b/tests/integration/targets/ntnx_recovery_plans_and_jobs_info/tasks/info.yml
@@ -1,4 +1,5 @@
-- debug:
+- name: Start testing ntnx_recovery_plans_info
+ ansible.builtin.debug:
msg: start testing ntnx_recovery_plans_info
##################################################
@@ -67,10 +68,10 @@
- name: List all Recovery plans
ntnx_recovery_plans_info:
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.metadata.total_matches > 0
@@ -78,9 +79,11 @@
fail_msg: "Unable to list all recovery plan"
success_msg: "recovery plans info obtained successfully"
-- set_fact:
+- name: Set test plan name
+ ansible.builtin.set_fact:
test_plan_name: "{{result.response.entities.1.status.name}}"
-- set_fact:
+- name: Set test plan uuid
+ ansible.builtin.set_fact:
test_plan_uuid: "{{result.response.entities.1.metadata.uuid}}"
##################################################
@@ -89,10 +92,10 @@
ntnx_recovery_plans_info:
plan_uuid: "{{ test_plan_uuid }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -111,10 +114,10 @@
filter:
name: "{{ test_plan_name }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -132,10 +135,10 @@
length: 1
offset: 1
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -146,7 +149,8 @@
################################################## Recovery plan jobs info test #########################################################
-- debug:
+- name: Start testing ntnx_recovery_plan_jobs_info
+ ansible.builtin.debug:
msg: start testing ntnx_recovery_plan_jobs_info
- name: Run validation job, eventually will fail due to some tech issues but can be used for info tests.
@@ -161,6 +165,7 @@
recovery_site:
url: "{{dr.recovery_az_url}}"
action: VALIDATE
+ register: result
ignore_errors: true
no_log: true
@@ -186,10 +191,10 @@
ntnx_recovery_plan_jobs_info:
nutanix_host: "{{recovery_site_ip}}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.metadata.total_matches > 0
@@ -197,11 +202,14 @@
fail_msg: "Unable to list all recovery plan jobs"
success_msg: "recovery plans jobs info obtained successfully"
-- set_fact:
+- name: Set test job name
+ ansible.builtin.set_fact:
test_job_name: "{{result.response.entities.1.status.name}}"
-- set_fact:
+- name: Set test job uuid
+ ansible.builtin.set_fact:
test_job_uuid: "{{result.response.entities.1.metadata.uuid}}"
-- set_fact:
+- name: Set test job name
+ ansible.builtin.set_fact:
test_job_name_1: "{{ test_job.error.status.name }}"
##################################################
@@ -211,10 +219,10 @@
nutanix_host: "{{recovery_site_ip}}"
job_uuid: "{{ test_job_uuid }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -233,10 +241,10 @@
filter:
name: "{{ test_job_name_1 }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -255,10 +263,10 @@
length: 2
offset: 1
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -267,19 +275,18 @@
fail_msg: "Unable to list recovery plan jobs using length and offset"
success_msg: "recovery plan jobs listed successfully using length and offset"
-
################################################## Delete recovery plans #########################################################
- name: Delete created recovery plans
ntnx_recovery_plans:
state: absent
- wait: True
+ wait: true
plan_uuid: "{{ recovery_plan1.plan_uuid }}"
register: result
- name: Delete created recovery plans
ntnx_recovery_plans:
state: absent
- wait: True
+ wait: true
plan_uuid: "{{ recovery_plan2.plan_uuid }}"
register: result
diff --git a/tests/integration/targets/ntnx_recovery_plans_and_jobs_info/tasks/main.yml b/tests/integration/targets/ntnx_recovery_plans_and_jobs_info/tasks/main.yml
index 3364b30c6..74e773fce 100644
--- a/tests/integration/targets/ntnx_recovery_plans_and_jobs_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_recovery_plans_and_jobs_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "info.yml"
+ - name: Import info.yml
+ ansible.builtin.import_tasks: "info.yml"
diff --git a/tests/integration/targets/ntnx_roles/tasks/create.yml b/tests/integration/targets/ntnx_roles/tasks/create.yml
index 541965519..38d7823ee 100644
--- a/tests/integration/targets/ntnx_roles/tasks/create.yml
+++ b/tests/integration/targets/ntnx_roles/tasks/create.yml
@@ -1,5 +1,6 @@
---
-- debug:
+- name: Start ntnx_roles create tests
+ ansible.builtin.debug:
msg: start ntnx_roles create tests
- name: Get Some permissions for test
@@ -7,7 +8,8 @@
length: 3
register: result
-- set_fact:
+- name: Set variables
+ ansible.builtin.set_fact:
test_permission_1_name: "{{ result.response.entities[0].status.name }}"
test_permission_1_uuid: "{{ result.response.entities[0].metadata.uuid }}"
test_permission_2_name: "{{ result.response.entities[1].status.name }}"
@@ -28,12 +30,13 @@
wait: true
register: result
-- set_fact:
+- name: Set permission uuids
+ ansible.builtin.set_fact:
p1: "{{ result.response.status.resources.permission_reference_list[0].uuid }}"
p2: "{{ result.response.status.resources.permission_reference_list[1].uuid }}"
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.role_uuid is defined
@@ -41,12 +44,17 @@
- result.changed == True
- result.response.status.name == "test-ansible-role-1"
- result.response.status.description == "test-ansible-role-1-desc"
- - ("{{ p1 }}" == "{{ test_permission_1_uuid }}" and "{{ p2 }}" == "{{ test_permission_2_uuid }}") or ("{{ p2 }}" == "{{ test_permission_1_uuid }}" and "{{ p1 }}" == "{{ test_permission_2_uuid }}")
+ - >
+ (
+ ("{{ p1 }}" == "{{ test_permission_1_uuid }}" and "{{ p2 }}" == "{{ test_permission_2_uuid }}") or
+ ("{{ p2 }}" == "{{ test_permission_1_uuid }}" and "{{ p1 }}" == "{{ test_permission_2_uuid }}")
+ )
fail_msg: "Unable to create roles with certain permissions"
success_msg: "Roles with given permissions created susccessfully"
-- set_fact:
+- name: Set todelete variable
+ ansible.builtin.set_fact:
todelete: '{{ result["response"]["metadata"]["uuid"] }}'
###################################################################################################
@@ -60,10 +68,10 @@
- uuid: "{{ test_permission_2_uuid }}"
wait: true
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.msg == "Role with given name already exists"
- result.changed == False
@@ -73,7 +81,7 @@
###################################################################################################
- name: Check mode test
- check_mode: yes
+ check_mode: true
ntnx_roles:
state: present
name: test-ansible-role-2
@@ -85,7 +93,7 @@
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -99,14 +107,13 @@
###################################################################################################
-
-- name: cleanup created entities
+- name: Cleanup created entities
ntnx_roles:
state: absent
role_uuid: "{{ todelete }}"
register: result
- ignore_errors: True
-
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_roles/tasks/delete.yml b/tests/integration/targets/ntnx_roles/tasks/delete.yml
index 3d4f00410..ab3d0e185 100644
--- a/tests/integration/targets/ntnx_roles/tasks/delete.yml
+++ b/tests/integration/targets/ntnx_roles/tasks/delete.yml
@@ -1,5 +1,6 @@
---
-- debug:
+- name: Start ntnx_roles delete tests
+ ansible.builtin.debug:
msg: start ntnx_roles delete tests
- name: Get Some permissions for test
@@ -7,7 +8,8 @@
length: 3
register: result
-- set_fact:
+- name: Set test permission uuid
+ ansible.builtin.set_fact:
test_permission_1_uuid: "{{ result.response.entities[0].metadata.uuid }}"
##############################################################################################
@@ -23,7 +25,7 @@
register: test_role
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- test_role.response is defined
- test_role.changed == True
@@ -32,14 +34,14 @@
###################################################################################################
-- name: delete role
+- name: Delete role
ntnx_roles:
state: absent
role_uuid: "{{ test_role.role_uuid }}"
register: result
-- name: delete Status
- assert:
+- name: Delete Status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == True
diff --git a/tests/integration/targets/ntnx_roles/tasks/main.yml b/tests/integration/targets/ntnx_roles/tasks/main.yml
index a2c7a07b0..65a6e2952 100644
--- a/tests/integration/targets/ntnx_roles/tasks/main.yml
+++ b/tests/integration/targets/ntnx_roles/tasks/main.yml
@@ -1,11 +1,15 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create.yml"
- - import_tasks: "update.yml"
- - import_tasks: "delete.yml"
+ - name: Import create.yml
+ ansible.builtin.import_tasks: "create.yml"
+ - name: Import update.yml
+ ansible.builtin.import_tasks: "update.yml"
+ - name: Import delete.yml
+ ansible.builtin.import_tasks: "delete.yml"
diff --git a/tests/integration/targets/ntnx_roles/tasks/update.yml b/tests/integration/targets/ntnx_roles/tasks/update.yml
index 16644d37e..ecee981d0 100644
--- a/tests/integration/targets/ntnx_roles/tasks/update.yml
+++ b/tests/integration/targets/ntnx_roles/tasks/update.yml
@@ -1,5 +1,6 @@
---
-- debug:
+- name: Start ntnx_roles update tests
+ ansible.builtin.debug:
msg: start ntnx_roles update tests
- name: Get Some permissions for test
@@ -7,7 +8,8 @@
length: 3
register: result
-- set_fact:
+- name: Set permission names and uuids
+ ansible.builtin.set_fact:
test_permission_1_name: "{{ result.response.entities[0].status.name }}"
test_permission_1_uuid: "{{ result.response.entities[0].metadata.uuid }}"
test_permission_2_name: "{{ result.response.entities[1].status.name }}"
@@ -29,14 +31,13 @@
register: test_role
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- test_role.response is defined
- test_role.changed == True
fail_msg: "Unable to create roles with certain permissions"
success_msg: "Roles with given permissions created susccessfully"
-
###################################################################################################
- name: Update all fields
@@ -51,7 +52,7 @@
register: result
- name: Update status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.role_uuid is defined
@@ -78,8 +79,8 @@
wait: true
register: result
-- name: idempotency check status
- assert:
+- name: Idempotency check status
+ ansible.builtin.assert:
that:
- result.changed == False
- result.failed == False
@@ -91,7 +92,7 @@
###################################################################################################
- name: Check mode test
- check_mode: yes
+ check_mode: true
ntnx_roles:
state: present
role_uuid: "{{test_role.role_uuid}}"
@@ -102,8 +103,8 @@
wait: true
register: result
-- name: check mode Status
- assert:
+- name: Check mode Status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == False
@@ -117,9 +118,9 @@
###################################################################################################
-- name: cleanup created entities
+- name: Cleanup created entities
ntnx_roles:
state: absent
role_uuid: "{{ test_role.role_uuid }}"
register: result
- ignore_errors: True
+ ignore_errors: true
diff --git a/tests/integration/targets/ntnx_roles_info/tasks/main.yml b/tests/integration/targets/ntnx_roles_info/tasks/main.yml
index 99faaf32c..faf9ff944 100644
--- a/tests/integration/targets/ntnx_roles_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_roles_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "roles_info.yml"
+ - name: Import roles_info.yml
+ ansible.builtin.import_tasks: "roles_info.yml"
diff --git a/tests/integration/targets/ntnx_roles_info/tasks/roles_info.yml b/tests/integration/targets/ntnx_roles_info/tasks/roles_info.yml
index 176a97f46..4d4ddf4ed 100644
--- a/tests/integration/targets/ntnx_roles_info/tasks/roles_info.yml
+++ b/tests/integration/targets/ntnx_roles_info/tasks/roles_info.yml
@@ -1,4 +1,5 @@
-- debug:
+- name: Start testing ntnx_roles_info
+ ansible.builtin.debug:
msg: start testing ntnx_roles_info
##################################################
@@ -6,10 +7,10 @@
ntnx_roles_info:
length: 2
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.metadata.total_matches > 0
@@ -17,9 +18,11 @@
fail_msg: "Unable to list all roles"
success_msg: "roles info obtained successfully"
-- set_fact:
+- name: Set test role name variable
+ ansible.builtin.set_fact:
test_role_name: "{{result.response.entities.1.status.name}}"
-- set_fact:
+- name: Set test role uuid variable
+ ansible.builtin.set_fact:
test_role_uuid: "{{result.response.entities.1.metadata.uuid}}"
##################################################
@@ -28,10 +31,10 @@
ntnx_roles_info:
role_uuid: "{{ test_role_uuid }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -48,10 +51,10 @@
filter:
name: "{{ test_role_name }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -69,10 +72,10 @@
length: 1
offset: 1
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
diff --git a/tests/integration/targets/ntnx_security_rules/tasks/app_rule.yml b/tests/integration/targets/ntnx_security_rules/tasks/app_rule.yml
index 0e9b038e3..1fb08ba1c 100644
--- a/tests/integration/targets/ntnx_security_rules/tasks/app_rule.yml
+++ b/tests/integration/targets/ntnx_security_rules/tasks/app_rule.yml
@@ -1,154 +1,144 @@
-- name: create app security rule with inbound and outbound list
+- name: Create app security rule with inbound and outbound list
ntnx_security_rules:
- name: test_app_rule
+ name: Test_app_rule
app_rule:
target_group:
- categories:
- apptype: Apache_Spark
- apptype_filter_by_category:
- AppFamily:
- - Backup
- apptiers:
- - "{{categories.apptiers[0]}}"
- - "{{categories.apptiers[1]}}"
+ categories:
+ apptype: Apache_Spark
+ apptype_filter_by_category:
+ AppFamily:
+ - Backup
+ apptiers:
+ - "{{categories.apptiers[0]}}"
+ - "{{categories.apptiers[1]}}"
- default_internal_policy: DENY_ALL
+ default_internal_policy: DENY_ALL
inbounds:
- -
- categories:
- AppFamily:
- - Databases
- - DevOps
- description: test description
- protocol:
- tcp:
- - start_port: 22
- end_port: 80
- -
- categories:
- AppFamily:
- - Databases
- - DevOps
- protocol:
- icmp:
- - code: 1
- type: 1
- -
- categories:
- AppFamily:
- - Databases
- - DevOps
- protocol:
- udp:
- - start_port: 82
- end_port: 8080
- -
- categories:
- AppFamily:
- - Databases
- - DevOps
- protocol:
- service:
- name: 6a44
- -
- ip_subnet:
- prefix_length: 24
- ip: 192.168.1.0
- description: test description
- -
- address:
- name: dest
+ - categories:
+ AppFamily:
+ - Databases
+ - DevOps
+ description: test description
+ protocol:
+ tcp:
+ - start_port: 22
+ end_port: 80
+ - categories:
+ AppFamily:
+ - Databases
+ - DevOps
+ protocol:
+ icmp:
+ - code: 1
+ type: 1
+ - categories:
+ AppFamily:
+ - Databases
+ - DevOps
+ protocol:
+ udp:
+ - start_port: 82
+ end_port: 8080
+ - categories:
+ AppFamily:
+ - Databases
+ - DevOps
+ protocol:
+ service:
+ name: 6a44
+ - ip_subnet:
+ prefix_length: 24
+ ip: 192.168.1.0
+ description: test description
+ - address:
+ name: Dest
outbounds:
- -
- categories:
- AppFamily:
- - Databases
- - DevOps
- protocol:
- icmp:
- - code: 1
- type: 1
+ - categories:
+ AppFamily:
+ - Databases
+ - DevOps
+ protocol:
+ icmp:
+ - code: 1
+ type: 1
policy_mode: MONITOR
allow_ipv6_traffic: true
policy_hitlog: true
register: result
ignore_errors: true
-
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
- result.response.status.state == 'COMPLETE'
- result.response.status.name=="test_app_rule"
- result.response.status.resources.app_rule.target_group.filter.params.AppTier | length == 2
- fail_msg: ' fail: unable to create app security rule with inbound and outbound list'
- success_msg: 'pass: create app security rule with inbound and outbound list successfully'
+ fail_msg: " fail: unable to create app security rule with inbound and outbound list"
+ success_msg: "pass: create app security rule with inbound and outbound list successfully"
-- name: update app security rule by adding to outbound list and remove tule from inbound list
+- name: Update app security rule by adding to outbound list and remove tule from inbound list
ntnx_security_rules:
- security_rule_uuid: '{{ result.response.metadata.uuid }}'
+ security_rule_uuid: "{{ result.response.metadata.uuid }}"
app_rule:
policy_mode: APPLY
inbounds:
- -
- rule_id: "{{result.response.spec.resources.app_rule.inbound_allow_list.0.rule_id}}"
+ - rule_id: "{{result.response.spec.resources.app_rule.inbound_allow_list.0.rule_id}}"
state: absent
outbounds:
- -
- protocol:
- icmp:
- - code: 1
- type: 1
- categories:
- AppFamily:
- - Databases
- - DevOps
+ - protocol:
+ icmp:
+ - code: 1
+ type: 1
+ categories:
+ AppFamily:
+ - Databases
+ - DevOps
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
- result.response.status.state == 'COMPLETE'
- result.response.spec.resources.app_rule.action == "APPLY"
- result.response.spec.resources.app_rule.outbound_allow_list.0.icmp_type_code_list is defined
- fail_msg: ' fail: unable to update app security rule with outbound list '
- success_msg: 'pass :update app security rule with outbound list successfully'
+ fail_msg: " fail: unable to update app security rule with outbound list "
+ success_msg: "pass :update app security rule with outbound list successfully"
-- name: delete app security rule
+- name: Delete app security rule
ntnx_security_rules:
state: absent
- security_rule_uuid: '{{ result.response.metadata.uuid }}'
+ security_rule_uuid: "{{ result.response.metadata.uuid }}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
- result.response.status == 'SUCCEEDED'
- fail_msg: ' fail: unable to delete app security rule '
- success_msg: 'pass : delete app security rule successfully'
-- name: create app security rule with allow all inbound and outbound list
+ fail_msg: " fail: unable to delete app security rule "
+ success_msg: "pass : delete app security rule successfully"
+- name: Create app security rule with allow all inbound and outbound list
ntnx_security_rules:
- name: test_app_rule
+ name: Test_app_rule
app_rule:
target_group:
- categories:
- apptype: Apache_Spark
- apptype_filter_by_category:
- AppFamily:
- - Backup
- apptiers:
- - "{{categories.apptiers[0]}}"
- - "{{categories.apptiers[1]}}"
- default_internal_policy: DENY_ALL
+ categories:
+ apptype: Apache_Spark
+ apptype_filter_by_category:
+ AppFamily:
+ - Backup
+ apptiers:
+ - "{{categories.apptiers[0]}}"
+ - "{{categories.apptiers[1]}}"
+ default_internal_policy: DENY_ALL
allow_all_outbounds: true
allow_all_inbounds: true
policy_mode: MONITOR
@@ -158,7 +148,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -166,20 +156,20 @@
- result.response.spec.name=="test_app_rule"
- result.response.status.resources.app_rule.target_group.filter.params.AppTier | length == 2
- fail_msg: ' fail: unable to create app security rule with allow all inbound and outbound list'
- success_msg: 'pass: create app security rule with allow all inbound and outbound list successfully'
-- name: delete app security rule
+ fail_msg: " fail: unable to create app security rule with allow all inbound and outbound list"
+ success_msg: "pass: create app security rule with allow all inbound and outbound list successfully"
+- name: Delete app security rule
ntnx_security_rules:
state: absent
- security_rule_uuid: '{{ result.response.metadata.uuid }}'
+ security_rule_uuid: "{{ result.response.metadata.uuid }}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
- result.response.status == 'SUCCEEDED'
- fail_msg: ' fail: unable to delete app security rule '
- success_msg: 'pass : delete app security rule successfully'
+ fail_msg: " fail: unable to delete app security rule "
+ success_msg: "pass : delete app security rule successfully"
diff --git a/tests/integration/targets/ntnx_security_rules/tasks/isolation_rule.yml b/tests/integration/targets/ntnx_security_rules/tasks/isolation_rule.yml
index 5a7243409..3cf47b9d5 100644
--- a/tests/integration/targets/ntnx_security_rules/tasks/isolation_rule.yml
+++ b/tests/integration/targets/ntnx_security_rules/tasks/isolation_rule.yml
@@ -1,15 +1,15 @@
- name: >-
- create isolation security rule with first_entity_filter and
+ Create isolation security rule with first_entity_filter and
second_entity_filter with check mode
ntnx_security_rules:
name: test_isolation_rule
isolation_rule:
isolate_category:
- Environment:
- - Dev
+ Environment:
+ - Dev
from_category:
- Environment:
- - Production
+ Environment:
+ - Production
subset_category:
Environment:
- Staging
@@ -19,29 +19,29 @@
check_mode: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
- result.changed == false
- result.response.spec.name=="test_isolation_rule"
- result.security_rule_uuid is none
- fail_msg: ' fail: unable to create isolation security rule with first_entity_filter and second_entity_filter with check mode '
+ fail_msg: " fail: unable to create isolation security rule with first_entity_filter and second_entity_filter with check mode "
success_msg: >-
pass: create isolation security rule with first_entity_filter and
second_entity_filter successfully with check mode
- name: >-
- create isolation security rule with first_entity_filter and
+ Create isolation security rule with first_entity_filter and
second_entity_filter
ntnx_security_rules:
name: test_isolation_rule
isolation_rule:
isolate_category:
- Environment:
- - Dev
+ Environment:
+ - Dev
from_category:
- Environment:
- - Production
+ Environment:
+ - Production
subset_category:
Environment:
- Staging
@@ -51,20 +51,20 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
- result.response.spec.name=="test_isolation_rule"
- result.response.status.state == 'COMPLETE'
- fail_msg: ' fail: unable to create isolation security rule with first_entity_filter and second_entity_filter'
+ fail_msg: " fail: unable to create isolation security rule with first_entity_filter and second_entity_filter"
success_msg: >-
pass: create isolation security rule with first_entity_filter and
second_entity_filter successfully
-- name: update isoloation security rule action with check_mode
+- name: Update isoloation security rule action with check_mode
ntnx_security_rules:
- security_rule_uuid: '{{ result.response.metadata.uuid }}'
+ security_rule_uuid: "{{ result.response.metadata.uuid }}"
isolation_rule:
policy_mode: APPLY
register: output
@@ -72,62 +72,62 @@
check_mode: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- output.response is defined
- output.failed == false
- output.changed == false
- output.response.spec.name=="test_isolation_rule"
- output.security_rule_uuid is none
- fail_msg: ' fail: unable to update isoloation security rule action with check_mode'
+ fail_msg: " fail: unable to update isoloation security rule action with check_mode"
success_msg: >-
pass: update isoloation security rule action with check_mode successfully
-- name: update isoloation security rule action
+- name: Update isoloation security rule action
ntnx_security_rules:
- security_rule_uuid: '{{ result.security_rule_uuid}}'
+ security_rule_uuid: "{{ result.security_rule_uuid}}"
isolation_rule:
policy_mode: APPLY
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
- result.changed == true
- result.response.status.state == 'COMPLETE'
- result.response.spec.resources.isolation_rule.action == "APPLY"
- fail_msg: ' fail: unable to update isolation rule action '
- success_msg: 'pass : update isolation rule action successfully'
-- name: update isoloation security with same values
+ fail_msg: " fail: unable to update isolation rule action "
+ success_msg: "pass : update isolation rule action successfully"
+- name: Update isoloation security with same values
ntnx_security_rules:
- security_rule_uuid: '{{result.security_rule_uuid}}'
+ security_rule_uuid: "{{result.security_rule_uuid}}"
isolation_rule:
policy_mode: APPLY
register: output
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- output.failed == false
- output.changed == false
- output.msg == "Nothing to change"
- fail_msg: ' fail: unable to update isolation rule action '
- success_msg: 'pass : update isolation rule action successfully'
-- name: delete isolation rule
+ fail_msg: " fail: unable to update isolation rule action "
+ success_msg: "pass : update isolation rule action successfully"
+- name: Delete isolation rule
ntnx_security_rules:
state: absent
- security_rule_uuid: '{{ result.security_rule_uuid }}'
+ security_rule_uuid: "{{ result.security_rule_uuid }}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
- result.response.status == 'SUCCEEDED'
- fail_msg: ' fail: unable to delete isolation security rule '
- success_msg: 'pass : delete isolation security rule successfully'
+ fail_msg: " fail: unable to delete isolation security rule "
+ success_msg: "pass : delete isolation security rule successfully"
diff --git a/tests/integration/targets/ntnx_security_rules/tasks/main.yml b/tests/integration/targets/ntnx_security_rules/tasks/main.yml
index 172cfd461..84a839770 100644
--- a/tests/integration/targets/ntnx_security_rules/tasks/main.yml
+++ b/tests/integration/targets/ntnx_security_rules/tasks/main.yml
@@ -1,12 +1,17 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "app_rule.yml"
- - import_tasks: "isolation_rule.yml"
- - import_tasks: "quarantine_rule.yml"
- - import_tasks: "vdi.yml"
+ - name: Import app_rule.yml
+ ansible.builtin.import_tasks: "app_rule.yml"
+ - name: Import isolation_rule.yml
+ ansible.builtin.import_tasks: "isolation_rule.yml"
+ - name: Import quarantine_rule.yml
+ ansible.builtin.import_tasks: "quarantine_rule.yml"
+ - name: Import vdi.yml
+ ansible.builtin.import_tasks: "vdi.yml"
diff --git a/tests/integration/targets/ntnx_security_rules/tasks/quarantine_rule.yml b/tests/integration/targets/ntnx_security_rules/tasks/quarantine_rule.yml
index dba621b3d..352a247d3 100644
--- a/tests/integration/targets/ntnx_security_rules/tasks/quarantine_rule.yml
+++ b/tests/integration/targets/ntnx_security_rules/tasks/quarantine_rule.yml
@@ -1,35 +1,33 @@
- - name: update quarantine_rule by adding inbound and outbound list
- ntnx_security_rules:
- security_rule_uuid: "{{quarantine_rule_uuid}}"
- quarantine_rule:
- target_group:
- default_internal_policy: DENY_ALL
- inbounds:
- -
- categories:
- AppFamily:
- - Databases
- - DevOps
- outbounds:
- -
- categories:
- AppFamily:
- - Databases
- - DevOps
- policy_mode: MONITOR
- allow_ipv6_traffic: true
- policy_hitlog: true
- register: result
- ignore_errors: true
+- name: Update quarantine_rule by adding inbound and outbound list
+ ntnx_security_rules:
+ security_rule_uuid: "{{quarantine_rule_uuid}}"
+ quarantine_rule:
+ target_group:
+ default_internal_policy: DENY_ALL
+ inbounds:
+ - categories:
+ AppFamily:
+ - Databases
+ - DevOps
+ outbounds:
+ - categories:
+ AppFamily:
+ - Databases
+ - DevOps
+ policy_mode: MONITOR
+ allow_ipv6_traffic: true
+ policy_hitlog: true
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.failed == false
- - result.response.status.state == 'COMPLETE'
- - result.response.spec.resources.quarantine_rule.action == "MONITOR"
- fail_msg: ' fail: unable to update quarantine_rule by adding inbound and outbound list '
- success_msg: >-
- pass: update quarantine_rule by adding inbound and outbound list
- successfully
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.failed == false
+ - result.response.status.state == 'COMPLETE'
+ - result.response.spec.resources.quarantine_rule.action == "MONITOR"
+ fail_msg: " fail: unable to update quarantine_rule by adding inbound and outbound list "
+ success_msg: >-
+ pass: update quarantine_rule by adding inbound and outbound list
+ successfully
diff --git a/tests/integration/targets/ntnx_security_rules/tasks/vdi.yml b/tests/integration/targets/ntnx_security_rules/tasks/vdi.yml
index 42896d5ed..bdbb84777 100644
--- a/tests/integration/targets/ntnx_security_rules/tasks/vdi.yml
+++ b/tests/integration/targets/ntnx_security_rules/tasks/vdi.yml
@@ -1,51 +1,46 @@
-- name: create ad security rule with inbound and outbound list
+- name: Create ad security rule with inbound and outbound list
ntnx_security_rules:
name: VDI Policy
vdi_rule:
target_group:
- categories:
- adgroup: "$Default"
- default_internal_policy: DENY_ALL
+ categories:
+ adgroup: "$Default"
+ default_internal_policy: DENY_ALL
allow_all_outbounds: true
inbounds:
- -
- categories:
- AppFamily:
- - Databases
- - DevOps
- description: test description
- protocol:
- tcp:
- - start_port: 22
- end_port: 80
- -
- categories:
- AppFamily:
- - Databases
- - DevOps
- protocol:
- icmp:
- - code: 1
- type: 1
- -
- categories:
- AppFamily:
- - Databases
- - DevOps
- protocol:
- udp:
- - start_port: 82
- end_port: 8080
- -
- categories:
- AppFamily:
- - Databases
- - DevOps
- protocol:
- service:
- name: 6a44
- -
- address:
+ - categories:
+ AppFamily:
+ - Databases
+ - DevOps
+ description: test description
+ protocol:
+ tcp:
+ - start_port: 22
+ end_port: 80
+ - categories:
+ AppFamily:
+ - Databases
+ - DevOps
+ protocol:
+ icmp:
+ - code: 1
+ type: 1
+ - categories:
+ AppFamily:
+ - Databases
+ - DevOps
+ protocol:
+ udp:
+ - start_port: 82
+ end_port: 8080
+ - categories:
+ AppFamily:
+ - Databases
+ - DevOps
+ protocol:
+ service:
+ name: 6a44
+ - address:
name: dest
policy_mode: MONITOR
allow_ipv6_traffic: true
@@ -53,22 +48,21 @@
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
- result.response.spec.name=="VDI Policy"
- result.response.status.state == 'COMPLETE'
- fail_msg: ' fail: unable create ad security rule with inbound and outbound list'
+ fail_msg: " fail: unable create ad security rule with inbound and outbound list"
success_msg: >-
pass: create ad security rule with inbound and outbound list finished successfully
-- name: update VDI security rule action
+- name: Update VDI security rule action
ntnx_security_rules:
- security_rule_uuid: '{{ result.response.metadata.uuid }}'
+ security_rule_uuid: "{{ result.response.metadata.uuid }}"
vdi_rule:
inbounds:
- -
- ip_subnet:
+ - ip_subnet:
prefix_length: 8
ip: 10.0.0.0
description: test description
@@ -76,27 +70,27 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
- result.changed == true
- result.response.status.state == 'COMPLETE'
- fail_msg: ' fail: unable to update vdi_rule '
- success_msg: 'pass : update vdi_rule successfully'
+ fail_msg: " fail: unable to update vdi_rule "
+ success_msg: "pass : update vdi_rule successfully"
-- name: delete vdi_rule rule
+- name: Delete vdi_rule rule
ntnx_security_rules:
state: absent
- security_rule_uuid: '{{ result.response.metadata.uuid }}'
+ security_rule_uuid: "{{ result.response.metadata.uuid }}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
- result.response.status == 'SUCCEEDED'
- fail_msg: ' fail: unable to delete vdi_rule security rule '
- success_msg: 'pass : delete vdi_rule security rule successfully'
+ fail_msg: " fail: unable to delete vdi_rule security rule "
+ success_msg: "pass : delete vdi_rule security rule successfully"
diff --git a/tests/integration/targets/ntnx_security_rules_info/tasks/get_security_rules.yml b/tests/integration/targets/ntnx_security_rules_info/tasks/get_security_rules.yml
index d8396b751..53fb464f2 100644
--- a/tests/integration/targets/ntnx_security_rules_info/tasks/get_security_rules.yml
+++ b/tests/integration/targets/ntnx_security_rules_info/tasks/get_security_rules.yml
@@ -1,4 +1,5 @@
-- debug:
+- name: Start testing ntnx_security_rules_info
+ ansible.builtin.debug:
msg: Start testing ntnx_security_rules_info
###################################
- name: Create isolation_rule for testing
@@ -16,39 +17,39 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- first_rule.response is defined
- first_rule.failed == false
- first_rule.response.status.state == 'COMPLETE'
- first_rule.response.spec.name=="isolation_test_rule"
- fail_msg: ' fail: Unable to create isolation_rule for testing '
- success_msg: 'pass: isolation_rule for testing created successfully '
+ fail_msg: " fail: Unable to create isolation_rule for testing "
+ success_msg: "pass: isolation_rule for testing created successfully "
###################################
-- name: getting all security rules
+- name: Getting all security rules
ntnx_security_rules_info:
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
- result.failed == false
- result.response.metadata.kind == "network_security_rule"
- result.response.metadata.total_matches > 0
- fail_msg: ' fail: unable to get security rules '
- success_msg: 'pass: get all security rules successfully '
+ fail_msg: " fail: unable to get security rules "
+ success_msg: "pass: get all security rules successfully "
###################################
-- name: getting particular security rule using security_rule_uuid
+- name: Getting particular security rule using security_rule_uuid
ntnx_security_rules_info:
- security_rule_uuid: '{{ first_rule.response.metadata.uuid }}'
+ security_rule_uuid: "{{ first_rule.response.metadata.uuid }}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -58,7 +59,7 @@
fail_msg: ' fail : unable to get particular security rule using security_rule_uuid'
success_msg: 'pass: getting security rule using security_rule_uuid succesfuly'
###################################
-- name: getting all security rules sorted
+- name: Getting all security rules sorted
ntnx_security_rules_info:
sort_order: ASCENDING
sort_attribute: Name
@@ -66,7 +67,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -74,22 +75,22 @@
- result.response.metadata.kind == "network_security_rule"
- result.response.metadata.sort_order == "ASCENDING"
- result.response.metadata.sort_attribute == "Name"
- fail_msg: ' fail: unable to get all security rules sorted'
- success_msg: 'pass: getting all security rules sorted successfully '
+ fail_msg: " fail: unable to get all security rules sorted"
+ success_msg: "pass: getting all security rules sorted successfully "
###################################
-- name: delete security rule
+- name: Delete security rule
ntnx_security_rules:
state: absent
- security_rule_uuid: '{{ first_rule.response.metadata.uuid }}'
+ security_rule_uuid: "{{ first_rule.response.metadata.uuid }}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
- result.response.status == 'SUCCEEDED'
- fail_msg: ' fail: unable to delete secutiry rule '
- success_msg: 'pass: security rule deleted successfully '
+ fail_msg: " fail: unable to delete secutiry rule "
+ success_msg: "pass: security rule deleted successfully "
###################################
diff --git a/tests/integration/targets/ntnx_security_rules_info/tasks/main.yml b/tests/integration/targets/ntnx_security_rules_info/tasks/main.yml
index cc243432b..1fe4c8121 100644
--- a/tests/integration/targets/ntnx_security_rules_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_security_rules_info/tasks/main.yml
@@ -1,9 +1,10 @@
----
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "get_security_rules.yml"
+ - name: Import get_security_rules.yml
+ ansible.builtin.import_tasks: "get_security_rules.yml"
diff --git a/tests/integration/targets/ntnx_service_groups/tasks/create.yml b/tests/integration/targets/ntnx_service_groups/tasks/create.yml
index 47b8759cc..7fab700ba 100644
--- a/tests/integration/targets/ntnx_service_groups/tasks/create.yml
+++ b/tests/integration/targets/ntnx_service_groups/tasks/create.yml
@@ -1,10 +1,11 @@
---
-- debug:
+- name: Start testing ntnx_service_groups creation
+ ansible.builtin.debug:
msg: Start testing ntnx_service_groups creation
-- name: create tcp service group
+- name: Create tcp service group
ntnx_service_groups:
- name: tcp_srvive_group
+ name: tcp_service_group
desc: desc
service_details:
tcp:
@@ -15,14 +16,14 @@
register: result
ignore_errors: true
-- name: getting particular service_group using uuid
+- name: Getting particular service_group using uuid
ntnx_service_groups_info:
- service_group_uuid: '{{ result.service_group_uuid }}'
+ service_group_uuid: "{{ result.service_group_uuid }}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -38,12 +39,13 @@
fail_msg: "Fail: Unable to create tcp service group "
success_msg: "Pass: tcp service group created successfully"
-- set_fact:
+- name: Add uuid to delete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.response.uuid ] }}"
################################################################
-- name: create udp service group
+- name: Create udp service group
ntnx_service_groups:
- name: udp_srvive_group
+ name: udp_service_group
desc: desc
service_details:
udp:
@@ -54,14 +56,14 @@
register: result
ignore_errors: true
-- name: getting particular service_group using uuid
+- name: Getting particular service_group using uuid
ntnx_service_groups_info:
- service_group_uuid: '{{ result.service_group_uuid }}'
+ service_group_uuid: "{{ result.service_group_uuid }}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -77,12 +79,13 @@
fail_msg: "Fail: Unable to create udp service group "
success_msg: "Pass: udp service group created successfully"
-- set_fact:
+- name: Add uuid to delete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.response.uuid ] }}"
################################################################
-- name: create icmp with service group
+- name: Create icmp with service group
ntnx_service_groups:
- name: icmp_srvive_group
+ name: icmp_service_group
desc: desc
service_details:
icmp:
@@ -93,14 +96,14 @@
register: result
ignore_errors: true
-- name: getting particular service_group using uuid
+- name: Getting particular service_group using uuid
ntnx_service_groups_info:
- service_group_uuid: '{{ result.service_group_uuid }}'
+ service_group_uuid: "{{ result.service_group_uuid }}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -112,12 +115,13 @@
fail_msg: "Fail: Unable to create icmp service group "
success_msg: "Pass: icmp service group created successfully"
-- set_fact:
+- name: Add uuid to delete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.response.uuid ] }}"
################################################################
-- name: create service group with tcp and udp and icmp
+- name: Create service group with tcp and udp and icmp
ntnx_service_groups:
- name: app_srvive_group
+ name: app_service_group
desc: desc
service_details:
tcp:
@@ -126,18 +130,18 @@
- "10-50"
- "60-90"
- "99"
- any_icmp: True
+ any_icmp: true
register: result
ignore_errors: true
-- name: getting particular service_group using uuid
+- name: Getting particular service_group using uuid
ntnx_service_groups_info:
- service_group_uuid: '{{ result.service_group_uuid }}'
+ service_group_uuid: "{{ result.service_group_uuid }}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -156,7 +160,8 @@
fail_msg: "Fail: Unable to create tcp service group "
success_msg: "Pass: tcp service group created successfully"
-- set_fact:
+- name: Add uuid to delete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.response.uuid ] }}"
################################################################
- name: Delete all created service groups
@@ -165,10 +170,10 @@
service_group_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed is defined
- result.changed == true
@@ -176,5 +181,6 @@
fail_msg: "unable to delete all created service groups"
success_msg: "All service groups deleted successfully"
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/ntnx_service_groups/tasks/main.yml b/tests/integration/targets/ntnx_service_groups/tasks/main.yml
index c9939d444..1b120d5eb 100644
--- a/tests/integration/targets/ntnx_service_groups/tasks/main.yml
+++ b/tests/integration/targets/ntnx_service_groups/tasks/main.yml
@@ -1,10 +1,12 @@
----
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create.yml"
- - import_tasks: "update.yml"
+ - name: Import create.yml
+ ansible.builtin.import_tasks: "create.yml"
+ - name: Import update.yml
+ ansible.builtin.import_tasks: "update.yml"
diff --git a/tests/integration/targets/ntnx_service_groups/tasks/update.yml b/tests/integration/targets/ntnx_service_groups/tasks/update.yml
index 2845caa71..c485ea6bc 100644
--- a/tests/integration/targets/ntnx_service_groups/tasks/update.yml
+++ b/tests/integration/targets/ntnx_service_groups/tasks/update.yml
@@ -1,8 +1,7 @@
---
-
-- name: create tcp service group
+- name: Create tcp service group
ntnx_service_groups:
- name: tcp_srvive_group
+ name: tcp_service_group
desc: desc
service_details:
tcp:
@@ -14,8 +13,8 @@
register: service_group
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- service_group.response is defined
- service_group.failed == false
@@ -25,10 +24,11 @@
fail_msg: "Fail: Unable to create tcp service group "
success_msg: "Pass: tcp service group created successfully"
-- set_fact:
+- name: Add service_group_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ service_group.service_group_uuid ] }}"
################################################################
-- name: update tcp service group name and description and other protocols
+- name: Update tcp service group name and description and other protocols
ntnx_service_groups:
service_group_uuid: "{{service_group.service_group_uuid}}"
name: updated_name
@@ -42,14 +42,14 @@
register: result
ignore_errors: true
-- name: getting particular service_group using uuid
+- name: Getting particular service_group using uuid
ntnx_service_groups_info:
- service_group_uuid: '{{ result.service_group_uuid }}'
+ service_group_uuid: "{{ result.service_group_uuid }}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -65,7 +65,7 @@
fail_msg: "Fail: Unable to update tcp service group "
success_msg: "Pass: tcp service group update successfully"
################################################################
-- name: update tcp service group with same values
+- name: Update tcp service group with same values
ntnx_service_groups:
service_group_uuid: "{{service_group.service_group_uuid}}"
name: updated_name
@@ -79,8 +79,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -94,10 +94,10 @@
service_group_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed is defined
- result.changed == true
diff --git a/tests/integration/targets/ntnx_service_groups_info/tasks/info.yml b/tests/integration/targets/ntnx_service_groups_info/tasks/info.yml
index e621973ec..d0f2738f5 100644
--- a/tests/integration/targets/ntnx_service_groups_info/tasks/info.yml
+++ b/tests/integration/targets/ntnx_service_groups_info/tasks/info.yml
@@ -1,14 +1,15 @@
---
-- debug:
+- name: Start testing ntnx_service_groups_info
+ ansible.builtin.debug:
msg: "start ntnx_service_groups_info tests"
-- name: test getting all service groups
+- name: Test getting all service groups
ntnx_service_groups_info:
register: service_groups
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- service_groups.response is defined
- service_groups.changed == false
@@ -26,8 +27,8 @@
sort_attribute: "name"
register: result
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -37,7 +38,7 @@
fail_msg: "Unable to list all service groups using length, offset, sort order and name sort attribute"
success_msg: "service groups listed successfully using length, offset, sort order and name sort attribute"
################################################################
-- name: test getting particular service_group using filter
+- name: Test getting particular service_group using filter
ntnx_service_groups_info:
filter:
name: "{{ service_groups.response.entities[0].service_group.name }}"
@@ -45,8 +46,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -57,14 +58,14 @@
fail_msg: "Unable to get particular service_group"
success_msg: "service_group info obtained successfully"
################################################################
-- name: test getting particular service_group using uuid
+- name: Test getting particular service_group using uuid
ntnx_service_groups_info:
- service_group_uuid: '{{ result.response.entities[0].uuid }}'
+ service_group_uuid: "{{ result.response.entities[0].uuid }}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
diff --git a/tests/integration/targets/ntnx_service_groups_info/tasks/main.yml b/tests/integration/targets/ntnx_service_groups_info/tasks/main.yml
index 3364b30c6..74e773fce 100644
--- a/tests/integration/targets/ntnx_service_groups_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_service_groups_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "info.yml"
+ - name: Import info.yml
+ ansible.builtin.import_tasks: "info.yml"
diff --git a/tests/integration/targets/ntnx_static_routes/tasks/create.yml b/tests/integration/targets/ntnx_static_routes/tasks/create.yml
index a677ca55d..0a6949f52 100644
--- a/tests/integration/targets/ntnx_static_routes/tasks/create.yml
+++ b/tests/integration/targets/ntnx_static_routes/tasks/create.yml
@@ -1,4 +1,5 @@
-- debug:
+- name: Start testing static routes update tests
+ ansible.builtin.debug:
msg: Start testing static routes update tests
- name: Add default static route and external nat static route to the vpc route table
@@ -17,15 +18,16 @@
next_hop:
external_subnet_ref:
uuid: "{{ external_nat_subnet.uuid }}"
- wait: True
+ wait: true
register: result
-- set_fact:
+- name: Set destination variables
+ ansible.builtin.set_fact:
d1: "{{ result.response.status.resources.static_routes_list[0].destination }}"
d2: "{{ result.response.status.resources.static_routes_list[1].destination }}"
- name: Update static routes list Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -39,8 +41,8 @@
- result.response.status.resources.default_route["destination"] == "0.0.0.0/0"
- result.response.status.resources.default_route["nexthop"]["external_subnet_reference"]["name"] == "{{ external_nat_subnet.name }}"
- fail_msg: 'Fail: Unable to update static routes of vpc'
- success_msg: 'Succes: static routes updated successfully'
+ fail_msg: "Fail: Unable to update static routes of vpc"
+ success_msg: "Succes: static routes updated successfully"
###########################################################################################################
@@ -62,8 +64,8 @@
uuid: "{{ external_nat_subnet.uuid }}"
register: result
-- name: check idempotency status
- assert:
+- name: Check idempotency status
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == false
@@ -84,7 +86,7 @@
register: result
- name: Update static routes list Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -113,7 +115,7 @@
ignore_errors: true
- name: Update static routes list Status
- assert:
+ ansible.builtin.assert:
that:
- result.changed == false
- result.failed == true
@@ -121,14 +123,14 @@
success_msg: "Static routes update failed successfully"
###########################################################################################################
-- name: remove all routes
+- name: Remove all routes
ntnx_static_routes:
vpc_uuid: "{{ vpc.uuid }}"
remove_all_routes: true
register: result
- name: Remove all routes status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
diff --git a/tests/integration/targets/ntnx_static_routes/tasks/main.yml b/tests/integration/targets/ntnx_static_routes/tasks/main.yml
index b19cfc1ec..361bacf0a 100644
--- a/tests/integration/targets/ntnx_static_routes/tasks/main.yml
+++ b/tests/integration/targets/ntnx_static_routes/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create.yml"
+ - name: Import create.yml
+ ansible.builtin.import_tasks: "create.yml"
diff --git a/tests/integration/targets/ntnx_static_routes_info/tasks/info.yml b/tests/integration/targets/ntnx_static_routes_info/tasks/info.yml
index 4b79f1a08..87ddda1e9 100644
--- a/tests/integration/targets/ntnx_static_routes_info/tasks/info.yml
+++ b/tests/integration/targets/ntnx_static_routes_info/tasks/info.yml
@@ -1,7 +1,8 @@
-- debug:
+- name: Start testing ntnx_static_routes_info
+ ansible.builtin.debug:
msg: Start testing static routes info tests
-- name: create new static routes
+- name: Create new static routes
ntnx_static_routes:
vpc_uuid: "{{ vpc.uuid }}"
static_routes:
@@ -20,28 +21,28 @@
register: result
- name: Update static routes list Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- result.changed == true
- fail_msg: 'Fail: Unable to update static routes of vpc'
- success_msg: 'Succes: static routes updated successfully'
+ fail_msg: "Fail: Unable to update static routes of vpc"
+ success_msg: "Succes: static routes updated successfully"
###########################################################################################################
-- name: get all static routes
+- name: Get all static routes
ntnx_static_routes_info:
vpc_uuid: "{{ vpc.uuid }}"
register: result
-
-- set_fact:
+- name: Set variables
+ ansible.builtin.set_fact:
d1: "{{ result.response.status.resources.static_routes_list[0].destination }}"
d2: "{{ result.response.status.resources.static_routes_list[1].destination }}"
-- name: check info module response
- assert:
+- name: Check info module response
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -54,12 +55,12 @@
- result.response.status.resources.default_route["destination"] == "0.0.0.0/0"
- result.response.status.resources.default_route["nexthop"]["external_subnet_reference"]["name"] == "{{ external_nat_subnet.name }}"
- fail_msg: 'Fail: Unable to get static routes for vpc'
- success_msg: 'Succes'
+ fail_msg: "Fail: Unable to get static routes for vpc"
+ success_msg: "Succes"
###########################################################################################################
-- name: remove all routes for cleanup
+- name: Remove all routes for cleanup
ntnx_static_routes:
vpc_uuid: "{{ vpc.uuid }}"
remove_all_routes: true
@@ -67,7 +68,7 @@
ignore_errors: true
- name: Remove all routes status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
diff --git a/tests/integration/targets/ntnx_static_routes_info/tasks/main.yml b/tests/integration/targets/ntnx_static_routes_info/tasks/main.yml
index 3364b30c6..74e773fce 100644
--- a/tests/integration/targets/ntnx_static_routes_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_static_routes_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "info.yml"
+ - name: Import info.yml
+ ansible.builtin.import_tasks: "info.yml"
diff --git a/tests/integration/targets/ntnx_user_groups/tasks/create.yml b/tests/integration/targets/ntnx_user_groups/tasks/create.yml
index 7a11b4a28..ba64b1194 100644
--- a/tests/integration/targets/ntnx_user_groups/tasks/create.yml
+++ b/tests/integration/targets/ntnx_user_groups/tasks/create.yml
@@ -1,8 +1,9 @@
---
-- debug:
+- name: Start testing ntnx_user_groups and info
+ ansible.builtin.debug:
msg: start ntnx_user_groups and info tests
-- name: create user group
+- name: Create user group
ntnx_user_groups:
distinguished_name: "{{distinguished_name}}"
project:
@@ -13,8 +14,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -26,27 +27,30 @@
fail_msg: "Unable to create user group "
success_msg: "user group created successfully"
-- set_fact:
+- name: Set user group uuid to delete
+ ansible.builtin.set_fact:
user_group_to_delete: "{{result.user_group_uuid}}"
-#############################INFO Tests#####################
+############################# INFO Tests #####################
- name: List all user groups
ntnx_user_groups_info:
register: user_groups
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- user_groups.response is defined
- user_groups.response.metadata.total_matches > 0
fail_msg: "Unable to list all user groups"
success_msg: "User groups info obtained successfully"
-- set_fact:
+- name: Set user group name
+ ansible.builtin.set_fact:
test_user_group_name: "{{user_groups.response.entities.0.status.resources.display_name}}"
-- set_fact:
+- name: Set user group uuid
+ ansible.builtin.set_fact:
test_user_group_uuid: "{{user_groups.response.entities.0.metadata.uuid}}"
##################################################
@@ -55,10 +59,10 @@
ntnx_user_groups_info:
usergroup_uuid: "{{ test_user_group_uuid }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -75,10 +79,10 @@
filter:
name: "{{ test_user_group_name }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -96,10 +100,10 @@
length: 2
offset: 1
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -107,7 +111,6 @@
- result.response.metadata.total_matches > 0
- result.response.metadata.length == 2
-
fail_msg: "Unable to list user groups using length and offset"
success_msg: "user groups listed successfully using length and offset"
##################################################
@@ -117,10 +120,10 @@
# sort_attribute: "group_name"
# kind: user_group
# register: result
-# ignore_errors: True
+# ignore_errors: true
# - name: Listing Status
-# assert:
+# ansible.builtin.assert:
# that:
# - result.response is defined
# - result.changed == false
@@ -128,15 +131,15 @@
# fail_msg: "Unable to list user groups using ascending name sorting"
# success_msg: "user groups listed successfully using ascending name sorting"
-- name: delete user group
+- name: Delete user group
ntnx_user_groups:
state: absent
user_group_uuid: "{{user_group_to_delete}}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == false
@@ -145,17 +148,16 @@
fail_msg: "Unable to delete user group "
success_msg: "user group deleted successfully"
-
# - name: create user group with idp
# ntnx_user_groups:
# idp:
# idp_uuid: "{{identity_provider_uuid}}"
-# group_name: test_group_987
+# group_name: Test_group_987
# register: result
# ignore_errors: true
-# - name: check listing status
-# assert:
+# - name: Check listing status
+# ansible.builtin.assert:
# that:
# - result.response is defined
# - result.failed == false
@@ -166,15 +168,15 @@
# fail_msg: "Unable to create user group with idp "
# success_msg: "user group with idp created successfully"
-# - name: delete user group
+# - name: Delete user group
# ntnx_user_groups:
# state: absent
# user_group_uuid: "{{result.user_group_uuid}}"
# register: result
# ignore_errors: true
-# - name: check listing status
-# assert:
+# - name: Check listing status
+# ansible.builtin.assert:
# that:
# - result.response is defined
# - result.failed == false
diff --git a/tests/integration/targets/ntnx_user_groups/tasks/main.yml b/tests/integration/targets/ntnx_user_groups/tasks/main.yml
index b19cfc1ec..361bacf0a 100644
--- a/tests/integration/targets/ntnx_user_groups/tasks/main.yml
+++ b/tests/integration/targets/ntnx_user_groups/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create.yml"
+ - name: Import create.yml
+ ansible.builtin.import_tasks: "create.yml"
diff --git a/tests/integration/targets/ntnx_users/tasks/create.yml b/tests/integration/targets/ntnx_users/tasks/create.yml
index b6bdf0c4b..4c7207c7f 100644
--- a/tests/integration/targets/ntnx_users/tasks/create.yml
+++ b/tests/integration/targets/ntnx_users/tasks/create.yml
@@ -1,19 +1,20 @@
---
-- debug:
+- name: Start testing ntnx_users
+ ansible.builtin.debug:
msg: "start ntnx_users tests"
##################################################
-- name: create local user with check mode
+- name: Create local user with check mode
ntnx_users:
principal_name: "{{principal_name}}"
- directory_service_uuid: "{{directory_service_uuid}}"
+ directory_service_uuid: "{{directory_service_uuid}}"
project:
uuid: "{{project.uuid}}"
register: result
ignore_errors: true
check_mode: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -23,17 +24,16 @@
fail_msg: "fail: user created whil check mode on"
success_msg: "pass: returned as expected"
-
#################################################
-- name: create local user
+- name: Create local user
ntnx_users:
principal_name: "{{principal_name}}"
- directory_service_uuid: "{{directory_service_uuid}}"
+ directory_service_uuid: "{{directory_service_uuid}}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -45,8 +45,9 @@
fail_msg: "fail"
success_msg: "pass"
-- set_fact:
- todelete: "{{ todelete + [ result.user_uuid ] }}"
+- name: Add user uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: "{{ todelete + [ result.user_uuid ] }}"
#################################################
- name: Delete created users
ntnx_users:
@@ -55,20 +56,21 @@
loop: "{{ todelete }}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed == true
- result.msg == "All items completed"
fail_msg: "Fail: unable to delete all users"
success_msg: "Pass: all users deleted successfully"
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
#################################################
-- name: create local user with project and categories
+- name: Create local user with project and categories
ntnx_users:
principal_name: "{{principal_name}}"
- directory_service_uuid: "{{directory_service_uuid}}"
+ directory_service_uuid: "{{directory_service_uuid}}"
project:
uuid: "{{project.uuid}}"
categories:
@@ -79,8 +81,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == true
@@ -92,13 +94,14 @@
fail_msg: "fail"
success_msg: "pass"
-- set_fact:
- todelete: "{{ todelete + [ result.user_uuid ] }}"
+- name: Add user uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: "{{ todelete + [ result.user_uuid ] }}"
#################################################
-- name: create local user not in the directory_service
+- name: Create local user not in the directory_service
ntnx_users:
- principal_name: wrong_name
- directory_service_uuid: "{{directory_service_uuid}}"
+ principal_name: Wrong_name
+ directory_service_uuid: "{{directory_service_uuid}}"
project:
uuid: "{{project.uuid}}"
categories:
@@ -109,8 +112,8 @@
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.failed == true
@@ -118,15 +121,15 @@
fail_msg: "Fail: create wrong user"
success_msg: "Pass: Returned as expected"
#################################################
-# - name: create idp user
+# - name: Create idp user
# ntnx_users:
# identity_provider_uuid: "{{identity_provider_uuid}}"
# username: testing_user
# register: result
# ignore_errors: true
-# - name: check listing status
-# assert:
+# - name: Check listing status
+# ansible.builtin.assert:
# that:
# - result.response is defined
# - result.changed == true
@@ -137,7 +140,7 @@
# fail_msg: "Fail: unable to create idp user"
# success_msg: "Pass: idp user created successfully"
-# - set_fact:
+# - ansible.builtin.set_fact:
# todelete: "{{ todelete + [ result.user_uuid ] }}"
#################################################
- name: Delete created users
@@ -147,22 +150,23 @@
loop: "{{ todelete }}"
register: result
ignore_errors: true
-- name: check listing status
- assert:
+- name: Check listing status
+ ansible.builtin.assert:
that:
- result.changed == true
- result.msg == "All items completed"
fail_msg: "Fail: unable to delete all users"
success_msg: "Pass: all users deleted successfully"
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
############# DELETE TEST ##############################
-- name: create local user
+- name: Create local user
ntnx_users:
principal_name: "{{principal_name}}"
- directory_service_uuid: "{{directory_service_uuid}}"
+ directory_service_uuid: "{{directory_service_uuid}}"
project:
uuid: "{{project.uuid}}"
register: result
@@ -175,8 +179,8 @@
register: result
ignore_errors: true
-- name: check delete status
- assert:
+- name: Check delete status
+ ansible.builtin.assert:
that:
- result.changed == true
- result.response is defined
diff --git a/tests/integration/targets/ntnx_users/tasks/main.yml b/tests/integration/targets/ntnx_users/tasks/main.yml
index b19cfc1ec..361bacf0a 100644
--- a/tests/integration/targets/ntnx_users/tasks/main.yml
+++ b/tests/integration/targets/ntnx_users/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create.yml"
+ - name: Import create.yml
+ ansible.builtin.import_tasks: "create.yml"
diff --git a/tests/integration/targets/ntnx_users_info/tasks/main.yml b/tests/integration/targets/ntnx_users_info/tasks/main.yml
index 0773f67ed..7495f59c3 100644
--- a/tests/integration/targets/ntnx_users_info/tasks/main.yml
+++ b/tests/integration/targets/ntnx_users_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "users_info.yml"
+ - name: Import users_info.yml
+ ansible.builtin.import_tasks: "users_info.yml"
diff --git a/tests/integration/targets/ntnx_users_info/tasks/users_info.yml b/tests/integration/targets/ntnx_users_info/tasks/users_info.yml
index 88425c12a..8ededd11f 100644
--- a/tests/integration/targets/ntnx_users_info/tasks/users_info.yml
+++ b/tests/integration/targets/ntnx_users_info/tasks/users_info.yml
@@ -1,23 +1,26 @@
-- debug:
+- name: Start testing ntnx_users_info
+ ansible.builtin.debug:
msg: start testing ntnx_users_info
##################################################
- name: List all users
ntnx_users_info:
register: users
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- users.response is defined
- users.response.metadata.total_matches > 0
fail_msg: "Unable to list all users"
success_msg: "User info obtained successfully"
-- set_fact:
+- name: Set user name
+ ansible.builtin.set_fact:
test_user_name: "{{users.response.entities.2.status.name}}"
-- set_fact:
+- name: Set user uuid
+ ansible.builtin.set_fact:
test_user_uuid: "{{users.response.entities.2.metadata.uuid}}"
##################################################
@@ -26,10 +29,10 @@
ntnx_users_info:
user_uuid: "{{ test_user_uuid }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -46,10 +49,10 @@
filter:
username: "{{ test_user_name }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -67,10 +70,10 @@
length: 2
offset: 1
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
@@ -88,10 +91,10 @@
# sort_attribute: "name"
# kind: user
# register: result
-# ignore_errors: True
+# ignore_errors: true
# - name: Listing Status
-# assert:
+# ansible.builtin.assert:
# that:
# - result.response is defined
# - result.changed == false
diff --git a/tests/integration/targets/ntnx_vms_clone/tasks/create.yml b/tests/integration/targets/ntnx_vms_clone/tasks/create.yml
index 9d08f1480..9e81e6f97 100644
--- a/tests/integration/targets/ntnx_vms_clone/tasks/create.yml
+++ b/tests/integration/targets/ntnx_vms_clone/tasks/create.yml
@@ -1,34 +1,36 @@
-- debug:
+- name: Start testing ntnx_vms_clone
+ ansible.builtin.debug:
msg: Start testing VM clone
- name: Create Cloud-init Script file
- copy:
+ ansible.builtin.copy:
dest: "init_cloud.yml"
+ mode: "0644"
content: |
- #cloud-config
- chpasswd:
- list: |
- root: "{{ password }}"
- expire: False
- fqdn: myNutanixVM
+ #cloud-config
+ chpasswd:
+ list: |
+ root: "{{ password }}"
+ expire: false
+ fqdn: myNutanixVM
- name: VM with minimum requirements to clone
ntnx_vms:
- state: present
- name: integration_test_clone_vm
- cluster:
- name: "{{ cluster.name }}"
- disks:
- - type: "DISK"
- clone_image:
- name: "{{ ubuntu }}"
- bus: "SCSI"
- size_gb: 20
+ state: present
+ name: integration_test_clone_vm
+ cluster:
+ name: "{{ cluster.name }}"
+ disks:
+ - type: "DISK"
+ clone_image:
+ name: "{{ ubuntu }}"
+ bus: "SCSI"
+ size_gb: 20
register: vm
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- vm.response is defined
- vm.response.status.state == 'COMPLETE'
@@ -36,99 +38,102 @@
success_msg: 'Succes: VM with minimum requirements created successfully '
##############################
-- name: clone vm and change vcpus,memory_gb,cores_per_vcpu,timezone,desc,name with force_power_off
+- 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
- timezone: GMT
- force_power_off: true
+ src_vm_uuid: "{{ vm.vm_uuid }}"
+ vcpus: 2
+ cores_per_vcpu: 2
+ memory_gb: 2
+ name: cloned vm
+ timezone: GMT
+ force_power_off: true
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- fail_msg: 'Fail: Unable to clone vm and change vcpus,memory_gb,cores_per_vcpu,timezone,desc,name with force_power_off'
- success_msg: 'Succes: VM cloned successfully and change vcpus,memory_gb,cores_per_vcpu,timezone,desc,name with force_power_off '
+ fail_msg: "Fail: Unable to clone vm and change vcpus,memory_gb,cores_per_vcpu,timezone,desc,name with force_power_off"
+ success_msg: "Succes: VM cloned successfully and change vcpus,memory_gb,cores_per_vcpu,timezone,desc,name with force_power_off "
-- set_fact:
- todelete: '{{ todelete + [ result.vm_uuid ] }}'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: "{{ todelete + [ result.vm_uuid ] }}"
##############################
-- name: clone vm and add network
+- name: Clone vm and add network
ntnx_vms_clone:
- src_vm_uuid: "{{ vm.vm_uuid }}"
- networks:
- - is_connected: true
- subnet:
- uuid: "{{ static.uuid }}"
+ src_vm_uuid: "{{ vm.vm_uuid }}"
+ networks:
+ - is_connected: true
+ subnet:
+ uuid: "{{ static.uuid }}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- fail_msg: 'Fail: Unable to clone vm while it is off '
- success_msg: 'Succes: VM cloned successfully '
+ fail_msg: "Fail: Unable to clone vm while it is off "
+ success_msg: "Succes: VM cloned successfully "
-- set_fact:
- todelete: '{{ todelete + [ result.vm_uuid ] }}'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: "{{ todelete + [ result.vm_uuid ] }}"
###########################################
-- name: clone vm with check mode
+- name: Clone vm with check mode
ntnx_vms_clone:
- src_vm_uuid: "{{ vm.vm_uuid }}"
- networks:
- - is_connected: false
- subnet:
- name: "{{ network.dhcp.name }}"
+ src_vm_uuid: "{{ vm.vm_uuid }}"
+ networks:
+ - is_connected: false
+ subnet:
+ name: "{{ network.dhcp.name }}"
register: result
ignore_errors: true
- check_mode: yes
+ check_mode: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
- result.failed == false
- result.task_uuid != ""
- success_msg: ' Success: returned response as expected '
- fail_msg: ' Fail: clone vm with check_mode '
+ success_msg: " Success: returned response as expected "
+ fail_msg: " Fail: clone vm with check_mode "
###########################################
-- name: clone vm with script
+- name: Clone vm with script
ntnx_vms_clone:
- src_vm_uuid: "{{ vm.vm_uuid }}"
- guest_customization:
- type: "cloud_init"
- script_path: "./init_cloud.yml"
- is_overridable: True
+ src_vm_uuid: "{{ vm.vm_uuid }}"
+ guest_customization:
+ type: "cloud_init"
+ script_path: "./init_cloud.yml"
+ is_overridable: true
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- fail_msg: 'Fail: Unable to clone vm vm with script'
- success_msg: 'Succes: VM cloned with script successfully '
+ fail_msg: "Fail: Unable to clone vm vm with script"
+ success_msg: "Succes: VM cloned with script successfully "
-- set_fact:
- todelete: '{{ todelete + [ result.vm_uuid ] }}'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: "{{ todelete + [ result.vm_uuid ] }}"
###########################################
- name: Delete all Created VMs
ntnx_vms:
- state: absent
- vm_uuid: '{{ item }}'
- loop: '{{ todelete }}'
+ state: absent
+ vm_uuid: "{{ item }}"
+ loop: "{{ todelete }}"
- name: Delete all Created VMs
ntnx_vms:
- state: absent
- vm_uuid: '{{ vm.vm_uuid }}'
+ state: absent
+ vm_uuid: "{{ vm.vm_uuid }}"
diff --git a/tests/integration/targets/ntnx_vms_clone/tasks/main.yml b/tests/integration/targets/ntnx_vms_clone/tasks/main.yml
index b19cfc1ec..361bacf0a 100644
--- a/tests/integration/targets/ntnx_vms_clone/tasks/main.yml
+++ b/tests/integration/targets/ntnx_vms_clone/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create.yml"
+ - name: Import create.yml
+ ansible.builtin.import_tasks: "create.yml"
diff --git a/tests/integration/targets/nutanix_floating_ips/tasks/create_floating_ips.yml b/tests/integration/targets/nutanix_floating_ips/tasks/create_floating_ips.yml
index 96ce8c30c..b60b6de4e 100644
--- a/tests/integration/targets/nutanix_floating_ips/tasks/create_floating_ips.yml
+++ b/tests/integration/targets/nutanix_floating_ips/tasks/create_floating_ips.yml
@@ -2,20 +2,21 @@
- name: Create floating ip with external subnet uuid
ntnx_floating_ips:
state: present
- wait: True
+ wait: true
external_subnet:
uuid: "{{ external_nat_subnet.uuid }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create floating ip with external subnet uuid "
success_msg: " Floating ip with external subnet uuid created successfully "
-- set_fact:
+- name: Add fip_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.fip_uuid ] }}"
##############################################################
- name: Create floating ip with vpc name and external subnet uuid
@@ -24,20 +25,21 @@
external_subnet:
uuid: "{{external_nat_subnet.uuid}}"
vpc:
- name: "{{ vpc.name }}"
+ name: "{{ vpc.name }}"
private_ip: "{{ private_ip }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create floating ip with vpc "
success_msg: " Floating ip with vpc name and external subnet uuid created successfully "
-- set_fact:
+- name: Add fip_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.fip_uuid ] }}"
##########################################################
- name: Delete all created floating ips
@@ -47,7 +49,8 @@
register: result
loop: "{{ todelete }}"
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
###########################################################
- name: Create floating ip with external subnet name
@@ -57,17 +60,18 @@
external_subnet:
name: "{{ external_nat_subnet.name }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create floating ip with external subnet name "
success_msg: " Floating ip with external subnet name created successfully "
-- set_fact:
+- name: Add fip_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.fip_uuid ] }}"
############################################################
- name: Create floating ip with vpc uuid and external subnet name
@@ -76,20 +80,21 @@
external_subnet:
name: "{{ external_nat_subnet.name }}"
vpc:
- uuid: "{{ vpc.uuid }}"
+ uuid: "{{ vpc.uuid }}"
private_ip: "{{ private_ip }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create floating ip with vpc uuid and external subnet name "
success_msg: " Floating ip with vpc uuid and external subnet name created successfully "
-- set_fact:
+- name: Add fip_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.fip_uuid ] }}"
############################################################
- name: Delete all created floating ips
@@ -98,9 +103,10 @@
fip_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
#########################################################
- name: Create floating ip with external subnet and vm name
@@ -110,18 +116,19 @@
name: "{{ external_nat_subnet.name }}"
vm:
name: "{{ vm.name }}"
- ignore_errors: True
+ ignore_errors: true
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create floating ip with vm"
success_msg: " Floating ip with external subnet and vm created successfully "
-- set_fact:
+- name: Add fip_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.fip_uuid ] }}"
#########################################################
- name: Delete all created floating ips
@@ -130,9 +137,10 @@
fip_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
#########################################################
- name: Create floating ip with external subnet and vm uuid
@@ -142,18 +150,19 @@
name: "{{ external_nat_subnet.name }}"
vm:
uuid: "{{ vm.uuid }}"
- ignore_errors: True
+ ignore_errors: true
register: result
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create floating ip with vm"
success_msg: " Floating ip with external subnet and vm created successfully "
-- set_fact:
+- name: Add fip_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.fip_uuid ] }}"
##########################################################
- name: Delete all created floating ips
@@ -162,4 +171,4 @@
fip_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
diff --git a/tests/integration/targets/nutanix_floating_ips/tasks/main.yml b/tests/integration/targets/nutanix_floating_ips/tasks/main.yml
index f98895ee0..af256f772 100644
--- a/tests/integration/targets/nutanix_floating_ips/tasks/main.yml
+++ b/tests/integration/targets/nutanix_floating_ips/tasks/main.yml
@@ -1,10 +1,13 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create_floating_ips.yml"
- - import_tasks: "negative_scenarios.yml"
+ - name: Import create_floating_ips.yml
+ ansible.builtin.import_tasks: "create_floating_ips.yml"
+ - name: Import negative_scenarios.yml
+ ansible.builtin.import_tasks: "negative_scenarios.yml"
diff --git a/tests/integration/targets/nutanix_floating_ips/tasks/negative_scenarios.yml b/tests/integration/targets/nutanix_floating_ips/tasks/negative_scenarios.yml
index b9cdbd377..de88db6a3 100644
--- a/tests/integration/targets/nutanix_floating_ips/tasks/negative_scenarios.yml
+++ b/tests/integration/targets/nutanix_floating_ips/tasks/negative_scenarios.yml
@@ -1,19 +1,20 @@
-- debug:
- msg: "Started Negative Creation Cases"
+- name: Start testing ntnx_floating_ips
+ ansible.builtin.debug:
+ msg: "Started Negative Creation Cases"
- name: Create floating ip with unknown external subnet name
ntnx_floating_ips:
state: present
external_subnet:
name: "external_subnet"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.failed==True
- result.msg=="Failed generating floating_ip spec"
- success_msg: ' Success: returned error as expected '
+ success_msg: " Success: returned error as expected "
#################################################################
- name: Create floating ip with unknown external subnet uuid
ntnx_floating_ips:
@@ -22,13 +23,13 @@
external_subnet:
uuid: 54e295c3-16d3-49de-96ba-b921948b3a
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.status_code==422
- success_msg: ' Success: returned error as expected '
+ success_msg: " Success: returned error as expected "
###############################################################
- name: Create floating ip with unknown vpc
ntnx_floating_ips:
@@ -36,17 +37,17 @@
external_subnet:
name: "{{ external_nat_subnet.name}}"
vpc:
- name: vpc
+ name: vpc
private_ip: "{{ private_ip }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.failed==True
- result.msg=="Failed generating floating_ip spec"
- success_msg: ' Success: returned error as expected '
+ success_msg: " Success: returned error as expected "
###############################################################
- name: Create floating ip with unknown vpc uuid
ntnx_floating_ips:
@@ -54,26 +55,26 @@
external_subnet:
name: "{{ external_nat_subnet.name }}"
vpc:
- uuid: 471181f8-eb2d-4303-9a61-6b25a1b3
+ uuid: 471181f8-eb2d-4303-9a61-6b25a1b3
private_ip: "{{ private_ip }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.status_code==422
- success_msg: ' Success: returned error as expected '
+ success_msg: " Success: returned error as expected "
##############################################################
- name: Delete floating ip with unknown uuid
ntnx_floating_ips:
state: absent
fip_uuid: 5
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.status_code==400
- success_msg: ' Success: returned error as expected '
+ success_msg: " Success: returned error as expected "
diff --git a/tests/integration/targets/nutanix_floating_ips_info/tasks/list_floating_ips.yml b/tests/integration/targets/nutanix_floating_ips_info/tasks/list_floating_ips.yml
index 43570995d..28c4e9383 100644
--- a/tests/integration/targets/nutanix_floating_ips_info/tasks/list_floating_ips.yml
+++ b/tests/integration/targets/nutanix_floating_ips_info/tasks/list_floating_ips.yml
@@ -4,10 +4,10 @@
floating_ip: "10.0.1.2"
kind: floating_ip
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list floating_ips "
@@ -19,10 +19,10 @@
offset: 0
check_mode: true
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list floating_ips "
@@ -33,10 +33,10 @@
sort_order: "ASCENDING"
sort_attribute: "floating_ip"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list floating_ips "
diff --git a/tests/integration/targets/nutanix_floating_ips_info/tasks/main.yml b/tests/integration/targets/nutanix_floating_ips_info/tasks/main.yml
index 0c600deed..15336d696 100644
--- a/tests/integration/targets/nutanix_floating_ips_info/tasks/main.yml
+++ b/tests/integration/targets/nutanix_floating_ips_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "list_floating_ips.yml"
+ - name: Import "list_floating_ips.yml"
+ ansible.builtin.import_tasks: "list_floating_ips.yml"
diff --git a/tests/integration/targets/nutanix_pbrs/tasks/create_pbrs.yml b/tests/integration/targets/nutanix_pbrs/tasks/create_pbrs.yml
index 0a2f19293..a85082ffe 100644
--- a/tests/integration/targets/nutanix_pbrs/tasks/create_pbrs.yml
+++ b/tests/integration/targets/nutanix_pbrs/tasks/create_pbrs.yml
@@ -1,6 +1,6 @@
- name: Create PBR with vpc name, source network, external destination, with reroute action and any type and code icmp
ntnx_pbrs:
- validate_certs: False
+ validate_certs: false
state: present
nutanix_host: "{{ ip }}"
nutanix_username: "{{ username }}"
@@ -13,24 +13,25 @@
ip: "{{ network.ip }}"
prefix: "{{ network.prefix }}"
destination:
- external: True
+ external: true
action:
- allow: True
+ allow: true
protocol:
icmp:
type: 25
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create PBR with vpc name with source network and destination external with reroute action and udp port rangelist"
success_msg: " PBR with vpc name with source network and destination external with reroute action and udp port rangelist created successfully "
-- set_fact:
+- name: Adding PBR to delete list
+ ansible.builtin.ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.pbr_uuid ] }}"
################################################################################################################################
- name: Create PBR with vpc name, any source, any destination, any protocol and deny action
@@ -40,25 +41,26 @@
vpc:
name: "{{ vpc.name }}"
source:
- any: True
+ any: true
destination:
- any: True
+ any: true
action:
- deny: True
+ deny: true
protocol:
- any: True
+ any: true
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create PBR with vpc name, any source, any destination, any protocol and deny action "
success_msg: " PBR with vpc name, any source, any destination, any protocol and deny action created successfully "
-- set_fact:
+- name: Adding PBR to delete list
+ ansible.builtin.ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.pbr_uuid ] }}"
###############################################################################################
- name: Create PBR with vpc uuid, any source, external destination and allow action with protocol number
@@ -68,35 +70,36 @@
vpc:
uuid: "{{ vpc.uuid }}"
source:
- any: True
+ any: true
destination:
- external: True
+ external: true
action:
- allow: True
+ allow: true
protocol:
number: "{{ protocol.number }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create PBR with vpc uuid, any source, external destination and allow action with protocol number"
success_msg: " Create PBR with vpc uuid, any source, external destination and allow action with protocol number created successfully "
-- set_fact:
+- name: Adding PBR to delete list
+ ansible.builtin.ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.pbr_uuid ] }}"
#######################################################################################################
-- name: create PBR with vpc name with source external and destination network with reroute action and tcp port rangelist
+- name: Create PBR with vpc name with source external and destination network with reroute action and tcp port rangelist
ntnx_pbrs:
state: present
priority: "{{ priority.2 }}"
vpc:
name: "{{ vpc.name }}"
source:
- external: True
+ external: true
destination:
network:
ip: "{{ network.ip }}"
@@ -108,49 +111,51 @@
src: "{{ tcp.port }}"
dst: "{{ tcp.port_rangelist }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create PBR with vpc name with source external and destination network with reroute action and tcp port rangelist "
success_msg: " PBR with vpc name with source external and destination network with reroute action and tcp port rangelist created successfully "
-- set_fact:
+- name: Adding PBR to delete list
+ ansible.builtin.ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.pbr_uuid ] }}"
##########################################################################################################
-- name: create PBR with vpc name with source external and destination network with reroute action and any tcp port rangelist
+- name: Create PBR with vpc name with source external and destination network with reroute action and any tcp port rangelist
ntnx_pbrs:
state: present
priority: "{{ priority.3 }}"
vpc:
name: "{{ vpc.name }}"
source:
- external: True
+ external: true
destination:
network:
ip: "{{ network.ip }}"
prefix: "{{ network.prefix }}"
action:
- allow: True
+ allow: true
protocol:
tcp:
src: "*"
dst: "*"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create PBR with vpc name with source external and destination network with reroute action and any tcp ports rangelist "
success_msg: " PBR with vpc name with source external and destination network with reroute action and any tcp ports rangelist created successfully "
-- set_fact:
+- name: Adding PBR to delete list
+ ansible.builtin.ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.pbr_uuid ] }}"
###########################################################################################################
- name: Create PBR with vpc name, custom source network, external destination, reroute action and udp port rangelist
@@ -164,7 +169,7 @@
ip: "{{ network.ip }}"
prefix: "{{ network.prefix }}"
destination:
- any: True
+ any: true
action:
reroute: "{{ reroute_ip }}"
protocol:
@@ -172,17 +177,18 @@
src: "{{ udp.port_rangelist }}"
dst: "{{ udp.port }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create PBR with vpc name with source network and destination external with reroute action and udp port rangelist"
success_msg: " PBR with vpc name with source network and destination external with reroute action and udp port rangelist created successfully "
-- set_fact:
+- name: Adding PBR to delete list
+ ansible.builtin.ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.pbr_uuid ] }}"
##############################################################################################################
- name: Create PBR with vpc name, custom source network, external destination, reroute action and any udp ports
@@ -197,7 +203,7 @@
ip: "{{ network.ip }}"
prefix: "{{ network.prefix }}"
destination:
- any: True
+ any: true
action:
reroute: "{{ reroute_ip }}"
protocol:
@@ -205,17 +211,18 @@
src: "*"
dst: "*"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create PBR with vpc name with source network and destination external with reroute action and and udp port "
success_msg: " PBR with vpc name with source network and destination external with reroute action and any udp ports created successfully "
-- set_fact:
+- name: Adding PBR to delete list
+ ansible.builtin.ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.pbr_uuid ] }}"
##################################################################################################################
- name: Create PBR with vpc name, source network, external destination, with reroute action and icmp
@@ -230,7 +237,7 @@
ip: "{{ network.ip }}"
prefix: "{{ network.prefix }}"
destination:
- external: True
+ external: true
action:
reroute: "{{reroute_ip}}"
protocol:
@@ -238,9 +245,10 @@
code: "{{ icmp.code }}"
type: "{{ icmp.type }}"
register: result
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Adding PBR to delete list
+ ansible.builtin.ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.pbr_uuid ] }}"
##################################################################################################################
- name: Delete all created pbrs
@@ -249,4 +257,4 @@
pbr_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
diff --git a/tests/integration/targets/nutanix_pbrs/tasks/main.yml b/tests/integration/targets/nutanix_pbrs/tasks/main.yml
index a7c9b0026..bc6056ae9 100644
--- a/tests/integration/targets/nutanix_pbrs/tasks/main.yml
+++ b/tests/integration/targets/nutanix_pbrs/tasks/main.yml
@@ -1,10 +1,13 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create_pbrs.yml"
- - import_tasks: "negative_scenarios.yml"
+ - name: Import create_pbrs.yml
+ ansible.builtin.import_tasks: "create_pbrs.yml"
+ - name: Import negative_scenarios.yml
+ ansible.builtin.import_tasks: "negative_scenarios.yml"
diff --git a/tests/integration/targets/nutanix_pbrs/tasks/negative_scenarios.yml b/tests/integration/targets/nutanix_pbrs/tasks/negative_scenarios.yml
index 67c4312c3..6e787a79c 100644
--- a/tests/integration/targets/nutanix_pbrs/tasks/negative_scenarios.yml
+++ b/tests/integration/targets/nutanix_pbrs/tasks/negative_scenarios.yml
@@ -1,5 +1,6 @@
-- debug:
- msg: "Started Negative Creation Cases"
+- name: Start Negative Testing
+ ansible.builtin.debug:
+ msg: "Started Negative Creation Cases"
- name: Create PBR with unknown vpc name
ntnx_pbrs:
@@ -12,7 +13,7 @@
ip: "{{ network.ip }}"
prefix: "{{ network.prefix }}"
destination:
- external: True
+ external: true
action:
reroute: "{{reroute_ip}}"
protocol:
@@ -20,13 +21,13 @@
code: "{{ icmp.code }}"
type: "{{ icmp.type }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.failed is defined
- success_msg: ' Success: returned error as expected '
+ success_msg: " Success: returned error as expected "
##################################################################
- name: Create PBR with priority less than 10
ntnx_pbrs:
@@ -39,7 +40,7 @@
ip: "{{ network.ip }}"
prefix: "{{ network.prefix }}"
destination:
- external: True
+ external: true
action:
reroute: "{{reroute_ip}}"
protocol:
@@ -47,13 +48,13 @@
code: "{{ icmp.code }}"
type: "{{ icmp.type }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.failed is defined
- success_msg: ' Success: returned error as expected '
+ success_msg: " Success: returned error as expected "
###################################################################
- name: Create PBR with invalid network ip
ntnx_pbrs:
@@ -66,7 +67,7 @@
ip: 192.168.0.5
prefix: 24
destination:
- external: True
+ external: true
action:
reroute: "{{reroute_ip}}"
protocol:
@@ -74,13 +75,13 @@
code: "{{ icmp.code }}"
type: "{{ icmp.type }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Check failure status
- assert:
+ ansible.builtin.assert:
that:
- result.failed == true
- success_msg: ' Success: returned error as expected '
+ success_msg: " Success: returned error as expected "
#################################################################
- name: Create PBR with unknown vpc uuid
@@ -94,7 +95,7 @@
ip: "{{ network.ip }}"
prefix: "{{ network.prefix }}"
destination:
- external: True
+ external: true
action:
reroute: "{{reroute_ip}}"
protocol:
@@ -102,13 +103,13 @@
code: "{{ icmp.code }}"
type: "{{ icmp.type }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.failed is defined
- success_msg: ' Success: returned error as expected '
+ success_msg: " Success: returned error as expected "
#################################################################
- name: Create PBR with invalid type and code values for icmp
ntnx_pbrs:
@@ -121,7 +122,7 @@
ip: "{{ network.ip }}"
prefix: "{{ network.prefix }}"
destination:
- external: True
+ external: true
action:
reroute: "{{reroute_ip}}"
protocol:
@@ -129,22 +130,22 @@
type: 10
code: 10
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.failed is defined
- success_msg: ' Success: returned error as expected '
+ success_msg: " Success: returned error as expected "
#####################################################################
- name: Delete pbrs with unknown uuid
ntnx_pbrs:
state: absent
pbr_uuid: 5
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.failed is defined
- success_msg: ' Success: returned error as expected '
+ success_msg: " Success: returned error as expected "
diff --git a/tests/integration/targets/nutanix_pbrs_info/tasks/list_pbrs.yml b/tests/integration/targets/nutanix_pbrs_info/tasks/list_pbrs.yml
index e3948dc4c..1b96d3b97 100644
--- a/tests/integration/targets/nutanix_pbrs_info/tasks/list_pbrs.yml
+++ b/tests/integration/targets/nutanix_pbrs_info/tasks/list_pbrs.yml
@@ -4,10 +4,10 @@
priority: "10"
check_mode: true
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list pbrs "
@@ -18,10 +18,10 @@
length: 1
offset: 0
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list pbrs "
@@ -32,10 +32,10 @@
sort_order: "ASCENDING"
sort_attribute: "priority"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list pbrs "
diff --git a/tests/integration/targets/nutanix_pbrs_info/tasks/main.yml b/tests/integration/targets/nutanix_pbrs_info/tasks/main.yml
index d89e9da7d..8c6394db0 100644
--- a/tests/integration/targets/nutanix_pbrs_info/tasks/main.yml
+++ b/tests/integration/targets/nutanix_pbrs_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "list_pbrs.yml"
+ - name: Import "list_pbrs.yml"
+ ansible.builtin.import_tasks: "list_pbrs.yml"
diff --git a/tests/integration/targets/nutanix_subnets/tasks/create_subnet.yml b/tests/integration/targets/nutanix_subnets/tasks/create_subnet.yml
index d5547b424..fe8860422 100644
--- a/tests/integration/targets/nutanix_subnets/tasks/create_subnet.yml
+++ b/tests/integration/targets/nutanix_subnets/tasks/create_subnet.yml
@@ -13,14 +13,15 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create VLAN subnet without IPAM "
success_msg: " VLAN subnet without IPAM created successfully "
-- set_fact:
+- name: Add subnet_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.subnet_uuid ] }}"
#################################################################
- name: VLAN subnet with IPAM
@@ -42,14 +43,15 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create VLAN subnet with IPAM "
success_msg: " VLAN subnet with IPAM created successfully "
-- set_fact:
+- name: Add subnet_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.subnet_uuid ] }}"
#################################################################
- name: VLAN subnet with IPAM and IP pools
@@ -73,14 +75,15 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create VLAN subnet with IPAM and IP pools"
success_msg: " VLAN subnet with IPAM and IP pools created successfully "
-- set_fact:
+- name: Add subnet_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.subnet_uuid ] }}"
- name: Delete all Created Subnets
@@ -89,9 +92,10 @@
subnet_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
#################################################################
- name: VLAN subnet with IPAM and IP pools and cluster uuid
@@ -115,14 +119,15 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create VLAN subnet with IPAM and IP pools and cluster uuid "
success_msg: " VLAN subnet with IPAM and IP pools and cluster uuid created successfully "
-- set_fact:
+- name: Add subnet_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.subnet_uuid ] }}"
- name: Delete all Created Subnets
@@ -131,9 +136,10 @@
subnet_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
#################################################################
- name: VLAN subnet with IPAM IP pools and DHCP
@@ -164,14 +170,15 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create VLAN subnet with IPAM, IP pools and DHCP "
success_msg: " VLAN subnet with IPAM, IP pools and DHCP created successfully "
-- set_fact:
+- name: Add subnet_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.subnet_uuid ] }}"
#################################################################
- name: VLAN subnet with IPAM multiple IP pools and DHCP
@@ -204,14 +211,15 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create VLAN subnet with IPAM, multiple IP pools and DHCP "
success_msg: " VLAN subnet with IPAM, multiple IP pools and DHCP created successfully "
-- set_fact:
+- name: Add subnet_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.subnet_uuid ] }}"
#################################################################
- name: External subnet without NAT
@@ -236,14 +244,15 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create External subnet without NAT "
success_msg: " External subnet without NAT created successfully "
-- set_fact:
+- name: Add subnet_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.subnet_uuid ] }}"
#################################################################
- name: External subnet with NAT
@@ -252,7 +261,7 @@
name: " External subnet with NAT "
external_subnet:
vlan_id: "{{ external_nat_subnet.vlan_id }}"
- enable_nat: True
+ enable_nat: true
cluster:
name: "{{ cluster.name }}"
ipam:
@@ -268,14 +277,15 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create External subnet with NAT "
success_msg: " External subnet with NAT created successfully "
-- set_fact:
+- name: Add subnet_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.subnet_uuid ] }}"
#################################################################
- name: Overlay Subnet with minimum requirements
@@ -293,14 +303,15 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create Overlay Subnet with minimum requirements "
success_msg: " Overlay Subnet with minimum requirements created successfully "
-- set_fact:
+- name: Add subnet_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.subnet_uuid ] }}"
#################################################################
- name: Delete all Created Subnets
@@ -309,9 +320,10 @@
subnet_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
#################################################################
- name: Overlay Subnet with IP_pools and DHCP
@@ -338,13 +350,14 @@
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create Overlay Subnet with IP_pools and DHCP "
success_msg: " Overlay Subnet with IP_pools and DHCP created successfully "
-- set_fact:
+- name: Add subnet_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.subnet_uuid ] }}"
#################################################################
- name: Delete all Created Subnets
@@ -353,9 +366,10 @@
subnet_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
#################################################################
- name: Overlay Subnet with IP_pools and DHCP with vpc uuid
@@ -381,13 +395,14 @@
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create Overlay Subnet with IP_pools and DHCP with vpc uuid "
success_msg: " Overlay Subnet with IP_pools and DHCP with vpc uuid created successfully "
-- set_fact:
+- name: Add subnet_uuid to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.subnet_uuid ] }}"
- name: Delete all Created Subnets
@@ -396,4 +411,4 @@
subnet_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
diff --git a/tests/integration/targets/nutanix_subnets/tasks/delete_subnet.yml b/tests/integration/targets/nutanix_subnets/tasks/delete_subnet.yml
index 2f1a9e7cb..d90486241 100644
--- a/tests/integration/targets/nutanix_subnets/tasks/delete_subnet.yml
+++ b/tests/integration/targets/nutanix_subnets/tasks/delete_subnet.yml
@@ -23,7 +23,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
diff --git a/tests/integration/targets/nutanix_subnets/tasks/main.yml b/tests/integration/targets/nutanix_subnets/tasks/main.yml
index 74ba8ce03..477e7efdf 100644
--- a/tests/integration/targets/nutanix_subnets/tasks/main.yml
+++ b/tests/integration/targets/nutanix_subnets/tasks/main.yml
@@ -1,11 +1,15 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create_subnet.yml"
- - import_tasks: "delete_subnet.yml"
- - import_tasks: "negative_scenarios.yml"
+ - name: Import create_subnet.yml
+ ansible.builtin.import_tasks: "create_subnet.yml"
+ - name: Import delete_subnet.yml
+ ansible.builtin.import_tasks: "delete_subnet.yml"
+ - name: Import negative_scenarios.yml
+ ansible.builtin.import_tasks: "negative_scenarios.yml"
diff --git a/tests/integration/targets/nutanix_subnets/tasks/negative_scenarios.yml b/tests/integration/targets/nutanix_subnets/tasks/negative_scenarios.yml
index c392c795d..4605fcab8 100644
--- a/tests/integration/targets/nutanix_subnets/tasks/negative_scenarios.yml
+++ b/tests/integration/targets/nutanix_subnets/tasks/negative_scenarios.yml
@@ -1,84 +1,85 @@
- - debug:
- msg: "Started Negative Creation Cases"
+- name: Start Negative Testing
+ ansible.builtin.debug:
+ msg: "Started Negative Creation Cases"
- - name: Unknown virtual switch name
- ntnx_subnets:
- state: present
- name: VLAN subnet without IPAM
- vlan_subnet:
- vlan_id: "{{ vlan_subnets_ids.0 }}"
- virtual_switch:
- name: "virtual_switch"
- cluster:
- uuid: "{{ cluster.uuid }}"
- register: result
- ignore_errors: True
+- name: Unknown virtual switch name
+ ntnx_subnets:
+ state: present
+ name: VLAN subnet without IPAM
+ vlan_subnet:
+ vlan_id: "{{ vlan_subnets_ids.0 }}"
+ virtual_switch:
+ name: "virtual_switch"
+ cluster:
+ uuid: "{{ cluster.uuid }}"
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.failed==True
- - result.msg=="Failed generating subnet spec"
- success_msg: ' Success: returned error as expected '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.failed==True
+ - result.msg=="Failed generating subnet spec"
+ success_msg: " Success: returned error as expected "
###############################################################
- - name: Unknown virtual switch uuid
- ntnx_subnets:
- state: present
- name: VLAN subnet with IPAM
- vlan_subnet:
- vlan_id: "{{ vlan_subnets_ids.1 }}"
- virtual_switch:
- uuid: 91639374-c0b9-48c3-bfc1-f9c89343b3e
- cluster:
- name: "{{ cluster.name }}"
- ipam:
- network_ip: "{{ ip_address_management.network_ip }}"
- network_prefix: "{{ ip_address_management.network_prefix }}"
- gateway_ip: "{{ ip_address_management.gateway_ip_address }}"
- register: result
- ignore_errors: true
+- name: Unknown virtual switch uuid
+ ntnx_subnets:
+ state: present
+ name: VLAN subnet with IPAM
+ vlan_subnet:
+ vlan_id: "{{ vlan_subnets_ids.1 }}"
+ virtual_switch:
+ uuid: 91639374-c0b9-48c3-bfc1-f9c89343b3e
+ cluster:
+ name: "{{ cluster.name }}"
+ ipam:
+ network_ip: "{{ ip_address_management.network_ip }}"
+ network_prefix: "{{ ip_address_management.network_prefix }}"
+ gateway_ip: "{{ ip_address_management.gateway_ip_address }}"
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.failed==True
- success_msg: ' Success: returned error as expected '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.failed==True
+ success_msg: " Success: returned error as expected "
###############################################################
- - name: Unknown Cluster
- ntnx_subnets:
- state: present
- name: VLAN subnet with IPAM and IP pools
- vlan_subnet:
- vlan_id: "{{vlan_subnets_ids.2}}"
- virtual_switch:
- name: "{{ virtual_switch.name }}"
- cluster:
- name: auto_cluster_prod_1a642ea0a5c
- ipam:
- network_ip: "{{ ip_address_management.network_ip }}"
- network_prefix: "{{ ip_address_management.network_prefix }}"
- gateway_ip: "{{ ip_address_management.gateway_ip_address }}"
- ip_pools:
- - start_ip: "{{ ip_address_pools.start_address }}"
- end_ip: "{{ ip_address_pools.end_address }}"
- register: result
- ignore_errors: true
+- name: Unknown Cluster
+ ntnx_subnets:
+ state: present
+ name: VLAN subnet with IPAM and IP pools
+ vlan_subnet:
+ vlan_id: "{{vlan_subnets_ids.2}}"
+ virtual_switch:
+ name: "{{ virtual_switch.name }}"
+ cluster:
+ name: auto_cluster_prod_1a642ea0a5c
+ ipam:
+ network_ip: "{{ ip_address_management.network_ip }}"
+ network_prefix: "{{ ip_address_management.network_prefix }}"
+ gateway_ip: "{{ ip_address_management.gateway_ip_address }}"
+ ip_pools:
+ - start_ip: "{{ ip_address_pools.start_address }}"
+ end_ip: "{{ ip_address_pools.end_address }}"
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.failed==True
- success_msg: ' Success: returned error as expected '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.failed==True
+ success_msg: " Success: returned error as expected "
###############################################################
- - name: Delete subnet with unknown uuid
- ntnx_subnets:
- state: absent
- subnet_uuid: 5
- register: resultt
- ignore_errors: true
+- name: Delete subnet with unknown uuid
+ ntnx_subnets:
+ state: absent
+ subnet_uuid: 5
+ register: resultt
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.failed==True
- success_msg: ' Success: returned error as expected '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.failed==True
+ success_msg: " Success: returned error as expected "
diff --git a/tests/integration/targets/nutanix_subnets_info/tasks/list_subnets.yml b/tests/integration/targets/nutanix_subnets_info/tasks/list_subnets.yml
index 8ab34fbef..269704084 100644
--- a/tests/integration/targets/nutanix_subnets_info/tasks/list_subnets.yml
+++ b/tests/integration/targets/nutanix_subnets_info/tasks/list_subnets.yml
@@ -3,10 +3,10 @@
filter:
subnet_type: "VLAN"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list subnets "
@@ -18,10 +18,10 @@
offset: 2
check_mode: true
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list subnets "
@@ -33,10 +33,10 @@
sort_attribute: "vlan_id"
kind: subnet
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list subnets "
@@ -47,10 +47,10 @@
custom_filter:
vswitch_name: br0
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.entities[0].status.resources.vswitch_name == "br0"
diff --git a/tests/integration/targets/nutanix_subnets_info/tasks/main.yml b/tests/integration/targets/nutanix_subnets_info/tasks/main.yml
index d676a3281..96f564754 100644
--- a/tests/integration/targets/nutanix_subnets_info/tasks/main.yml
+++ b/tests/integration/targets/nutanix_subnets_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "list_subnets.yml"
+ - name: Import "list_subnets.yml"
+ ansible.builtin.import_tasks: "list_subnets.yml"
diff --git a/tests/integration/targets/nutanix_vms/tasks/create.yml b/tests/integration/targets/nutanix_vms/tasks/create.yml
index d2f99f460..04c665a72 100644
--- a/tests/integration/targets/nutanix_vms/tasks/create.yml
+++ b/tests/integration/targets/nutanix_vms/tasks/create.yml
@@ -1,601 +1,621 @@
- - name: Create Cloud-init Script file
- copy:
- dest: "cloud_init.yml"
- content: |
- #cloud-config
- chpasswd:
- list: |
- root: "{{ password }}"
- expire: False
- fqdn: myNutanixVM
+- name: Create Cloud-init Script file
+ ansible.builtin.copy:
+ dest: "cloud_init.yml"
+ mode: "0644"
+ content: |
+ #cloud-config
+ chpasswd:
+ list: |
+ root: "{{ password }}"
+ expire: false
+ fqdn: myNutanixVM
##########################################################################
- - name: VM with none values
- ntnx_vms:
- state: present
- name: none
- timezone: GMT
- project:
- uuid: "{{ project.uuid }}"
- cluster:
- name: "{{ cluster.name }}"
- categories:
- AppType:
- - Apache_Spark
- disks:
- - type: DISK
- size_gb: 5
- bus: SCSI
- vcpus:
- cores_per_vcpu:
- memory_gb:
- register: result
- ignore_errors: true
+- name: VM with none values
+ ntnx_vms:
+ state: present
+ name: none
+ timezone: GMT
+ project:
+ uuid: "{{ project.uuid }}"
+ cluster:
+ name: "{{ cluster.name }}"
+ categories:
+ AppType:
+ - Apache_Spark
+ disks:
+ - type: DISK
+ size_gb: 5
+ bus: SCSI
+ vcpus:
+ cores_per_vcpu:
+ memory_gb:
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- fail_msg: 'Unable to Create VM with none values '
- success_msg: 'VM with none values created successfully '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ fail_msg: "Unable to Create VM with none values "
+ success_msg: "VM with none values created successfully "
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
# ##################################################################################
- - name: VM with owner name
- ntnx_vms:
- state: present
- name: none
- timezone: GMT
- project:
- uuid: "{{ project.uuid }}"
- cluster:
- name: "{{ cluster.name }}"
- categories:
- AppType:
- - Apache_Spark
- owner:
- name: "{{ vm_owner.name }}"
- disks:
- - type: DISK
- size_gb: 5
- bus: SCSI
- register: result
- ignore_errors: true
+- name: VM with owner name
+ ntnx_vms:
+ state: present
+ name: none
+ timezone: GMT
+ project:
+ uuid: "{{ project.uuid }}"
+ cluster:
+ name: "{{ cluster.name }}"
+ categories:
+ AppType:
+ - Apache_Spark
+ owner:
+ name: "{{ vm_owner.name }}"
+ disks:
+ - type: DISK
+ size_gb: 5
+ bus: SCSI
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- - result.response.metadata.owner_reference.name == "{{ vm_owner.name }}"
- - result.response.metadata.owner_reference.uuid == "{{ vm_owner.uuid }}"
- - result.response.metadata.owner_reference.kind == "user"
- fail_msg: 'Unable to Create VM with owner'
- success_msg: 'VM with owner created successfully '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ - result.response.metadata.owner_reference.name == "{{ vm_owner.name }}"
+ - result.response.metadata.owner_reference.uuid == "{{ vm_owner.uuid }}"
+ - result.response.metadata.owner_reference.kind == "user"
+ fail_msg: "Unable to Create VM with owner"
+ success_msg: "VM with owner created successfully "
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
##################################################################################
- - name: VM with ubuntu image and different specifications
- ntnx_vms:
- state: present
- project:
- name: "{{ project.name }}"
- name: "VM with Ubuntu image"
- desc: "VM with cluster, network, category, disk with Ubuntu image, guest customization "
- categories:
- AppType:
- - Default
- Environment:
- - Dev
- cluster:
- name: "{{ cluster.name }}"
- networks:
- - is_connected: True
- subnet:
- name: "{{ network.dhcp.name }}"
- disks:
- - type: "DISK"
- size_gb: 30
- bus: "SATA"
- clone_image:
- name: "{{ ubuntu }}"
- vcpus: 1
- cores_per_vcpu: 1
- memory_gb: 1
- guest_customization:
- type: "cloud_init"
- script_path: "./cloud_init.yml"
- is_overridable: True
- register: result
+- name: VM with ubuntu image and different specifications
+ ntnx_vms:
+ state: present
+ project:
+ name: "{{ project.name }}"
+ name: "VM with Ubuntu image"
+ desc: "VM with cluster, network, category, disk with Ubuntu image, guest customization "
+ categories:
+ AppType:
+ - Default
+ Environment:
+ - Dev
+ cluster:
+ name: "{{ cluster.name }}"
+ networks:
+ - is_connected: true
+ subnet:
+ name: "{{ network.dhcp.name }}"
+ disks:
+ - type: "DISK"
+ size_gb: 30
+ bus: "SATA"
+ clone_image:
+ name: "{{ ubuntu }}"
+ vcpus: 1
+ cores_per_vcpu: 1
+ memory_gb: 1
+ guest_customization:
+ type: "cloud_init"
+ script_path: "./cloud_init.yml"
+ is_overridable: true
+ register: result
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- - result.response.metadata.categories_mapping["AppType"] == ["Default"]
- - result.response.metadata.categories_mapping["Environment"] == ["Dev"]
- fail_msg: 'Unable to Create VM with Ubuntu image and different specifications '
- success_msg: 'VM with Ubuntu image and different specifications created successfully '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ - result.response.metadata.categories_mapping["AppType"] == ["Default"]
+ - result.response.metadata.categories_mapping["Environment"] == ["Dev"]
+ fail_msg: "Unable to Create VM with Ubuntu image and different specifications "
+ success_msg: "VM with Ubuntu image and different specifications created successfully "
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
- when: result.response.status.state == 'COMPLETE'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+ when: result.response.status.state == 'COMPLETE'
#########################################################################################
- - name: VM with CentOS-7-cloud-init image with disk image size
- ntnx_vms:
- state: present
- name: VM with CentOS-7-cloud-init image
- memory_gb: 1
- timezone: "UTC"
- cluster:
- uuid: "{{ cluster.uuid }}"
- 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
- register: result
- ignore_errors: True
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- fail_msg: 'Unable to create VM with CentOS-7-cloud-init image'
- success_msg: 'VM with CentOS-7-cloud-init image created successfully '
+- name: VM with CentOS-7-cloud-init image with disk image size
+ ntnx_vms:
+ state: present
+ name: VM with CentOS-7-cloud-init image
+ memory_gb: 1
+ timezone: "UTC"
+ cluster:
+ uuid: "{{ cluster.uuid }}"
+ 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
+ register: result
+ ignore_errors: true
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ fail_msg: "Unable to create VM with CentOS-7-cloud-init image"
+ success_msg: "VM with CentOS-7-cloud-init image created successfully "
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
- when: result.response.status.state == 'COMPLETE'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+ when: result.response.status.state == 'COMPLETE'
#################################################################################
- - name: VM with CentOS-7-cloud-init image without disk image size
- ntnx_vms:
- state: present
- memory_gb: 1
- name: VM with CentOS-7-cloud-init image without image size
- timezone: "UTC"
- cluster:
- uuid: "{{ cluster.uuid }}"
- disks:
- - type: "DISK"
- clone_image:
- name: "{{ centos }}"
- bus: "SCSI"
- guest_customization:
- type: "cloud_init"
- script_path: "./cloud_init.yml"
- is_overridable: True
- register: result
- ignore_errors: True
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- fail_msg: 'Unable to create VM with CentOS-7-cloud-init image'
- success_msg: 'VM with CentOS-7-cloud-init image created successfully '
+- name: VM with CentOS-7-cloud-init image without disk image size
+ ntnx_vms:
+ state: present
+ memory_gb: 1
+ name: VM with CentOS-7-cloud-init image without image size
+ timezone: "UTC"
+ cluster:
+ uuid: "{{ cluster.uuid }}"
+ disks:
+ - type: "DISK"
+ clone_image:
+ name: "{{ centos }}"
+ bus: "SCSI"
+ guest_customization:
+ type: "cloud_init"
+ script_path: "./cloud_init.yml"
+ is_overridable: true
+ register: result
+ ignore_errors: true
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ fail_msg: "Unable to create VM with CentOS-7-cloud-init image"
+ success_msg: "VM with CentOS-7-cloud-init image created successfully "
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
- when: result.response.status.state == 'COMPLETE'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+ when: result.response.status.state == 'COMPLETE'
- - name: Delete all Created VMs
- ntnx_vms:
- state: absent
- vm_uuid: '{{ item }}'
- register: result
- loop: '{{ todelete }}'
- - set_fact:
- todelete: []
+- name: Delete all Created VMs
+ ntnx_vms:
+ state: absent
+ vm_uuid: "{{ item }}"
+ register: result
+ loop: "{{ todelete }}"
+- name: Reset todelete list
+ ansible.builtin.set_fact:
+ todelete: []
#################################################################################
- - name: VM with Cluster, Network, Universal time zone, one Disk
- ntnx_vms:
- state: present
- name: "VM with Cluster Network and Disk"
- memory_gb: 1
- timezone: "Universal"
- cluster:
- name: "{{ cluster.name }}"
- networks:
- - is_connected: False
- subnet:
- uuid: "{{ network.dhcp.uuid }}"
- disks:
- - type: "DISK"
- size_gb: 10
- bus: "PCI"
- register: result
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- fail_msg: 'Unable to create VM with Cluster , Network, Universal time zone, one Disk'
- success_msg: 'VM with Cluster , Network, Universal time zone, one Disk created successfully '
+- name: VM with Cluster, Network, Universal time zone, one Disk
+ ntnx_vms:
+ state: present
+ name: "VM with Cluster Network and Disk"
+ memory_gb: 1
+ timezone: "Universal"
+ cluster:
+ name: "{{ cluster.name }}"
+ networks:
+ - is_connected: false
+ subnet:
+ uuid: "{{ network.dhcp.uuid }}"
+ disks:
+ - type: "DISK"
+ size_gb: 10
+ bus: "PCI"
+ register: result
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ fail_msg: "Unable to create VM with Cluster , Network, Universal time zone, one Disk"
+ success_msg: "VM with Cluster , Network, Universal time zone, one Disk created successfully "
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
- when: result.response.status.state == 'COMPLETE'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+ when: result.response.status.state == 'COMPLETE'
########################################################################################
- - name: VM with Cluster, different Disks, Memory size
- ntnx_vms:
- state: present
- name: "VM with different disks"
- timezone: "UTC"
- cluster:
- uuid: "{{ cluster.uuid }}"
- disks:
- - type: "DISK"
- size_gb: 10
- bus: "SATA"
- - type: "DISK"
- size_gb: 30
- bus: "SCSI"
- memory_gb: 2
- register: result
- ignore_errors: True
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- fail_msg: 'Unable to create VM with Cluster, different Disks, Memory size'
- success_msg: 'VM with Cluster, different Disks, Memory size created successfully '
+- name: VM with Cluster, different Disks, Memory size
+ ntnx_vms:
+ state: present
+ name: "VM with different disks"
+ timezone: "UTC"
+ cluster:
+ uuid: "{{ cluster.uuid }}"
+ disks:
+ - type: "DISK"
+ size_gb: 10
+ bus: "SATA"
+ - type: "DISK"
+ size_gb: 30
+ bus: "SCSI"
+ memory_gb: 2
+ register: result
+ ignore_errors: true
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ fail_msg: "Unable to create VM with Cluster, different Disks, Memory size"
+ success_msg: "VM with Cluster, different Disks, Memory size created successfully "
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
- when: result.response.status.state == 'COMPLETE'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+ when: result.response.status.state == 'COMPLETE'
#####################################################################################
- - name: VM with Cluster, different CDROMs
- ntnx_vms:
- state: present
- memory_gb: 1
- wait: true
- 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
- register: result
- ignore_errors: True
+- name: VM with Cluster, different CDROMs
+ ntnx_vms:
+ state: present
+ memory_gb: 1
+ wait: true
+ 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
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- fail_msg: 'Unable to Create VM with Cluster, different CDROMs '
- success_msg: 'VM with Cluster, different CDROMs created successfully '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ fail_msg: "Unable to Create VM with Cluster, different CDROMs "
+ success_msg: "VM with Cluster, different CDROMs created successfully "
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
- - name: Delete all Created VMs
- ntnx_vms:
- state: absent
- vm_uuid: '{{ item }}'
- register: result
- loop: '{{ todelete }}'
- - set_fact:
- todelete: []
+- name: Delete all Created VMs
+ ntnx_vms:
+ state: absent
+ vm_uuid: "{{ item }}"
+ register: result
+ loop: "{{ todelete }}"
+- name: Reset todelete list
+ ansible.builtin.set_fact:
+ todelete: []
####################################################################################
- - name: VM with all specification
- ntnx_vms:
- state: present
- wait: True
- name: "All specification"
- timezone: "GMT"
- cluster:
- uuid: "{{ cluster.uuid }}"
- disks:
- - type: "DISK"
- size_gb: 2
- bus: "SCSI"
- - type: "DISK"
- size_gb: 10
- bus: "PCI"
- - type: "DISK"
- size_gb: 2
- bus: "SATA"
- - type: "DISK"
- size_gb: 10
- bus: "SCSI"
- - type: "CDROM"
- bus: "IDE"
- empty_cdrom: True
- boot_config:
- boot_type: "UEFI"
- boot_order:
- - "DISK"
- - "CDROM"
- - "NETWORK"
- vcpus: 1
- cores_per_vcpu: 2
- memory_gb: 1
- register: result
- ignore_errors: True
+- name: VM with all specification
+ ntnx_vms:
+ state: present
+ wait: true
+ name: "All specification"
+ timezone: "GMT"
+ cluster:
+ uuid: "{{ cluster.uuid }}"
+ disks:
+ - type: "DISK"
+ size_gb: 2
+ bus: "SCSI"
+ - type: "DISK"
+ size_gb: 10
+ bus: "PCI"
+ - type: "DISK"
+ size_gb: 2
+ bus: "SATA"
+ - type: "DISK"
+ size_gb: 10
+ bus: "SCSI"
+ - type: "CDROM"
+ bus: "IDE"
+ empty_cdrom: true
+ boot_config:
+ boot_type: "UEFI"
+ boot_order:
+ - "DISK"
+ - "CDROM"
+ - "NETWORK"
+ vcpus: 1
+ cores_per_vcpu: 2
+ memory_gb: 1
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- fail_msg: ' Unable to create VM with all specification '
- success_msg: ' VM with all specification created successfully '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ fail_msg: " Unable to create VM with all specification "
+ success_msg: " VM with all specification created successfully "
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
- when: result.response.status.state == 'COMPLETE'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+ when: result.response.status.state == 'COMPLETE'
##################################################################################################
- - name: VM with managed subnet
- ntnx_vms:
- state: present
- name: VM with managed subnet
- memory_gb: 1
- cluster:
- name: "{{ cluster.name }}"
- networks:
- - is_connected: true
- subnet:
- uuid: "{{ network.dhcp.uuid }}"
- register: result
- ignore_errors: true
+- name: VM with managed subnet
+ ntnx_vms:
+ state: present
+ name: VM with managed subnet
+ memory_gb: 1
+ cluster:
+ name: "{{ cluster.name }}"
+ networks:
+ - is_connected: true
+ subnet:
+ uuid: "{{ network.dhcp.uuid }}"
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- fail_msg: ' Unable to create VM with managed subnet '
- success_msg: ' VM with with managed subnet created successfully '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ fail_msg: " Unable to create VM with managed subnet "
+ success_msg: " VM with with managed subnet created successfully "
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
- when: result.response.status.state == 'COMPLETE'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+ when: result.response.status.state == 'COMPLETE'
###################################################################################################
- - name: VM with minimum requirements
- ntnx_vms:
- state: present
- name: MinReqVM
- cluster:
- name: "{{ cluster.name }}"
- register: result
- ignore_errors: true
+- name: VM with minimum requirements
+ ntnx_vms:
+ state: present
+ name: MinReqVM
+ cluster:
+ name: "{{ cluster.name }}"
+ register: result
+ ignore_errors: true
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ fail_msg: " Unable to create VM with minimum requirements "
+ success_msg: " VM with minimum requirements created successfully "
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- fail_msg: ' Unable to create VM with minimum requirements '
- success_msg: ' VM with minimum requirements created successfully '
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+ when: result.response.status.state == 'COMPLETE'
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
- when: result.response.status.state == 'COMPLETE'
-
- - name: Delete all Created VMs
- ntnx_vms:
- state: absent
- vm_uuid: '{{ item }}'
- register: result
- loop: '{{ todelete }}'
- - set_fact:
- todelete: []
+- name: Delete all Created VMs
+ ntnx_vms:
+ state: absent
+ vm_uuid: "{{ item }}"
+ register: result
+ loop: "{{ todelete }}"
+- name: Reset todelete list
+ ansible.builtin.set_fact:
+ todelete: []
##################################################################################################
- - name: VM with unmanaged vlan
- ntnx_vms:
- desc: "VM with unmanaged vlan"
- state: present
- name: VM with unmanaged vlan
- timezone: UTC
- cluster:
- uuid: "{{ cluster.uuid }}"
- networks:
- - is_connected: false
- subnet:
- uuid: "{{ static.uuid }}"
- private_ip: "{{ network.static.ip }}"
- boot_config:
- boot_type: LEGACY
- boot_order:
- - DISK
- - CDROM
- - NETWORK
- vcpus: 1
- cores_per_vcpu: 1
- memory_gb: 1
- register: result
- ignore_errors: true
+- name: VM with unmanaged vlan
+ ntnx_vms:
+ desc: "VM with unmanaged vlan"
+ state: present
+ name: VM with unmanaged vlan
+ timezone: UTC
+ cluster:
+ uuid: "{{ cluster.uuid }}"
+ networks:
+ - is_connected: false
+ subnet:
+ uuid: "{{ static.uuid }}"
+ private_ip: "{{ network.static.ip }}"
+ boot_config:
+ boot_type: LEGACY
+ boot_order:
+ - DISK
+ - CDROM
+ - NETWORK
+ vcpus: 1
+ cores_per_vcpu: 1
+ memory_gb: 1
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- fail_msg: ' Unable to create VM with unmanaged vlan '
- success_msg: ' VM with unmanaged vlan created successfully '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ fail_msg: " Unable to create VM with unmanaged vlan "
+ success_msg: " VM with unmanaged vlan created successfully "
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
- when: result.response.status.state == 'COMPLETE'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+ when: result.response.status.state == 'COMPLETE'
- - name: Delete all Created VM
- ntnx_vms:
- state: absent
- vm_uuid: '{{ item }}'
- register: result
- loop: '{{ todelete }}'
- - set_fact:
- todelete: []
+- name: Delete all Created VM
+ ntnx_vms:
+ state: absent
+ vm_uuid: "{{ item }}"
+ register: result
+ loop: "{{ todelete }}"
+- name: Reset todelete list
+ ansible.builtin.set_fact:
+ todelete: []
######################################################################################
- - name: VM with managed and unmanaged network
- ntnx_vms:
- state: present
- name: VM_NIC
- timezone: UTC
- cluster:
- name: "{{ cluster.name }}"
- networks:
- - is_connected: true
- subnet:
- name: "{{ network.dhcp.name }}"
- cluster:
- name: "{{ cluster.name }}"
- - is_connected: true
- subnet:
- uuid: "{{ static.uuid }}"
- cluster:
- uuid: "{{ cluster.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: 1
- cores_per_vcpu: 1
- memory_gb: 1
- register: result
- ignore_errors: true
+- name: VM with managed and unmanaged network
+ ntnx_vms:
+ state: present
+ name: VM_NIC
+ timezone: UTC
+ cluster:
+ name: "{{ cluster.name }}"
+ networks:
+ - is_connected: true
+ subnet:
+ name: "{{ network.dhcp.name }}"
+ cluster:
+ name: "{{ cluster.name }}"
+ - is_connected: true
+ subnet:
+ uuid: "{{ static.uuid }}"
+ cluster:
+ uuid: "{{ cluster.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: 1
+ cores_per_vcpu: 1
+ memory_gb: 1
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- fail_msg: ' Unable to create VM with managed and unmanaged network '
- success_msg: ' VM with managed and unmanaged network created successfully '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ fail_msg: " Unable to create VM with managed and unmanaged network "
+ success_msg: " VM with managed and unmanaged network created successfully "
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
- when: result.response.status.state == 'COMPLETE'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+ when: result.response.status.state == 'COMPLETE'
#########################################################################################
- - 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
- 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
- storage_container:
- name: "{{ storage_container.name }}"
- - 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: 1
- cores_per_vcpu: 1
- memory_gb: 1
- register: result
+- 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
+ 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
+ storage_container:
+ name: "{{ storage_container.name }}"
+ - 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: 1
+ cores_per_vcpu: 1
+ memory_gb: 1
+ register: result
################################################################################
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- fail_msg: ' Unable to create VM with different disk types and different sizes with UEFI boot type '
- success_msg: ' VM with different disk types and different sizes with UEFI boot type created successfully '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ fail_msg: " Unable to create VM with different disk types and different sizes with UEFI boot type "
+ success_msg: " VM with different disk types and different sizes with UEFI boot type created successfully "
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
- when: result.response.status.state == 'COMPLETE'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+ when: result.response.status.state == 'COMPLETE'
- - name: Delete all Created VM
- ntnx_vms:
- state: absent
- vm_uuid: '{{ item }}'
- register: result
- loop: '{{ todelete }}'
+- name: Delete all Created VM
+ ntnx_vms:
+ state: absent
+ vm_uuid: "{{ item }}"
+ register: result
+ loop: "{{ todelete }}"
- - set_fact:
- todelete: []
+- name: Reset todelete list
+ ansible.builtin.set_fact:
+ todelete: []
####################################################################################
- - name: VM with storage container
- ntnx_vms:
- state: present
- name: VM with UEFI boot type
- timezone: GMT
- cluster:
- name: "{{ cluster.name }}"
- categories:
- AppType:
- - Apache_Spark
- disks:
- - type: DISK
- size_gb: 1
- bus: SCSI
- storage_container:
- uuid: "{{ storage_container.uuid }}"
- vcpus: 1
- cores_per_vcpu: 1
- memory_gb: 1
- register: result
+- name: VM with storage container
+ ntnx_vms:
+ state: present
+ name: VM with UEFI boot type
+ timezone: GMT
+ cluster:
+ name: "{{ cluster.name }}"
+ categories:
+ AppType:
+ - Apache_Spark
+ disks:
+ - type: DISK
+ size_gb: 1
+ bus: SCSI
+ storage_container:
+ uuid: "{{ storage_container.uuid }}"
+ vcpus: 1
+ cores_per_vcpu: 1
+ memory_gb: 1
+ register: result
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- fail_msg: ' Unable to create VM withstorage container '
- success_msg: ' VM with storage container created successfully '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ fail_msg: " Unable to create VM withstorage container "
+ success_msg: " VM with storage container created successfully "
- - set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
- when: result.response.status.state == 'COMPLETE'
+- name: Add vm_uuid to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+ when: result.response.status.state == 'COMPLETE'
####################################################################################
- - name: Delete all Created VMs
- ntnx_vms:
- state: absent
- vm_uuid: '{{ item }}'
- register: result
- loop: '{{ todelete }}'
+- name: Delete all Created VMs
+ ntnx_vms:
+ state: absent
+ vm_uuid: "{{ item }}"
+ register: result
+ loop: "{{ todelete }}"
diff --git a/tests/integration/targets/nutanix_vms/tasks/delete.yml b/tests/integration/targets/nutanix_vms/tasks/delete.yml
index c3faaf636..ac0f1ea91 100644
--- a/tests/integration/targets/nutanix_vms/tasks/delete.yml
+++ b/tests/integration/targets/nutanix_vms/tasks/delete.yml
@@ -1,20 +1,20 @@
---
- name: VM with minimum requirements
ntnx_vms:
- state: present
- name: MinReqVM
- cluster:
- name: "{{ cluster.name }}"
+ state: present
+ name: MinReqVM
+ cluster:
+ name: "{{ cluster.name }}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.response.status.state == 'COMPLETE'
- fail_msg: ' Unable to create VM with minimum requirements '
- success_msg: ' VM with minimum requirements created successfully '
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.response.status.state == 'COMPLETE'
+ fail_msg: " Unable to create VM with minimum requirements "
+ success_msg: " VM with minimum requirements created successfully "
- name: Delete VM
ntnx_vms:
@@ -22,8 +22,8 @@
state: absent
register: result
-- name: assert when status not complete
- assert:
+- name: Assert when status not complete
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'SUCCEEDED'
diff --git a/tests/integration/targets/nutanix_vms/tasks/main.yml b/tests/integration/targets/nutanix_vms/tasks/main.yml
index 1a9593038..103305c2b 100644
--- a/tests/integration/targets/nutanix_vms/tasks/main.yml
+++ b/tests/integration/targets/nutanix_vms/tasks/main.yml
@@ -1,14 +1,21 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create.yml"
- - import_tasks: "negtaive_scenarios.yml"
- - import_tasks: "delete.yml"
- - import_tasks: "vm_operations.yml"
- - import_tasks: "vm_update.yml"
- - import_tasks: "negtaive_vm_update.yml"
+ - name: Import create.yml
+ ansible.builtin.import_tasks: "create.yml"
+ - name: Import negative_scenarios.yml
+ ansible.builtin.import_tasks: "negative_scenarios.yml"
+ - name: Import delete.yml
+ ansible.builtin.import_tasks: "delete.yml"
+ - name: Import vm_operations.yml
+ ansible.builtin.import_tasks: "vm_operations.yml"
+ - name: Import vm_update.yml
+ ansible.builtin.import_tasks: "vm_update.yml"
+ - name: Import negative_vm_update.yml
+ ansible.builtin.import_tasks: "negative_vm_update.yml"
diff --git a/tests/integration/targets/nutanix_vms/tasks/negative_scenarios.yml b/tests/integration/targets/nutanix_vms/tasks/negative_scenarios.yml
new file mode 100755
index 000000000..b163c2f1b
--- /dev/null
+++ b/tests/integration/targets/nutanix_vms/tasks/negative_scenarios.yml
@@ -0,0 +1,308 @@
+- name: Start Negative Testing
+ ansible.builtin.debug:
+ msg: "Started Negative Creation Cases"
+
+- name: Unknown project name
+ ntnx_vms:
+ state: present
+ name: Unknown project name
+ timezone: "UTC"
+ project:
+ name: Project
+ cluster:
+ uuid: "{{ cluster.uuid }}"
+ disks:
+ - type: "DISK"
+ size_gb: 10
+ clone_image:
+ name: "{{ centos }}"
+ bus: "SCSI"
+ register: result
+ ignore_errors: true
+
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.msg == "Failed generating VM Spec"
+ - result.failed == True
+ - result.failed is defined
+ - result.error == "Project project not found."
+ success_msg: " Success: returned error as expected "
+#############################################################
+- name: Check if error is produced when disk size is not given for storage container
+ check_mode: true
+ ntnx_vms:
+ state: present
+ name: VM with storage container
+ timezone: GMT
+ cluster:
+ name: "{{ cluster.name }}"
+ categories:
+ AppType:
+ - Apache_Spark
+ disks:
+ - type: DISK
+ bus: SCSI
+ storage_container:
+ name: "{{ storage_container.name }}"
+ vcpus: 1
+ cores_per_vcpu: 1
+ memory_gb: 1
+ register: result
+ ignore_errors: true
+
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.msg == "Unsupported operation: Unable to create disk, 'size_gb' is required for using storage container."
+ - result.failed == True
+ - result.failed is defined
+ success_msg: " Success: returned error as expected "
+##################################################################################
+- name: Unknown Cluster
+ ntnx_vms:
+ state: present
+ name: Unknown Cluster
+ timezone: "UTC"
+ cluster:
+ uuid: "auto_cluster_1aa888141361"
+ disks:
+ - type: "DISK"
+ size_gb: 10
+ clone_image:
+ name: "{{ centos }}"
+ bus: "SCSI"
+ register: result
+ ignore_errors: true
+
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.failed == True
+ - result.response.state == 'ERROR'
+ - result.status_code == 422
+ - result.error == "HTTP Error 422: UNPROCESSABLE ENTITY"
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail Vm created successfully with unknown cluster "
+################################################################################
+- name: Unknown Cluster name
+ ntnx_vms:
+ state: present
+ name: Unknown Cluster
+ timezone: "UTC"
+ cluster:
+ name: "auto_cluster"
+ disks:
+ - type: "DISK"
+ size_gb: 10
+ clone_image:
+ name: "{{ centos }}"
+ bus: "SCSI"
+ register: result
+ ignore_errors: true
+
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.msg == "Failed generating VM Spec"
+ - result.failed == True
+ - result.response is defined
+ - result.error == "Cluster auto_cluster not found."
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail Vm created successfully with unknown cluster "
+###################################################################################
+- name: Unknown Network name
+ ntnx_vms:
+ state: present
+ name: Unknown Network
+ desc: "Unknown network"
+ categories:
+ AppType:
+ - "Apache_Spark"
+ cluster:
+ name: "{{ cluster.name }}"
+ networks:
+ - is_connected: true
+ subnet:
+ name: "vlan.8000"
+ register: result
+ ignore_errors: true
+
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.failed == True
+ - result.msg == "Failed generating VM Spec"
+ - result.error == "Subnet vlan.8000 not found."
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail VM created successfully with unknown network name "
+###################################################################################
+- name: Unknown Network uuid
+ ntnx_vms:
+ state: present
+ name: Unknown Network
+ desc: "Unknown network"
+ categories:
+ AppType:
+ - "Apache_Spark"
+ cluster:
+ name: "{{ cluster.name }}"
+ networks:
+ - is_connected: true
+ subnet:
+ uuid: "8000"
+ register: result
+ ignore_errors: true
+
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.failed == True
+ - result.error == "HTTP Error 422: UNPROCESSABLE ENTITY"
+ - result.response.state == 'ERROR'
+ - result.status_code == 422
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail VM created successfully with unknown network name "
+###################################################################################
+- name: Unknow Image name
+ ntnx_vms:
+ state: present
+ name: Unknown image_vm
+ timezone: "UTC"
+ cluster:
+ name: "{{ cluster.name }}"
+ disks:
+ - type: "DISK"
+ size_gb: 10
+ clone_image:
+ name: "centos-7-cloudinit"
+ bus: "SCSI"
+ register: result
+ ignore_errors: true
+
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.failed == True
+ - result.response.state == 'ERROR'
+ - result.status_code == 422
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail VM created successfully with not existed image "
+########################################################################################
+- name: Wrong disk size value
+ ntnx_vms:
+ state: present
+ name: "Wrong disk size value"
+ timezone: "UTC"
+ cluster:
+ name: "{{ cluster.name }}"
+ networks:
+ - is_connected: true
+ subnet:
+ name: "{{ network.dhcp.name }}"
+ disks:
+ - type: "DISK"
+ size_gb: 10g
+ bus: "PCI"
+ register: result
+ ignore_errors: true
+
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.failed == True
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail VM created successfully with invalid argument for size_gb "
+#############################################################################################
+- name: Image size less than actual
+ ntnx_vms:
+ state: present
+ name: "image size less than actual"
+ categories:
+ AppType:
+ - "Apache_Spark"
+ cluster:
+ name: "{{ cluster.name }}"
+ networks:
+ - is_connected: true
+ subnet:
+ name: "{{ network.dhcp.name }}"
+ disks:
+ - type: "DISK"
+ size_gb: 2 # must be 20
+ bus: "SATA"
+ clone_image:
+ name: "{{ centos }}"
+ vcpus: 1
+ cores_per_vcpu: 1
+ memory_gb: 1
+ guest_customization:
+ type: "cloud_init"
+ script_path: "cloud_init.yml"
+ is_overridable: true
+ register: result
+ ignore_errors: true
+
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.failed == True
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail: VM created successfully with image size is less than actual "
+#################################################################################
+- name: Unknow storage container name
+ ntnx_vms:
+ state: present
+ name: Unknown storage container
+ timezone: "UTC"
+ cluster:
+ name: "{{ cluster.name }}"
+ disks:
+ - type: "DISK"
+ size_gb: 10
+ storage_container:
+ name: "storage"
+ bus: "SCSI"
+ register: result
+ ignore_errors: true
+
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.failed == True
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail VM created successfully with unknown storage container name "
+#################################################################################
+- name: Delete vm with unknown uuid
+ ntnx_vms:
+ state: absent
+ vm_uuid: 5
+ register: result
+ ignore_errors: true
+
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.response is defined
+ - result.failed == True
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail deleting VM with unknown uuid "
+#################################################################################
+- name: Delete vm with missing uuid
+ ntnx_vms:
+ state: absent
+ register: result
+ ignore_errors: true
+
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.failed == True
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail deleting VM with missing uuid "
diff --git a/tests/integration/targets/nutanix_vms/tasks/negtaive_vm_update.yml b/tests/integration/targets/nutanix_vms/tasks/negative_vm_update.yml
old mode 100644
new mode 100755
similarity index 59%
rename from tests/integration/targets/nutanix_vms/tasks/negtaive_vm_update.yml
rename to tests/integration/targets/nutanix_vms/tasks/negative_vm_update.yml
index 49adf7614..a02a5fadf
--- a/tests/integration/targets/nutanix_vms/tasks/negtaive_vm_update.yml
+++ b/tests/integration/targets/nutanix_vms/tasks/negative_vm_update.yml
@@ -1,7 +1,7 @@
-- name: create VM with minimum requirements to update
+- name: Create VM with minimum requirements to update
ntnx_vms:
state: present
- name: update vm
+ name: Update vm
cluster:
name: "{{ cluster.name }}"
vcpus: 4
@@ -20,7 +20,7 @@
uuid: "{{ storage_container.uuid }}"
- type: "CDROM"
bus: "IDE"
- empty_cdrom: True
+ empty_cdrom: true
- type: DISK
size_gb: 3
bus: PCI
@@ -37,7 +37,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- vm.response is defined
- vm.response.status.state == 'COMPLETE'
@@ -46,7 +46,7 @@
fail_msg: ' Unable to create VM with minimum requirements '
success_msg: ' VM with minimum requirements created successfully '
-- name: update vm without change any value
+- name: Update vm without change any value
ntnx_vms:
vm_uuid: "{{ vm.vm_uuid }}"
vcpus: 4
@@ -55,20 +55,20 @@
register: result
ignore_errors: true
-
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- - result.failed == false
- - result.changed == false
- - result.msg == 'Nothing to change'
- fail_msg: 'Fail : VM updated successfully with same current values '
- success_msg: ' Success: returned error as expected '
+ - result.failed == false
+ - result.changed == false
+ - result.msg == 'Nothing to change'
+ fail_msg: "Fail : VM updated successfully with same current values "
+ success_msg: " Success: returned error as expected "
###############################################################
-- debug:
+- name: Start negative update scenarios tests for memory vcpus cores_per_vcpu
+ ansible.builtin.debug:
msg: Start negative update scenarios tests for memory vcpus cores_per_vcpu
-- name: decrease values for vcpus without force_power_off and vm is on
+- name: Decrease values for vcpus without force_power_off and vm is on
ntnx_vms:
vm_uuid: "{{ vm.vm_uuid }}"
vcpus: 3
@@ -76,15 +76,15 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- - result.failed == True
- - result.changed == false
- - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
- fail_msg: 'Fail : decrease the value for vcpus while while vm is on '
- success_msg: ' Success: returned error as expected '
+ - result.failed == True
+ - result.changed == false
+ - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
+ fail_msg: "Fail : decrease the value for vcpus while while vm is on "
+ success_msg: " Success: returned error as expected "
-- name: decrease values for memory_gb without force_power_off and vm is on
+- name: Decrease values for memory_gb without force_power_off and vm is on
ntnx_vms:
vm_uuid: "{{ vm.vm_uuid }}"
memory_gb: 3
@@ -92,15 +92,15 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- - result.failed == True
- - result.changed == false
- - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
- fail_msg: 'Fail : decrease the value for memory_gb while while vm is on '
- success_msg: ' Success: returned error as expected '
+ - result.failed == True
+ - result.changed == false
+ - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
+ fail_msg: "Fail : decrease the value for memory_gb while while vm is on "
+ success_msg: " Success: returned error as expected "
-- name: decrease values for cores_per_vcpu without force_power_off and vm is on
+- name: Decrease values for cores_per_vcpu without force_power_off and vm is on
ntnx_vms:
vm_uuid: "{{ vm.vm_uuid }}"
cores_per_vcpu: 3
@@ -108,15 +108,16 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- - result.failed == True
- - result.changed == false
- - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
- fail_msg: 'Fail : decrease the value for cores_per_vcpu while while vm is on '
- success_msg: ' Success: returned error as expected '
+ - result.failed == True
+ - result.changed == false
+ - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
+ fail_msg: "Fail : decrease the value for cores_per_vcpu while while vm is on "
+ success_msg: " Success: returned error as expected "
###############################################################
-- debug:
+- name: Start negative update scenarios tests for disks
+ ansible.builtin.debug:
msg: Start negative update scenarios tests for disks
############ negative test : Decrease size
@@ -131,12 +132,11 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.msg == ' Unsupported operation: Unable to decrease disk size.'
- fail_msg: ' Fail: decreasing the size of the disk that contains the image with SCSI bus type '
- success_msg: ' Success: returned error as expected '
-
+ fail_msg: " Fail: decreasing the size of the disk that contains the image with SCSI bus type "
+ success_msg: " Success: returned error as expected "
- name: Update VM by decreasing the size of the SCSI disk with storage container
ntnx_vms:
@@ -149,13 +149,13 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.msg == ' Unsupported operation: Unable to decrease disk size.'
- fail_msg: ' Fail: decreasing the size of the SCSI disk with storage container '
- success_msg: ' Success: returned error as expected '
+ fail_msg: " Fail: decreasing the size of the SCSI disk with storage container "
+ success_msg: " Success: returned error as expected "
-- name: Update VM by decreasing the size of the empty ide cdrom #error
+- name: Update VM by decreasing the size of the empty ide cdrom # error
ntnx_vms:
vm_uuid: "{{ vm.vm_uuid }}"
disks:
@@ -166,13 +166,13 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.msg == 'Unsupported operation: Cannot resize empty cdrom.'
- result.changed == false
- result.failed == true
- fail_msg: ' Fail: change the size of the empty CDROM'
- success_msg: ' Success: returned error as expected '
+ fail_msg: " Fail: change the size of the empty CDROM"
+ success_msg: " Success: returned error as expected "
- name: Update VM by decreasing the size of the pci disk
ntnx_vms:
@@ -185,11 +185,11 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.msg == ' Unsupported operation: Unable to decrease disk size.'
- fail_msg: ' Fail: decreasing the size of the pci disk'
- success_msg: ' Success: returned error as expected '
+ fail_msg: " Fail: decreasing the size of the pci disk"
+ success_msg: " Success: returned error as expected "
- name: Update VM by decreasing the size of the sata disk
ntnx_vms:
@@ -202,11 +202,11 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.msg == ' Unsupported operation: Unable to decrease disk size.'
- fail_msg: ' Fail: decreasing the size of the sata disk'
- success_msg: ' Success: returned error as expected '
+ fail_msg: " Fail: decreasing the size of the sata disk"
+ success_msg: " Success: returned error as expected "
- name: Update VM by decreasing the size of the SCSI disk
ntnx_vms:
@@ -219,11 +219,11 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.msg == ' Unsupported operation: Unable to decrease disk size.'
- fail_msg: ' Fail: decreasing the size of the SCSI disk'
- success_msg: ' Success: returned error as expected '
+ fail_msg: " Fail: decreasing the size of the SCSI disk"
+ success_msg: " Success: returned error as expected "
- name: Update VM by decreasing the size of the IDE disk
ntnx_vms:
@@ -236,11 +236,11 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.msg == ' Unsupported operation: Unable to decrease disk size.'
- fail_msg: ' Fail: decreasing the size of the IDE disk'
- success_msg: ' Success: returned error as expected '
+ fail_msg: " Fail: decreasing the size of the IDE disk"
+ success_msg: " Success: returned error as expected "
################
- name: Update VM by change the bus type of ide disk
ntnx_vms:
@@ -253,7 +253,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.msg == ' parameters are mutually exclusive: uuid|bus found in disks '
- result.failed == True
@@ -271,13 +271,13 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- - result.failed == True
- - result.changed == false
- - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
- fail_msg: 'Fail : update vm by add ide disk while vm is on '
- success_msg: ' Success: returned error as expected '
+ - result.failed == True
+ - result.changed == false
+ - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
+ fail_msg: "Fail : update vm by add ide disk while vm is on "
+ success_msg: " Success: returned error as expected "
- name: Update VM by adding SATA disk while vm is on
ntnx_vms:
@@ -290,13 +290,13 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- - result.failed == True
- - result.changed == false
- - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
- fail_msg: 'Fail : update vm by add SATA disk while vm is on '
- success_msg: ' Success: returned error as expected '
+ - result.failed == True
+ - result.changed == false
+ - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
+ fail_msg: "Fail : update vm by add SATA disk while vm is on "
+ success_msg: " Success: returned error as expected "
#############
- name: Update VM by removing IDE disks while vm is on
ntnx_vms:
@@ -307,13 +307,13 @@
register: result
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- - result.failed == True
- - result.changed == false
- - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
- fail_msg: 'Fail : update vm by by removing IDE disks while vm is on '
- success_msg: ' Success: returned error as expected '
+ - result.failed == True
+ - result.changed == false
+ - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
+ fail_msg: "Fail : update vm by by removing IDE disks while vm is on "
+ success_msg: " Success: returned error as expected "
- name: Update VM by removing IDE disks while vm is on
ntnx_vms:
@@ -325,13 +325,13 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- - result.failed == True
- - result.changed == false
- - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
- fail_msg: 'Fail : update vm by by removing IDE disks while vm is on '
- success_msg: ' Success: returned error as expected '
+ - result.failed == True
+ - result.changed == false
+ - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
+ fail_msg: "Fail : update vm by by removing IDE disks while vm is on "
+ success_msg: " Success: returned error as expected "
- name: Update VM by removing PCI disks while vm is on
ntnx_vms:
@@ -343,13 +343,13 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- - result.failed == True
- - result.changed == false
- - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
- fail_msg: 'Fail : update vm by by removing PCI disks while vm is on '
- success_msg: ' Success: returned error as expected '
+ - result.failed == True
+ - result.changed == false
+ - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
+ fail_msg: "Fail : update vm by by removing PCI disks while vm is on "
+ success_msg: " Success: returned error as expected "
- name: Update VM by removing SATA disks while vm is on
ntnx_vms:
@@ -361,13 +361,13 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- - result.failed == True
- - result.changed == false
- - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
- fail_msg: 'Fail : update vm by by removing SATA disks while vm is on '
- success_msg: ' Success: returned error as expected '
+ - result.failed == True
+ - result.changed == false
+ - result.msg == "To make these changes, the VM should be restarted, but 'force_power_off' is False"
+ fail_msg: "Fail : update vm by by removing SATA disks while vm is on "
+ success_msg: " Success: returned error as expected "
###########################################################
- name: Delete created vm's
ntnx_vms:
@@ -376,11 +376,12 @@
ignore_errors: true
register: result
-- assert:
+- name: Delete Status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'SUCCEEDED'
- result.vm_uuid
- result.task_uuid
- fail_msg: 'Fail: Unable to delete created vm '
- success_msg: 'Success: Vm deleted sucessfully'
+ fail_msg: "Fail: Unable to delete created vm "
+ success_msg: "Success: Vm deleted sucessfully"
diff --git a/tests/integration/targets/nutanix_vms/tasks/negtaive_scenarios.yml b/tests/integration/targets/nutanix_vms/tasks/negtaive_scenarios.yml
deleted file mode 100644
index 0488155ff..000000000
--- a/tests/integration/targets/nutanix_vms/tasks/negtaive_scenarios.yml
+++ /dev/null
@@ -1,309 +0,0 @@
- - debug:
- msg: "Started Negative Creation Cases"
-
- - name: Unknown project name
- ntnx_vms:
- state: present
- name: Unknown project name
- timezone: "UTC"
- project:
- name: project
- cluster:
- uuid: "{{ cluster.uuid }}"
- disks:
- - type: "DISK"
- size_gb: 10
- clone_image:
- name: "{{ centos }}"
- bus: "SCSI"
- register: result
- ignore_errors: True
-
- - name: Creation Status
- assert:
- that:
- - result.msg == "Failed generating VM Spec"
- - result.failed == True
- - result.failed is defined
- - result.error == "Project project not found."
- success_msg: ' Success: returned error as expected '
-#############################################################
- - name: Check if error is produced when disk size is not given for storage container
- check_mode: yes
- ntnx_vms:
- state: present
- name: VM with storage container
- timezone: GMT
- cluster:
- name: "{{ cluster.name }}"
- categories:
- AppType:
- - Apache_Spark
- disks:
- - type: DISK
- bus: SCSI
- storage_container:
- name: "{{ storage_container.name }}"
- vcpus: 1
- cores_per_vcpu: 1
- memory_gb: 1
- register: result
- ignore_errors: True
-
- - name: Creation Status
- assert:
- that:
- - result.msg == "Unsupported operation: Unable to create disk, 'size_gb' is required for using storage container."
- - result.failed == True
- - result.failed is defined
- success_msg: ' Success: returned error as expected '
-##################################################################################
- - name: Unknown Cluster
- ntnx_vms:
- state: present
- name: Unknown Cluster
- timezone: "UTC"
- cluster:
- uuid: "auto_cluster_1aa888141361"
- disks:
- - type: "DISK"
- size_gb: 10
- clone_image:
- name: "{{ centos }}"
- bus: "SCSI"
- register: result
- ignore_errors: True
-
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.failed == True
- - result.response.state == 'ERROR'
- - result.status_code == 422
- - result.error == "HTTP Error 422: UNPROCESSABLE ENTITY"
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail Vm created successfully with unknown cluster '
-################################################################################
- - name: Unknown Cluster name
- ntnx_vms:
- state: present
- name: Unknown Cluster
- timezone: "UTC"
- cluster:
- name: "auto_cluster"
- disks:
- - type: "DISK"
- size_gb: 10
- clone_image:
- name: "{{ centos }}"
- bus: "SCSI"
- register: result
- ignore_errors: True
-
- - name: Creation Status
- assert:
- that:
- - result.msg == "Failed generating VM Spec"
- - result.failed == True
- - result.response is defined
- - result.error == "Cluster auto_cluster not found."
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail Vm created successfully with unknown cluster '
-###################################################################################
- - name: Unknown Network name
- ntnx_vms:
- state: present
- name: Unknown Network
- desc: "Unknown network"
- categories:
- AppType:
- - "Apache_Spark"
- cluster:
- name: "{{ cluster.name }}"
- networks:
- - is_connected: True
- subnet:
- name: "vlan.8000"
- register: result
- ignore_errors: True
-
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.failed == True
- - result.msg == "Failed generating VM Spec"
- - result.error == "Subnet vlan.8000 not found."
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail VM created successfully with unknown network name '
-###################################################################################
- - name: Unknown Network uuid
- ntnx_vms:
- state: present
- name: Unknown Network
- desc: "Unknown network"
- categories:
- AppType:
- - "Apache_Spark"
- cluster:
- name: "{{ cluster.name }}"
- networks:
- - is_connected: True
- subnet:
- uuid: "8000"
- register: result
- ignore_errors: True
-
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.failed == True
- - result.error == "HTTP Error 422: UNPROCESSABLE ENTITY"
- - result.response.state == 'ERROR'
- - result.status_code == 422
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail VM created successfully with unknown network name '
-###################################################################################
- - name: Unknown Image name
- ntnx_vms:
- state: present
- name: unknown image_vm
- timezone: "UTC"
- cluster:
- name: "{{ cluster.name }}"
- disks:
- - type: "DISK"
- size_gb: 10
- clone_image:
- name: "centos-7-cloudinit"
- bus: "SCSI"
- register: result
- ignore_errors: True
-
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.failed == True
- - result.response.state == 'ERROR'
- - result.status_code == 422
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail VM created successfully with not existed image '
-########################################################################################
- - name: Wrong disk size value
- ntnx_vms:
- state: present
- name: "Wrong disk size value"
- timezone: "UTC"
- cluster:
- name: "{{ cluster.name }}"
- networks:
- - is_connected: True
- subnet:
- name: "{{ network.dhcp.name }}"
- disks:
- - type: "DISK"
- size_gb: 10g
- bus: "PCI"
- register: result
- ignore_errors: True
-
- - name: Creation Status
- assert:
- that:
- - result.failed == True
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail VM created successfully with invalid argument for size_gb '
-#############################################################################################
- - name: Image size less than actual
- ntnx_vms:
- state: present
- name: "image size less than actual"
- categories:
- AppType:
- - "Apache_Spark"
- cluster:
- name: "{{ cluster.name }}"
- networks:
- - is_connected: True
- subnet:
- name: "{{ network.dhcp.name }}"
- disks:
- - type: "DISK"
- size_gb: 2 #must be 20
- bus: "SATA"
- clone_image:
- name: "{{ centos }}"
- vcpus: 1
- cores_per_vcpu: 1
- memory_gb: 1
- guest_customization:
- type: "cloud_init"
- script_path: "cloud_init.yml"
- is_overridable: True
- register: result
- ignore_errors: True
-
-
-
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.failed == True
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail: VM created successfully with image size is less than actual '
-#################################################################################
- - name: Unknown storage container name
- ntnx_vms:
- state: present
- name: unknown storage container
- timezone: "UTC"
- cluster:
- name: "{{ cluster.name }}"
- disks:
- - type: "DISK"
- size_gb: 10
- storage_container:
- name: "storage"
- bus: "SCSI"
- register: result
- ignore_errors: True
-
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.failed == True
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail VM created successfully with unknown storage container name '
-#################################################################################
- - name: Delete vm with unknown uuid
- ntnx_vms:
- state: absent
- vm_uuid: 5
- register: result
- ignore_errors: True
-
- - name: Creation Status
- assert:
- that:
- - result.response is defined
- - result.failed == True
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail deleting VM with unknown uuid '
-#################################################################################
- - name: Delete vm with missing uuid
- ntnx_vms:
- state: absent
- register: result
- ignore_errors: True
-
- - name: Creation Status
- assert:
- that:
- - result.failed == True
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail deleting VM with missing uuid '
diff --git a/tests/integration/targets/nutanix_vms/tasks/vm_operations.yml b/tests/integration/targets/nutanix_vms/tasks/vm_operations.yml
index de2a1304a..77161b5e1 100644
--- a/tests/integration/targets/nutanix_vms/tasks/vm_operations.yml
+++ b/tests/integration/targets/nutanix_vms/tasks/vm_operations.yml
@@ -1,105 +1,107 @@
-- debug:
+- name: Start testing VM with different operations
+ ansible.builtin.debug:
msg: Start testing VM with different operations
-- set_fact:
- todelete: []
+- name: Reset todelete list
+ ansible.builtin.set_fact:
+ todelete: []
- name: VM with minimum requirements
ntnx_vms:
- state: present
- name: integration_test_opperations_vm
- cluster:
- name: "{{ cluster.name }}"
- disks:
- - type: "DISK"
- clone_image:
- name: "{{ ubuntu }}"
- bus: "SCSI"
- size_gb: 20
+ state: present
+ name: integration_test_opperations_vm
+ cluster:
+ name: "{{ cluster.name }}"
+ disks:
+ - type: "DISK"
+ clone_image:
+ name: "{{ ubuntu }}"
+ bus: "SCSI"
+ size_gb: 20
register: vm
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- vm.response is defined
- vm.response.status.state == 'COMPLETE'
- fail_msg: ' Unable to create VM with minimum requirements '
- success_msg: ' VM with minimum requirements created successfully '
+ fail_msg: " Unable to create VM with minimum requirements "
+ success_msg: " VM with minimum requirements created successfully "
############################################
- name: VM with minimum requirements with check mode
ntnx_vms:
- state: present
- name: integration_test_opperations_vm
- cluster:
- name: "{{ cluster.name }}"
- disks:
- - type: "DISK"
- clone_image:
- name: "{{ ubuntu }}"
- bus: "SCSI"
- size_gb: 20
+ state: present
+ name: integration_test_opperations_vm
+ cluster:
+ name: "{{ cluster.name }}"
+ disks:
+ - type: "DISK"
+ clone_image:
+ name: "{{ ubuntu }}"
+ bus: "SCSI"
+ size_gb: 20
register: result
ignore_errors: true
- check_mode: yes
+ check_mode: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.changed == false
- result.failed == false
- result.task_uuid != ""
- success_msg: ' Success: returned as expected '
- fail_msg: ' Fail '
+ success_msg: " Success: returned as expected "
+ fail_msg: " Fail "
###########################################
-- name: hard power off the vm
+- name: Hard power off the vm
ntnx_vms:
- vm_uuid: "{{ vm.vm_uuid }}"
- state: hard_poweroff
+ vm_uuid: "{{ vm.vm_uuid }}"
+ state: hard_poweroff
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- result.response.status.resources.power_state == 'OFF'
- fail_msg: ' Unable to hard power off the vm '
- success_msg: ' VM powerd off successfully '
+ fail_msg: " Unable to hard power off the vm "
+ success_msg: " VM powerd off successfully "
# ###########################################
-- name: power on the vm
+- name: Power on the vm
ntnx_vms:
- state: power_on
- vm_uuid: "{{ vm.vm_uuid }}"
+ state: power_on
+ vm_uuid: "{{ vm.vm_uuid }}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- result.response.status.resources.power_state == 'ON'
- fail_msg: ' Unable to power on vm '
- success_msg: ' VM powerd on successfully '
+ fail_msg: " Unable to power on vm "
+ success_msg: " VM powerd on successfully "
##########################################
-- name: power on the vm while it's on
+- name: Power on the vm while it's on
ntnx_vms:
- state: power_on
- vm_uuid: "{{ vm.vm_uuid }}"
+ state: power_on
+ vm_uuid: "{{ vm.vm_uuid }}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.msg == "Nothing to change"
- success_msg: ' Success: returned msg as expected '
- fail_msg: ' Fail '
+ success_msg: " Success: returned msg as expected "
+ fail_msg: " Fail "
##########################################
-# - name: soft shut down the vm
+# - name: Soft shut down the vm
# ntnx_vms:
# state: soft_shutdown
# vm_uuid: "{{ vm.vm_uuid }}"
@@ -108,7 +110,7 @@
# ignore_errors: true
# - name: Creation Status
-# assert:
+# ansible.builtin.assert:
# that:
# - result.response is defined
# - result.response.status.state == 'COMPLETE'
@@ -133,7 +135,7 @@
# ignore_errors: true
# - name: Creation Status
-# assert:
+# ansible.builtin.assert:
# that:
# - result.response is defined
# - result.response.status.state == 'COMPLETE'
@@ -142,65 +144,68 @@
# fail_msg: ' Unable to create VM with minimum requirements and soft_shutdown '
# success_msg: ' VM with minimum requirements created successfully and soft_shutdown '
-# - set_fact:
+# - ansible.builtin.set_fact:
# todelete: '{{ todelete + [ result["response"]["metadata"]["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 }}"
+ state: hard_poweroff
+ name: integration_test_opperations_vm
+ cluster:
+ name: "{{ cluster.name }}"
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- result.response.status.resources.power_state == 'OFF'
- result.response.status.resources.power_state_mechanism.mechanism == 'HARD'
- fail_msg: ' Unable to create VM with minimum requirements with hard_poweroff operation '
- success_msg: ' VM with minimum requirements and hard_poweroff state created successfully '
+ fail_msg: " Unable to create VM with minimum requirements with hard_poweroff operation "
+ success_msg: " VM with minimum requirements and hard_poweroff state created successfully "
-- set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+- name: Add VM to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
- name: Create VM with minimum requirements with hard_poweroff operation without wait
ntnx_vms:
- state: hard_poweroff
- name: integration_test_opperations_vm_111
- cluster:
- name: "{{ cluster.name }}"
- wait: false
+ state: hard_poweroff
+ name: integration_test_opperations_vm_111
+ cluster:
+ name: "{{ cluster.name }}"
+ wait: false
register: result
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE' or result.response.status.state == 'PENDING'
- result.vm_uuid
- result.task_uuid
- fail_msg: ' Unable to create VM with minimum requirements with hard_poweroff operation '
- success_msg: ' VM with minimum requirements and hard_poweroff state created successfully '
+ fail_msg: " Unable to create VM with minimum requirements with hard_poweroff operation "
+ success_msg: " VM with minimum requirements and hard_poweroff state created successfully "
-- set_fact:
- todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
+- name: Add VM to todelete list
+ ansible.builtin.set_fact:
+ todelete: '{{ todelete + [ result["response"]["metadata"]["uuid"] ] }}'
when: result.response.status.state == 'COMPLETE'
- name: Delete all Created VMs
ntnx_vms:
- state: absent
- vm_uuid: '{{ item }}'
- loop: '{{ todelete }}'
+ state: absent
+ vm_uuid: "{{ item }}"
+ loop: "{{ todelete }}"
- name: Delete all Created VMs
ntnx_vms:
- state: absent
- vm_uuid: '{{ vm.vm_uuid }}'
+ state: absent
+ vm_uuid: "{{ vm.vm_uuid }}"
-- set_fact:
- todelete: []
+- name: Reset todelete list
+ ansible.builtin.set_fact:
+ todelete: []
diff --git a/tests/integration/targets/nutanix_vms/tasks/vm_update.yml b/tests/integration/targets/nutanix_vms/tasks/vm_update.yml
index 86fed5585..ff0065592 100644
--- a/tests/integration/targets/nutanix_vms/tasks/vm_update.yml
+++ b/tests/integration/targets/nutanix_vms/tasks/vm_update.yml
@@ -1,9 +1,9 @@
# ########################### UPDATE_VM ################################
-- name: create VM with minimum requirements to update
+- name: Create VM with minimum requirements to update
ntnx_vms:
state: present
- name: update vm
+ name: Update vm
cluster:
name: "{{ cluster.name }}"
categories:
@@ -17,7 +17,7 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -26,7 +26,7 @@
fail_msg: " Unable to create VM with minimum requirements "
success_msg: " VM with minimum requirements created successfully "
####################################################################
-- name: update vm by set owner by uuid
+- name: Update vm by set owner by uuid
ntnx_vms:
vm_uuid: "{{ result.vm_uuid }}"
owner:
@@ -35,7 +35,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -48,10 +48,11 @@
success_msg: " VM updated successfully by setting owner "
####################################################################
-- debug:
+- name: Start update tests for memory vcpus cores_per_vcpu
+ ansible.builtin.debug:
msg: Start update tests for memory vcpus cores_per_vcpu
-- name: decrease values for memory, vcpus and corespervcpu with force_power_off
+- name: Decrease values for memory, vcpus and corespervcpu with force_power_off
ntnx_vms:
vm_uuid: "{{ result.vm_uuid }}"
vcpus: 2
@@ -63,7 +64,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -72,7 +73,7 @@
fail_msg: " Unable to update vm by decrease the values for memory, vcpus and corespervcpu with force_power_off "
success_msg: " VM updated successfully by decrease the values for memory, vcpus and corespervcpu with force_power_off "
-- name: increase values for memory, vcpus and corespervcpu
+- name: Increase values for memory, vcpus and corespervcpu
ntnx_vms:
vm_uuid: "{{ result.vm_uuid }}"
vcpus: 4
@@ -81,7 +82,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -90,7 +91,7 @@
fail_msg: " Unable to update vm by increase values for memory, vcpus "
success_msg: " VM updated successfully by increase values for memory, vcpus "
-- name: increase values for corespervcpu with force_power_off
+- name: Increase values for corespervcpu with force_power_off
ntnx_vms:
vm_uuid: "{{ result.vm_uuid }}"
cores_per_vcpu: 4
@@ -99,7 +100,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -109,10 +110,11 @@
success_msg: " VM updated successfully by increase values for corespervcpu with force_power_off "
####################################################################
-- debug:
+- name: Start update tests for vm categories
+ ansible.builtin.debug:
msg: Start update tests for vm categories
-- name: update categories
+- name: Update categories
ntnx_vms:
vm_uuid: "{{ result.vm_uuid }}"
categories:
@@ -124,7 +126,7 @@
ignore_errors: true
- name: Assert categories Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -135,7 +137,7 @@
fail_msg: " Unable to update categories attached to vm"
success_msg: " VM categories updated successfully "
-- name: remove all categories attached to vm
+- name: Remove all categories attached to vm
ntnx_vms:
vm_uuid: "{{ result.vm_uuid }}"
remove_categories: true
@@ -143,7 +145,7 @@
ignore_errors: true
- name: Assert categories Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -154,7 +156,8 @@
success_msg: " All VM categories removed successfully "
###################################################################
-- debug:
+- name: Start update tests for disks
+ ansible.builtin.debug:
msg: Start update tests for disks
##### CRUD operation for SCSI disks
- name: Update VM by adding SCSI disks
@@ -178,7 +181,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -204,7 +207,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -227,7 +230,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -248,7 +251,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -268,7 +271,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -288,7 +291,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -306,13 +309,13 @@
size_gb: 1
- type: "CDROM"
bus: "IDE"
- empty_cdrom: True
+ empty_cdrom: true
force_power_off: true
register: result
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -333,7 +336,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -348,11 +351,13 @@
vars:
query: "[?device_properties.device_type == 'CDROM'].uuid"
ignore_errors: true
+ register: result1
- name: Get number of disks attached to VM
ansible.builtin.set_fact:
disk_count: "{{ result.response.spec.resources.disk_list | length }}"
ignore_errors: true
+ register: result2
- name: Update VM by cloning image into CD ROM
ntnx_vms:
@@ -401,7 +406,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -423,7 +428,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -444,7 +449,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -464,7 +469,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -474,7 +479,8 @@
success_msg: " VM updated successfully by removing SATA disks with force_power_off "
# ####################################################################
-- debug:
+- name: Start update tests for network
+ ansible.builtin.debug:
msg: Start update tests for network
- name: Update VM by adding subnets
@@ -492,7 +498,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -514,7 +520,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.vm_uuid
@@ -536,7 +542,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -562,7 +568,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -583,7 +589,7 @@
ignore_errors: true
- name: Update Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
@@ -591,7 +597,6 @@
- result.task_uuid
fail_msg: " Unable to update vm by deleting a subnet "
success_msg: " VM updated successfully by deleting a subnet "
-
# ####################################################################
- name: Update VM by deleting it
@@ -601,7 +606,8 @@
register: result
ignore_errors: true
-- assert:
+- name: Update Status
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status == 'SUCCEEDED'
diff --git a/tests/integration/targets/nutanix_vms_info/tasks/list_vms.yml b/tests/integration/targets/nutanix_vms_info/tasks/list_vms.yml
index 05b029742..726707f91 100644
--- a/tests/integration/targets/nutanix_vms_info/tasks/list_vms.yml
+++ b/tests/integration/targets/nutanix_vms_info/tasks/list_vms.yml
@@ -1,4 +1,5 @@
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
- name: Creat another VM with same name
@@ -11,14 +12,15 @@
ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- output.response is defined
- output.response.status.state == 'COMPLETE'
fail_msg: ' Unable to create VM with minimum requirements '
success_msg: ' VM with minimum requirements created successfully '
-- set_fact:
+- name: Add VM to todelete list
+ ansible.builtin.set_fact:
todelete: '{{ todelete + [ output["response"]["metadata"]["uuid"] ] }}'
when: output.response.status.state == 'COMPLETE'
##################################################
@@ -26,10 +28,10 @@
ntnx_vms_info:
filter_string: vm_name=={{vm.name}};power_state==off
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.entities[0].metadata.uuid == '{{output["response"]["metadata"]["uuid"]}}'
@@ -44,11 +46,10 @@
vm_name: "{{ vm.name }}"
power_state: "on"
register: result
- ignore_errors: True
-
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list vms "
@@ -60,10 +61,10 @@
offset: 1
register: result
check_mode: true
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list vms "
@@ -75,10 +76,10 @@
sort_attribute: "vm_name"
kind: vm
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list vms "
@@ -87,8 +88,9 @@
- name: Delete all Created VMs
ntnx_vms:
state: absent
- vm_uuid: '{{ item }}'
+ vm_uuid: "{{ item }}"
register: result
- loop: '{{ todelete }}'
-- set_fact:
+ loop: "{{ todelete }}"
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
diff --git a/tests/integration/targets/nutanix_vms_info/tasks/main.yml b/tests/integration/targets/nutanix_vms_info/tasks/main.yml
index 0e35d7fb5..12999c95f 100644
--- a/tests/integration/targets/nutanix_vms_info/tasks/main.yml
+++ b/tests/integration/targets/nutanix_vms_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "list_vms.yml"
+ - name: Import "list_vms.yml"
+ ansible.builtin.import_tasks: "list_vms.yml"
diff --git a/tests/integration/targets/nutanix_vpcs/tasks/create_vpcs.yml b/tests/integration/targets/nutanix_vpcs/tasks/create_vpcs.yml
index 3cc3113d4..e13a67bff 100644
--- a/tests/integration/targets/nutanix_vpcs/tasks/create_vpcs.yml
+++ b/tests/integration/targets/nutanix_vpcs/tasks/create_vpcs.yml
@@ -1,13 +1,13 @@
- name: Create min VPC with subnet name
ntnx_vpcs:
state: present
- wait: True
+ wait: true
name: MinVPC
external_subnets:
- subnet_name: "{{ external_nat_subnet.name }}"
register: result
check_mode: true
- ignore_errors: True
+ ignore_errors: true
##########################################################
- name: Create min VPC with external_nat_subnet uuid
ntnx_vpcs:
@@ -18,17 +18,18 @@
- subnet_uuid: "{{ external_nat_subnet.uuid }}"
check_mode: false
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create Min vpc with external subnet uuid "
success_msg: " Min vpc with external subnet uuid created successfully "
-- set_fact:
+- name: Add VPC to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.vpc_uuid ] }}"
##########################################################
- name: Delete all created vpcs
@@ -37,9 +38,10 @@
vpc_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
##########################################################
- name: Create VPC with routable_ips
@@ -48,19 +50,20 @@
name: vpc_with_routable_ips
routable_ips:
- network_ip: "{{ routable_ips.network_ip }}"
- network_prefix: "{{ routable_ips.network_prefix }}"
+ network_prefix: "{{ routable_ips.network_prefix }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create vpc with routable_ips "
success_msg: " VPC with routable ips created successfully "
-- set_fact:
+- name: Add VPC to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.vpc_uuid ] }}"
##########################################################
- name: Create VPC with routable_ips and external subnet
@@ -71,19 +74,20 @@
- subnet_name: "{{ external_nat_subnet.name }}"
routable_ips:
- network_ip: "{{ routable_ips.network_ip_2 }}"
- network_prefix: "{{ routable_ips.network_prefix_2 }}"
+ network_prefix: "{{ routable_ips.network_prefix_2 }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create vpc with routable_ips and external subnet "
success_msg: " VPC with routable ips and external subnet created successfully "
-- set_fact:
+- name: Add VPC to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.vpc_uuid ] }}"
##########################################################
- name: Create VPC with dns_servers
@@ -93,10 +97,10 @@
dns_servers: "{{ dns_servers }}"
wait: false
register: result
- ignore_errors: True
-
+ ignore_errors: true
-- set_fact:
+- name: Add VPC to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.vpc_uuid ] }}"
##########################################################
- name: Delete all created vpcs
@@ -105,9 +109,10 @@
vpc_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
-- set_fact:
+- name: Reset todelete list
+ ansible.builtin.set_fact:
todelete: []
##########################################################
- name: Create VPC with all specfactions
@@ -119,19 +124,20 @@
dns_servers: "{{ dns_servers }}"
routable_ips:
- network_ip: "{{ routable_ips.network_ip }}"
- network_prefix: "{{ routable_ips.network_prefix }}"
+ network_prefix: "{{ routable_ips.network_prefix }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create vpc all specfactions "
success_msg: " VPC with all specfactions created successfully "
-- set_fact:
+- name: Add VPC to todelete list
+ ansible.builtin.set_fact:
todelete: "{{ todelete + [ result.vpc_uuid ] }}"
##########################################################
- name: Delete all created vpcs
@@ -140,4 +146,4 @@
vpc_uuid: "{{ item }}"
register: result
loop: "{{ todelete }}"
- ignore_errors: True
+ ignore_errors: true
diff --git a/tests/integration/targets/nutanix_vpcs/tasks/delete_vpc.yml b/tests/integration/targets/nutanix_vpcs/tasks/delete_vpc.yml
index 7d0339fa6..1e4fd3926 100644
--- a/tests/integration/targets/nutanix_vpcs/tasks/delete_vpc.yml
+++ b/tests/integration/targets/nutanix_vpcs/tasks/delete_vpc.yml
@@ -2,25 +2,24 @@
- name: Create VPC with all specfactions
ntnx_vpcs:
state: present
- name: vpc_with_add_specfactions
+ name: Vpc_with_add_specfactions
external_subnets:
- subnet_name: "{{ external_nat_subnet.name }}"
dns_servers: "{{ dns_servers }}"
routable_ips:
- network_ip: "{{ routable_ips.network_ip }}"
- network_prefix: "{{ routable_ips.network_prefix }}"
+ network_prefix: "{{ routable_ips.network_prefix }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Creation Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
fail_msg: " Unable to create vpc all specfactions "
success_msg: " VPC with all specfactions created successfully "
-
- name: Delete vpc
ntnx_vpcs:
state: absent
diff --git a/tests/integration/targets/nutanix_vpcs/tasks/main.yml b/tests/integration/targets/nutanix_vpcs/tasks/main.yml
index d113348a4..7015a63cb 100644
--- a/tests/integration/targets/nutanix_vpcs/tasks/main.yml
+++ b/tests/integration/targets/nutanix_vpcs/tasks/main.yml
@@ -1,11 +1,15 @@
---
-- module_defaults:
- group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+- name: Set module defaults
+ module_defaults:
+ group/nutanix.ncp.ntnx:
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "create_vpcs.yml"
- - import_tasks: "delete_vpc.yml"
- - import_tasks: "negative_scenarios.yml"
+ - name: Import create_vpcs.yml
+ ansible.builtin.import_tasks: "create_vpcs.yml"
+ - name: Import delete_vpc.yml
+ ansible.builtin.import_tasks: "delete_vpc.yml"
+ - name: Import negative_scenarios.yml
+ ansible.builtin.import_tasks: "negative_scenarios.yml"
diff --git a/tests/integration/targets/nutanix_vpcs/tasks/negative_scenarios.yml b/tests/integration/targets/nutanix_vpcs/tasks/negative_scenarios.yml
index 9f40bbf94..5733453bd 100644
--- a/tests/integration/targets/nutanix_vpcs/tasks/negative_scenarios.yml
+++ b/tests/integration/targets/nutanix_vpcs/tasks/negative_scenarios.yml
@@ -1,80 +1,81 @@
- - debug:
- msg: "Started Negative Creation Cases"
+- name: Start Negative Testing
+ ansible.builtin.debug:
+ msg: "Started Negative Creation Cases"
- - name: Unknown subnet name
- ntnx_vpcs:
- state: present
- name: MinVPC
- external_subnets:
- - subnet_name: "ET_90"
- register: result
- ignore_errors: True
- - name: Creation Status
- assert:
- that:
- - result.failed==True
- - result.msg=="Failed generating vpc spec"
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail VPC created successfully with unknown subnet name '
+- name: Unknown subnet name
+ ntnx_vpcs:
+ state: present
+ name: MinVPC
+ external_subnets:
+ - subnet_name: "ET_90"
+ register: result
+ ignore_errors: true
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.failed==True
+ - result.msg=="Failed generating vpc spec"
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail VPC created successfully with unknown subnet name "
#######################################################
- - name: Unknown subnet uuid
- ntnx_vpcs:
- state: present
- name: MinVPC
- external_subnets:
- - subnet_uuid: 57959f75-6b21-431c-b76b-516447d52622
- register: result
- ignore_errors: True
- - name: Creation Status
- assert:
- that:
- - result.failed==True
- - result.status_code=="500"
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail VPC created successfully with unknown subnet name '
+- name: Unknown subnet uuid
+ ntnx_vpcs:
+ state: present
+ name: MinVPC
+ external_subnets:
+ - subnet_uuid: 57959f75-6b21-431c-b76b-516447d52622
+ register: result
+ ignore_errors: true
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.failed==True
+ - result.status_code=="500"
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail VPC created successfully with unknown subnet name "
#######################################################
- - name: Create VPC with same routable_ips
- ntnx_vpcs:
- state: present
- name: vpc_with_routable_ips
- routable_ips:
- - network_ip: 192.168.0.1
- network_prefix: 24
- - network_ip: 192.168.0.1
- network_prefix: 24
- register: result
- ignore_errors: True
+- name: Create VPC with same routable_ips
+ ntnx_vpcs:
+ state: present
+ name: vpc_with_routable_ips
+ routable_ips:
+ - network_ip: 192.168.0.1
+ network_prefix: 24
+ - network_ip: 192.168.0.1
+ network_prefix: 24
+ register: result
+ ignore_errors: true
- - name: Creation Status
- assert:
- that:
- - result.failed==True
- - result.status_code=="500"
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail VPC created successfully with unknown subnet name '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.failed==True
+ - result.status_code=="500"
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail VPC created successfully with unknown subnet name "
#######################################################
- - name: Delete vpc with unknown uuid
- ntnx_vpcs:
- state: absent
- vpc_uuid: 5
- ignore_errors: True
- register: result
- - name: Creation Status
- assert:
- that:
- - result.status_code==400
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail deleting vpc with unknown uuid '
+- name: Delete vpc with unknown uuid
+ ntnx_vpcs:
+ state: absent
+ vpc_uuid: 5
+ ignore_errors: true
+ register: result
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.status_code==400
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail deleting vpc with unknown uuid "
#######################################################
- - name: Delete vpc with missing uuid
- ntnx_vpcs:
- state: absent
- ignore_errors: True
- register: result
+- name: Delete vpc with missing uuid
+ ntnx_vpcs:
+ state: absent
+ ignore_errors: true
+ register: result
- - name: Creation Status
- assert:
- that:
- - result.failed==True
- success_msg: ' Success: returned error as expected '
- fail_msg: ' Fail deleting vpc with missing uuid '
+- name: Creation Status
+ ansible.builtin.assert:
+ that:
+ - result.failed==True
+ success_msg: " Success: returned error as expected "
+ fail_msg: " Fail deleting vpc with missing uuid "
diff --git a/tests/integration/targets/nutanix_vpcs_info/tasks/list_vpcs.yml b/tests/integration/targets/nutanix_vpcs_info/tasks/list_vpcs.yml
index f21cb3ec2..539f04602 100644
--- a/tests/integration/targets/nutanix_vpcs_info/tasks/list_vpcs.yml
+++ b/tests/integration/targets/nutanix_vpcs_info/tasks/list_vpcs.yml
@@ -3,10 +3,10 @@
filter:
name: "{{ vpc.name }}"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list vpcs "
@@ -18,10 +18,10 @@
offset: 1
check_mode: true
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list vpcs "
@@ -32,10 +32,10 @@
sort_order: "DESCENDING"
sort_attribute: "name"
register: result
- ignore_errors: True
+ ignore_errors: true
- name: Listing Status
- assert:
+ ansible.builtin.assert:
that:
- result.response is defined
fail_msg: " Unable to list vpcs "
diff --git a/tests/integration/targets/nutanix_vpcs_info/tasks/main.yml b/tests/integration/targets/nutanix_vpcs_info/tasks/main.yml
index 549edc380..69ea1ebe2 100644
--- a/tests/integration/targets/nutanix_vpcs_info/tasks/main.yml
+++ b/tests/integration/targets/nutanix_vpcs_info/tasks/main.yml
@@ -1,9 +1,11 @@
---
-- module_defaults:
+- name: Set module defaults
+ module_defaults:
group/nutanix.ncp.ntnx:
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: "{{ validate_certs }}"
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
block:
- - import_tasks: "list_vpcs.yml"
+ - name: Import "list_vpcs.yml"
+ ansible.builtin.import_tasks: "list_vpcs.yml"
diff --git a/tests/integration/targets/prepare_env/playbooks/cleanup.yml b/tests/integration/targets/prepare_env/playbooks/cleanup.yml
new file mode 100644
index 000000000..4c4948760
--- /dev/null
+++ b/tests/integration/targets/prepare_env/playbooks/cleanup.yml
@@ -0,0 +1,67 @@
+---
+- name: Clean up the environment
+ hosts: localhost
+ gather_facts: false
+ tasks:
+ - name: Include var file
+ ansible.builtin.include_vars: ../vars/main.yml
+ - name: Delete VM
+ ignore_errors: true
+ register: result
+ nutanix.ncp.ntnx_vms:
+ vm_uuid: "{{vm.uuid }}"
+ state: absent
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: false
+ # # - name: Delete DR VM
+ # # ntnx_vms:
+ # # vm_uuid: '{{dr_vm.uuid }}'
+ # # state: absent
+ # # nutanix_host: "{{ ip }}"
+ # # nutanix_username: "{{ username }}"
+ # # nutanix_password: "{{ password }}"
+ # # validate_certs: false
+ - name: Delete overlay
+ ignore_errors: true
+ register: result
+ nutanix.ncp.ntnx_subnets:
+ state: absent
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: false
+ subnet_uuid: "{{item }}"
+ loop:
+ - "{{overlay.uuid}}"
+ - name: Delete vpc
+ ignore_errors: true
+ register: result
+ nutanix.ncp.ntnx_vpcs:
+ state: absent
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: false
+ vpc_uuid: "{{ vpc.uuid }}"
+ - name: Delete subnets
+ ignore_errors: true
+ register: result
+ nutanix.ncp.ntnx_subnets:
+ state: absent
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: false
+ subnet_uuid: "{{item }}"
+ loop:
+ - "{{external_nat_subnet.uuid}}"
+ - "{{static.uuid}}"
+
+ - name: Delete downloaded disk file
+ ignore_errors: true
+ register: result
+ ansible.builtin.file:
+ path: "{{ disk_image.dest }}"
+ state: absent
diff --git a/tests/integration/targets/prepare_env/playbooks/prepare_env.yml b/tests/integration/targets/prepare_env/playbooks/prepare_env.yml
new file mode 100644
index 000000000..eee3dde31
--- /dev/null
+++ b/tests/integration/targets/prepare_env/playbooks/prepare_env.yml
@@ -0,0 +1,213 @@
+---
+- name: Prepare the environment
+ hosts: localhost
+ gather_facts: false
+ tasks:
+ - name: Include var file
+ ansible.builtin.include_vars: ../vars/main.yml
+ - name: Set facts
+ ansible.builtin.set_fact:
+ ip: "{{lookup('env', 'NUTANIX_HOST') }}"
+ username: "{{lookup('env', 'NUTANIX_USERNAME') }}"
+ password: "{{lookup('env', 'NUTANIX_PASSWORD') }}"
+ recovery_site_ip: "{{lookup('env', 'NUTANIX_DR_SITE')}}"
+ validate_certs: false
+ - name: Insert credentials block to vars
+ ansible.builtin.blockinfile:
+ path: ../vars/main.yml
+ marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 0"
+ block: |
+ ip: "{{lookup('env', 'NUTANIX_HOST') }}"
+ username: "{{lookup('env', 'NUTANIX_USERNAME') }}"
+ password: "{{lookup('env', 'NUTANIX_PASSWORD') }}"
+ recovery_site_ip: "{{lookup('env', 'NUTANIX_DR_SITE') }}"
+ validate_certs: false
+ - name: Create external subnet with NAT
+ nutanix.ncp.ntnx_subnets:
+ state: present
+ nutanix_host: "{{ ip }}"
+ validate_certs: false
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ name: "{{external_nat_subnets.name}}"
+ external_subnet:
+ vlan_id: "{{external_nat_subnets.vlan_id}}"
+ enable_nat: true
+ cluster:
+ name: "{{ cluster.name }}"
+ ipam:
+ network_ip: "{{ external_nat_subnets.network_ip }}"
+ network_prefix: "{{ external_nat_subnets.network_prefix }}"
+ gateway_ip: "{{ external_nat_subnets.gateway_ip_address }}"
+ ip_pools:
+ - start_ip: "{{ external_nat_subnets.dhcp.start_address }}"
+ end_ip: "{{ external_nat_subnets.dhcp.end_address }}"
+ register: result
+ - name: Insert external subnet configuration block to vars
+ ansible.builtin.blockinfile:
+ path: ../vars/main.yml
+ marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 1"
+ block: |
+ external_nat_subnet:
+ name: "{{external_nat_subnets.name}}"
+ uuid: "{{result.subnet_uuid}}"
+
+ - name: Create min VPC with external_subnet uuid
+ nutanix.ncp.ntnx_vpcs:
+ validate_certs: false
+ state: present
+ wait: true
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ name: "{{vpc_name}}"
+ external_subnets:
+ - subnet_uuid: "{{ result.subnet_uuid }}"
+ register: result
+
+ - name: Insert VPC configuration block to vars
+ ansible.builtin.blockinfile:
+ path: ../vars/main.yml
+ marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 2"
+ block: |
+ vpc:
+ name: "{{vpc_name}}"
+ uuid: "{{result.vpc_uuid}}"
+
+ - name: Create vlan subnet with IPAM
+ nutanix.ncp.ntnx_subnets:
+ state: present
+ nutanix_host: "{{ ip }}"
+ wait: true
+ validate_certs: false
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ name: "{{static_subnet_name}}"
+ vlan_subnet:
+ vlan_id: 373
+ virtual_switch:
+ name: Vs0
+ cluster:
+ name: "{{ cluster.name }}"
+ ipam:
+ network_ip: 10.30.30.0
+ network_prefix: 24
+ gateway_ip: 10.30.30.254
+ ip_pools:
+ - start_ip: 10.30.30.10
+ end_ip: 10.30.30.90
+ register: result
+
+ - name: Insert vlan subnet configuration block to var file
+ ansible.builtin.blockinfile:
+ path: ../vars/main.yml
+ marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 3"
+ block: |
+ static:
+ name: "{{static_subnet_name}}"
+ uuid: "{{result.subnet_uuid}}"
+ network_ip: 10.30.30.0
+ network_prefix: 24
+ gateway_ip: 10.30.30.254
+
+ - name: Include var file
+ ansible.builtin.include_vars: ../vars/main.yml
+ - name: Create overlay Subnet with minimum requirements
+ nutanix.ncp.ntnx_subnets:
+ state: present
+ nutanix_host: "{{ ip }}"
+ validate_certs: false
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ name: "{{overlay_subnet.name}}"
+ overlay_subnet:
+ vpc:
+ uuid: "{{ vpc.uuid }}"
+ ipam:
+ network_ip: "{{overlay_subnet.network_ip}}"
+ network_prefix: "{{overlay_subnet.network_prefix}}"
+ gateway_ip: "{{overlay_subnet.gateway_ip}}"
+ register: result
+
+ - name: Insert overlay subnet configuration block to var file
+ ansible.builtin.blockinfile:
+ path: ../vars/main.yml
+ marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 4"
+ block: |
+ overlay:
+ name: "{{overlay_subnet.name}}"
+ uuid: "{{result.subnet_uuid}}"
+
+ - name: Create VM with overlay subnet
+ nutanix.ncp.ntnx_vms:
+ state: present
+ nutanix_host: "{{ ip }}"
+ nutanix_username: "{{ username }}"
+ nutanix_password: "{{ password }}"
+ validate_certs: false
+ name: "{{vm_name}}"
+ cluster:
+ uuid: "{{ cluster.uuid }}"
+ networks:
+ - is_connected: true
+ subnet:
+ name: "{{overlay_subnet.name}}"
+ private_ip: "{{overlay_subnet.private_ip}}"
+ register: result
+
+ - name: Insert vm configuration block to var file
+ ansible.builtin.blockinfile:
+ path: ../vars/main.yml
+ marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 5"
+ block: |
+ vm:
+ name: "{{vm_name}}"
+ uuid: "{{result.vm_uuid}}"
+
+ # # - name: Create VM with static subnet for dr tests
+ # # nutanix.ncp.ntnx_vms:
+ # # state: present
+ # # nutanix_host: "{{ ip }}"
+ # # nutanix_username: "{{ username }}"
+ # # nutanix_password: "{{ password }}"
+ # # validate_certs: false
+ # # name: "{{dr_vm_name}}"
+ # # categories:
+ # # Environment:
+ # # - Staging
+ # # - Testing
+ # # cluster:
+ # # uuid: "{{ cluster.uuid }}"
+ # # networks:
+ # # - is_connected: true
+ # # subnet:
+ # # name: "{{static_subnet_name}}"
+ # # vcpus: 1
+ # # cores_per_vcpu: 1
+ # # memory_gb: 1
+ # # register: result
+
+ # # - name: Insert vm configuration block to var file
+ # # ansible.builtin.blockinfile:
+ # # path: ../vars/main.yml
+ # # marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 6"
+ # # block: |
+ # # dr_vm:
+ # # name: "{{dr_vm_name}}"
+ # # uuid: "{{result.vm_uuid}}"
+
+ - name: Downloading disk image for image related tests
+ ansible.builtin.get_url:
+ mode: "0644"
+ url: "{{ disk_image.url }}"
+ dest: "{{ disk_image.dest }}"
+
+ # - name: Create address group for network security policy related tests
+ # nutanix.ncp.ntnx_address_groups:
+ # state: present
+ # name: Dest
+ # desc: dest
+ # subnets:
+ # - network_ip: "10.1.1.0"
+ # network_prefix: 24
+ # ignore_errors: true
diff --git a/tests/integration/targets/prepare_env/tasks/cleanup.yml b/tests/integration/targets/prepare_env/tasks/cleanup.yml
deleted file mode 100644
index 9c6365254..000000000
--- a/tests/integration/targets/prepare_env/tasks/cleanup.yml
+++ /dev/null
@@ -1,65 +0,0 @@
----
-- name: clean up the environment
- hosts: localhost
- gather_facts: false
- collections:
- - nutanix.ncp
- tasks:
-
- - name: include var file
- include_vars: ../vars/main.yml
- - name: Delete VM
- ignore_errors: true
- ntnx_vms:
- vm_uuid: '{{vm.uuid }}'
- state: absent
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: False
-# # - name: Delete DR VM
-# # ntnx_vms:
-# # vm_uuid: '{{dr_vm.uuid }}'
-# # state: absent
-# # nutanix_host: "{{ ip }}"
-# # nutanix_username: "{{ username }}"
-# # nutanix_password: "{{ password }}"
-# # validate_certs: False
- - name: Delete overlay
- ignore_errors: true
- ntnx_subnets:
- state: absent
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: false
- subnet_uuid: "{{item }}"
- loop:
- - "{{overlay.uuid}}"
- - name: Delete vpc
- ignore_errors: true
- ntnx_vpcs:
- state: absent
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: False
- vpc_uuid: "{{ vpc.uuid }}"
- - name: Delete subnets
- ignore_errors: true
- ntnx_subnets:
- state: absent
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: false
- subnet_uuid: "{{item }}"
- loop:
- - "{{external_nat_subnet.uuid}}"
- - "{{static.uuid}}"
-
- - name: Delete downloaded disk file
- ignore_errors: true
- file:
- path: "{{ disk_image.dest }}"
- state: absent
diff --git a/tests/integration/targets/prepare_env/tasks/main.yml b/tests/integration/targets/prepare_env/tasks/main.yml
deleted file mode 100644
index ed97d539c..000000000
--- a/tests/integration/targets/prepare_env/tasks/main.yml
+++ /dev/null
@@ -1 +0,0 @@
----
diff --git a/tests/integration/targets/prepare_env/tasks/prepare_env.yml b/tests/integration/targets/prepare_env/tasks/prepare_env.yml
deleted file mode 100644
index b376483d4..000000000
--- a/tests/integration/targets/prepare_env/tasks/prepare_env.yml
+++ /dev/null
@@ -1,214 +0,0 @@
----
-- name: prepare the environment
- hosts: localhost
- gather_facts: false
- collections:
- - nutanix.ncp
-
- tasks:
- - name: include var file
- include_vars: ../vars/main.yml
- - set_fact:
- ip: "{{lookup('env', 'NUTANIX_HOST') }}"
- username: "{{lookup('env', 'NUTANIX_USERNAME') }}"
- password: "{{lookup('env', 'NUTANIX_PASSWORD') }}"
- recovery_site_ip: "{{lookup('env', 'NUTANIX_DR_SITE')}}"
- validate_certs: false
- - name: Insert credentials block to vars
- blockinfile:
- path: ../vars/main.yml
- marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 0"
- block: |
- ip: "{{lookup('env', 'NUTANIX_HOST') }}"
- username: "{{lookup('env', 'NUTANIX_USERNAME') }}"
- password: "{{lookup('env', 'NUTANIX_PASSWORD') }}"
- recovery_site_ip: "{{lookup('env', 'NUTANIX_DR_SITE') }}"
- validate_certs: false
- - name: create external subnet with NAT
- ntnx_subnets:
- state: present
- nutanix_host: "{{ ip }}"
- validate_certs: false
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- name: "{{external_nat_subnets.name}}"
- external_subnet:
- vlan_id: "{{external_nat_subnets.vlan_id}}"
- enable_nat: True
- cluster:
- name: "{{ cluster.name }}"
- ipam:
- network_ip: "{{ external_nat_subnets.network_ip }}"
- network_prefix: "{{ external_nat_subnets.network_prefix }}"
- gateway_ip: "{{ external_nat_subnets.gateway_ip_address }}"
- ip_pools:
- - start_ip: "{{ external_nat_subnets.dhcp.start_address }}"
- end_ip: "{{ external_nat_subnets.dhcp.end_address }}"
- register: result
- - name: Insert external subnet configuration block to vars
- blockinfile:
- path: ../vars/main.yml
- marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 1"
- block: |
- external_nat_subnet:
- name: "{{external_nat_subnets.name}}"
- uuid: "{{result.subnet_uuid}}"
-
- - name: Create min VPC with external_subnet uuid
- ntnx_vpcs:
- validate_certs: False
- state: present
- wait: true
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- name: "{{vpc_name}}"
- external_subnets:
- - subnet_uuid: "{{ result.subnet_uuid }}"
- register: result
-
- - name: Insert VPC configuration block to vars
- blockinfile:
- path: ../vars/main.yml
- marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 2"
- block: |
- vpc:
- name: "{{vpc_name}}"
- uuid: "{{result.vpc_uuid}}"
-
- - name: create vlan subnet with IPAM
- ntnx_subnets:
- state: present
- nutanix_host: "{{ ip }}"
- wait: true
- validate_certs: false
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- name: "{{static_subnet_name}}"
- vlan_subnet:
- vlan_id: 373
- virtual_switch:
- name: vs0
- cluster:
- name: "{{ cluster.name }}"
- ipam:
- network_ip: 10.30.30.0
- network_prefix: 24
- gateway_ip: 10.30.30.254
- ip_pools:
- - start_ip: 10.30.30.10
- end_ip: 10.30.30.90
- register: result
-
- - name: Insert vlan subnet configuration block to var file
- blockinfile:
- path: ../vars/main.yml
- marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 3"
- block: |
- static:
- name: "{{static_subnet_name}}"
- uuid: "{{result.subnet_uuid}}"
- network_ip: 10.30.30.0
- network_prefix: 24
- gateway_ip: 10.30.30.254
-
- - name: include var file
- include_vars: ../vars/main.yml
- - name: create overlay Subnet with minimum requirements
- ntnx_subnets:
- state: present
- nutanix_host: "{{ ip }}"
- validate_certs: false
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- name: "{{overlay_subnet.name}}"
- overlay_subnet:
- vpc:
- uuid: "{{ vpc.uuid }}"
- ipam:
- network_ip: "{{overlay_subnet.network_ip}}"
- network_prefix: "{{overlay_subnet.network_prefix}}"
- gateway_ip: "{{overlay_subnet.gateway_ip}}"
- register: result
-
- - name: Insert overlay subnet configuration block to var file
- blockinfile:
- path: ../vars/main.yml
- marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 4"
- block: |
- overlay:
- name: "{{overlay_subnet.name}}"
- uuid: "{{result.subnet_uuid}}"
-
- - name: create VM with overlay subnet
- ntnx_vms:
- state: present
- nutanix_host: "{{ ip }}"
- nutanix_username: "{{ username }}"
- nutanix_password: "{{ password }}"
- validate_certs: False
- name: "{{vm_name}}"
- cluster:
- uuid: "{{ cluster.uuid }}"
- networks:
- - is_connected: true
- subnet:
- name: "{{overlay_subnet.name}}"
- private_ip: "{{overlay_subnet.private_ip}}"
- register: result
-
- - name: Insert vm configuration block to var file
- blockinfile:
- path: ../vars/main.yml
- marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 5"
- block: |
- vm:
- name: "{{vm_name}}"
- uuid: "{{result.vm_uuid}}"
-
-# # - name: create VM with static subnet for dr tests
-# # ntnx_vms:
-# # state: present
-# # nutanix_host: "{{ ip }}"
-# # nutanix_username: "{{ username }}"
-# # nutanix_password: "{{ password }}"
-# # validate_certs: False
-# # name: "{{dr_vm_name}}"
-# # categories:
-# # Environment:
-# # - Staging
-# # - Testing
-# # cluster:
-# # uuid: "{{ cluster.uuid }}"
-# # networks:
-# # - is_connected: true
-# # subnet:
-# # name: "{{static_subnet_name}}"
-# # vcpus: 1
-# # cores_per_vcpu: 1
-# # memory_gb: 1
-# # register: result
-
-# # - name: Insert vm configuration block to var file
-# # blockinfile:
-# # path: ../vars/main.yml
-# # marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 6"
-# # block: |
-# # dr_vm:
-# # name: "{{dr_vm_name}}"
-# # uuid: "{{result.vm_uuid}}"
-
- - name: Downloading disk image for image related tests
- get_url:
- url: "{{ disk_image.url }}"
- dest: "{{ disk_image.dest }}"
-
- # - name: create address group for network security policy related tests
- # ntnx_address_groups:
- # state: present
- # name: dest
- # desc: dest
- # subnets:
- # - network_ip: "10.1.1.0"
- # network_prefix: 24
- # ignore_errors: true
diff --git a/tests/integration/targets/prepare_env/vars/main.yml b/tests/integration/targets/prepare_env/vars/main.yml
index 508f92c27..985a11227 100644
--- a/tests/integration/targets/prepare_env/vars/main.yml
+++ b/tests/integration/targets/prepare_env/vars/main.yml
@@ -3,7 +3,7 @@ username: TEST_PC_USERNAME
password: TEST_PC_PASSWORD
validate_certs: TEST_VALIDATE_CERT_FLAG
-# for NKE related tests
+# for NKE related tests
k8s_version: TEST_K8S_VERSION
host_os: TEST_HOST_OS
nutanix_cluster_password: TEST_CLUSTER_PASSWORD
@@ -102,7 +102,7 @@ project:
uuid: TEST_PROJECT_UUID
# list of roles for advanced projects tests
-roles:
+test_roles:
- "TEST_ROLES_NAME_1"
- "TEST_ROLES_NAME_2"
- "TEST_ROLES_NAME_3"
diff --git a/tests/integration/targets/prepare_fc_env/playbooks/prepare_fc_env.yml b/tests/integration/targets/prepare_fc_env/playbooks/prepare_fc_env.yml
new file mode 100644
index 000000000..cf7f7a9e0
--- /dev/null
+++ b/tests/integration/targets/prepare_fc_env/playbooks/prepare_fc_env.yml
@@ -0,0 +1,7 @@
+---
+- name: Prepare the environment
+ hosts: localhost
+ gather_facts: false
+ tasks:
+ - name: Include var file
+ ansible.builtin.include_vars: ../vars/main.yml
diff --git a/tests/integration/targets/prepare_fc_env/tasks/main.yml b/tests/integration/targets/prepare_fc_env/tasks/main.yml
deleted file mode 100644
index ed97d539c..000000000
--- a/tests/integration/targets/prepare_fc_env/tasks/main.yml
+++ /dev/null
@@ -1 +0,0 @@
----
diff --git a/tests/integration/targets/prepare_fc_env/tasks/prepare_fc_env.yml b/tests/integration/targets/prepare_fc_env/tasks/prepare_fc_env.yml
deleted file mode 100644
index 8471e662b..000000000
--- a/tests/integration/targets/prepare_fc_env/tasks/prepare_fc_env.yml
+++ /dev/null
@@ -1,10 +0,0 @@
----
-- name: prepare the environment
- hosts: localhost
- gather_facts: false
- collections:
- - nutanix.ncp
-
- tasks:
- - name: include var file
- include_vars: ../vars/main.yml
diff --git a/tests/integration/targets/prepare_foundation_env/tasks/cleanup.yml b/tests/integration/targets/prepare_foundation_env/playbooks/cleanup.yml
similarity index 60%
rename from tests/integration/targets/prepare_foundation_env/tasks/cleanup.yml
rename to tests/integration/targets/prepare_foundation_env/playbooks/cleanup.yml
index e36708ac0..bc4aefe85 100644
--- a/tests/integration/targets/prepare_foundation_env/tasks/cleanup.yml
+++ b/tests/integration/targets/prepare_foundation_env/playbooks/cleanup.yml
@@ -1,10 +1,10 @@
---
-- name: clean up the environment
+- name: Clean up the environment
hosts: localhost
gather_facts: false
tasks:
- - name: include var file
- include_vars: ../vars/main.yml
+ - name: Include var file
+ ansible.builtin.include_vars: ../vars/main.yml
# - name: Delete files
# file:
# path: "{{ source }}"
diff --git a/tests/integration/targets/prepare_foundation_env/playbooks/prepare_foundation_env.yml b/tests/integration/targets/prepare_foundation_env/playbooks/prepare_foundation_env.yml
new file mode 100644
index 000000000..cf7f7a9e0
--- /dev/null
+++ b/tests/integration/targets/prepare_foundation_env/playbooks/prepare_foundation_env.yml
@@ -0,0 +1,7 @@
+---
+- name: Prepare the environment
+ hosts: localhost
+ gather_facts: false
+ tasks:
+ - name: Include var file
+ ansible.builtin.include_vars: ../vars/main.yml
diff --git a/tests/integration/targets/prepare_foundation_env/tasks/tmp/.gitkeep b/tests/integration/targets/prepare_foundation_env/playbooks/tmp/.gitkeep
similarity index 100%
rename from tests/integration/targets/prepare_foundation_env/tasks/tmp/.gitkeep
rename to tests/integration/targets/prepare_foundation_env/playbooks/tmp/.gitkeep
diff --git a/tests/integration/targets/prepare_foundation_env/tasks/main.yml b/tests/integration/targets/prepare_foundation_env/tasks/main.yml
deleted file mode 100644
index ed97d539c..000000000
--- a/tests/integration/targets/prepare_foundation_env/tasks/main.yml
+++ /dev/null
@@ -1 +0,0 @@
----
diff --git a/tests/integration/targets/prepare_foundation_env/tasks/prepare_foundation_env.yml b/tests/integration/targets/prepare_foundation_env/tasks/prepare_foundation_env.yml
deleted file mode 100644
index 8471e662b..000000000
--- a/tests/integration/targets/prepare_foundation_env/tasks/prepare_foundation_env.yml
+++ /dev/null
@@ -1,10 +0,0 @@
----
-- name: prepare the environment
- hosts: localhost
- gather_facts: false
- collections:
- - nutanix.ncp
-
- tasks:
- - name: include var file
- include_vars: ../vars/main.yml
diff --git a/tests/integration/targets/prepare_foundation_env/vars/main.yml b/tests/integration/targets/prepare_foundation_env/vars/main.yml
index 268a046dc..2ce12374c 100644
--- a/tests/integration/targets/prepare_foundation_env/vars/main.yml
+++ b/tests/integration/targets/prepare_foundation_env/vars/main.yml
@@ -2,7 +2,7 @@
foundation_host: "TEST_FOUNDATION_HOST"
# the dir in local machine where test setup will install nos image and pick during image upload tests
-source: 'TEST_SOURCE_PATH'
+source: "TEST_SOURCE_PATH"
# nos image url for images tests
image_url: "TEST_IMAGE_URL"
@@ -76,11 +76,11 @@ nodes:
ipmi_netmask: "TEST_IPMI_NETMASK_NODE1"
ipmi_gateway: TEST_IPMI_GATEWAY_NODE1
ntp_servers:
- - "TEST_NTP_SERVER_1"
- - "TEST_NTP_SERVER_2"
+ - "TEST_NTP_SERVER_1"
+ - "TEST_NTP_SERVER_2"
dns_servers:
- - "TEST_DNS_SERVER_1"
- - "TEST_DNS_SERVER_2"
+ - "TEST_DNS_SERVER_1"
+ - "TEST_DNS_SERVER_2"
backplane_vlan: "TEST_BACKPLANE_VLAN"
backplane_subnet: "TEST_BACKPLANE_SUBNET"
backplane_netmask: "TEST_BACKPLANE_NETMASK"
diff --git a/tests/integration/targets/prepare_ndb_env/playbooks/prepare_env.yml b/tests/integration/targets/prepare_ndb_env/playbooks/prepare_env.yml
new file mode 100644
index 000000000..46d714147
--- /dev/null
+++ b/tests/integration/targets/prepare_ndb_env/playbooks/prepare_env.yml
@@ -0,0 +1,20 @@
+---
+- name: Prepare the environment for ndb
+ hosts: localhost
+ gather_facts: false
+ tasks:
+ - name: Include var file
+ ansible.builtin.include_vars: ../vars/main.yml
+ - name: Insert credentials to vars
+ ansible.builtin.set_fact:
+ ndb_ip: "{{lookup('env', 'NDB_HOST') }}"
+ ndb_username: "{{lookup('env', 'NDB_USERNAME') }}"
+ ndb_password: "{{lookup('env', 'NDB_PASSWORD') }}"
+ - name: Insert credentials block to vars
+ ansible.builtin.blockinfile:
+ path: ../vars/main.yml
+ marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 0"
+ block: |
+ ndb_ip: "{{lookup('env', 'NDB_HOST') }}"
+ ndb_username: "{{lookup('env', 'NDB_USERNAME') }}"
+ ndb_password: "{{lookup('env', 'NDB_PASSWORD') }}"
diff --git a/tests/integration/targets/prepare_ndb_env/tasks/tmp/.gitkeep b/tests/integration/targets/prepare_ndb_env/playbooks/tmp/.gitkeep
similarity index 100%
rename from tests/integration/targets/prepare_ndb_env/tasks/tmp/.gitkeep
rename to tests/integration/targets/prepare_ndb_env/playbooks/tmp/.gitkeep
diff --git a/tests/integration/targets/prepare_ndb_env/tasks/prepare_env.yml b/tests/integration/targets/prepare_ndb_env/tasks/prepare_env.yml
deleted file mode 100644
index cc9445779..000000000
--- a/tests/integration/targets/prepare_ndb_env/tasks/prepare_env.yml
+++ /dev/null
@@ -1,22 +0,0 @@
----
-- name: prepare the environment for ndb
- hosts: localhost
- gather_facts: false
- collections:
- - nutanix.ncp
-
- tasks:
- - name: include var file
- include_vars: ../vars/main.yml
- - set_fact:
- ndb_ip: "{{lookup('env', 'NDB_HOST') }}"
- ndb_username: "{{lookup('env', 'NDB_USERNAME') }}"
- ndb_password: "{{lookup('env', 'NDB_PASSWORD') }}"
- - name: Insert credentials block to vars
- blockinfile:
- path: ../vars/main.yml
- marker: "# {mark} ANSIBLE MANAGED BLOCK insertion 0"
- block: |
- ndb_ip: "{{lookup('env', 'NDB_HOST') }}"
- ndb_username: "{{lookup('env', 'NDB_USERNAME') }}"
- ndb_password: "{{lookup('env', 'NDB_PASSWORD') }}"
diff --git a/tests/integration/targets/prepare_ndb_env/vars/main.yml b/tests/integration/targets/prepare_ndb_env/vars/main.yml
index 5f1af010c..99f3cae4a 100644
--- a/tests/integration/targets/prepare_ndb_env/vars/main.yml
+++ b/tests/integration/targets/prepare_ndb_env/vars/main.yml
@@ -135,7 +135,7 @@ db_server_vm:
uuid: "TEST_DB_SERVER_VM_UUID"
# existing tags for various entities
-tags:
+entity_tags:
db_server_vm:
name: "TEST_DB_SERVER_VM_TAGS_NAME"
uuid: "TEST_DB_SERVER_VM_TAGS_UUID"