From 26e2b18c5bc372e8da4ede1447ad7a21beffd247 Mon Sep 17 00:00:00 2001 From: Pradeepsingh Bhati Date: Sun, 7 Jul 2024 14:00:46 +0530 Subject: [PATCH 01/54] Sync main branch with 1.9.0, 1.9.1 and 1.9.2 releases from public repository. (#66) Sync main branch --------- Co-authored-by: Pradeepsingh Bhati --------- Co-authored-by: Gevorg Khachatryan Co-authored-by: alaa-bish Co-authored-by: Gianluca Salvo Co-authored-by: Gianluca Salvo Co-authored-by: Nathaniel Roberts <107402519+Nathaniel-Roberts@users.noreply.github.com> --- .github/labeler.yml | 5 +- .github/workflows/black.yml | 5 +- .github/workflows/flake8.yml | 5 +- .github/workflows/isort.yml | 5 +- .github/workflows/ok-to-test-command.yml | 47 +- .github/workflows/ok-to-test.yml | 9 +- .github/workflows/pr-labels.yml | 5 +- .github/workflows/unit_testing.yml | 46 +- CHANGELOG.md | 66 +- CHANGELOG.rst | 73 +++ README.md | 95 ++- _config.yml | 2 +- changelogs/changelog.yaml | 70 +++ examples/README.md | 2 +- examples/acp_info.yml | 2 +- examples/address_groups_crud.yml | 18 +- examples/category_crud.yml | 16 +- examples/clusters_info.yml | 10 +- examples/dr/protection_policy.yml | 13 +- examples/dr/recovery_plan_with_execution.yml | 6 +- examples/fc/api_keys_create.yml | 4 +- examples/fc/api_keys_info.yml | 8 +- examples/fc/fc.yml | 2 +- examples/fc/imaged_cluster_info.yml | 2 +- examples/fc/imaged_nodes_info.yml | 4 +- examples/fip.yml | 4 +- examples/fip_info.yml | 11 +- examples/foundation/get_images_info.yml | 4 +- examples/foundation/image_nodes.yml | 6 +- examples/foundation/ipmi_config.yml | 2 +- .../node_discovery_network_info.yml | 6 +- examples/hosts_info.yml | 10 +- examples/iaas/iaas.yml | 2 +- .../external_subnet/tasks/external_subnet.yml | 6 +- .../iaas/roles/external_subnet/tasks/main.yml | 2 +- examples/iaas/roles/fip/tasks/fip.yml | 2 +- .../overlay_subnet/tasks/overlay_subnet.yml | 2 +- examples/iaas/roles/pbr/tasks/pbr.yml | 2 +- .../roles/pbr_delete/tasks/pbr_delete.yml | 2 +- .../roles/static_route/tasks/static_route.yml | 2 +- examples/iaas/roles/vm/tasks/main.yml | 2 +- examples/iaas/roles/vm/tasks/vm.yml | 2 +- examples/iaas/roles/vpc/tasks/vpc.yml | 2 +- examples/images.yml | 3 +- examples/inventory/ansible.cfg | 5 + examples/inventory/nutanix.yaml | 13 + examples/karbon/cluster_info.yml | 4 +- examples/karbon/create_k8s_cluster.yml | 49 +- examples/karbon/create_registries.yml | 4 +- examples/karbon/registries_info.yml | 2 +- examples/ndb/README.md | 4 +- examples/ndb/all_day2_actions.yml | 14 +- examples/ndb/create_clone.yml | 121 ++++ examples/ndb/create_stretched_vlan.yml | 4 +- examples/ndb/create_time_machine_cluster.yml | 4 +- examples/ndb/create_vlan.yml | 4 +- examples/ndb/db_server_vms.yml | 16 +- ...ision_database_on_registered_db_server.yml | 16 +- ...rovision_postgres_ha_instance_with_ips.yml | 20 +- examples/ndb/refresh_clone.yml | 40 ++ examples/ndb/registr_cluster.yml | 4 +- .../single_instance_postgress_database.yml | 18 +- .../ndb/soft_delete_database_instance.yml | 4 +- examples/ndb/software_profiles.yml | 2 +- examples/pbr.yml | 2 +- examples/pbr_info.yml | 4 +- examples/permissions_info.yml | 2 +- examples/projects_crud.yml | 10 +- examples/projects_with_role_mapping.yml | 10 +- examples/roles_crud.yml | 14 +- examples/static_routes.yml | 2 +- examples/subnet.yml | 8 +- examples/subnet_info.yml | 13 +- examples/user-groups.yml | 2 +- examples/user.yml | 4 +- examples/vm.yml | 15 +- examples/vm_info.yml | 23 +- examples/vm_operations.yml | 7 +- examples/vm_update.yml | 2 +- examples/vpc.yml | 2 +- examples/vpc_info.yml | 4 +- galaxy.yml | 4 +- meta/runtime.yml | 190 +++--- plugins/doc_fragments/ntnx_credentials.py | 2 +- .../ntnx_foundation_base_module.py | 2 +- plugins/doc_fragments/ntnx_info.py | 8 +- plugins/doc_fragments/ntnx_vms_base.py | 15 + plugins/inventory/ntnx_prism_vm_inventory.py | 16 +- plugins/module_utils/base_info_module.py | 9 + plugins/module_utils/entity.py | 28 +- .../module_utils/foundation/image_nodes.py | 21 +- plugins/module_utils/karbon/clusters.py | 9 +- plugins/module_utils/karbon/node_pools.py | 176 ++++++ plugins/module_utils/ndb/database_clones.py | 8 +- .../ndb/profiles/profile_types.py | 5 + plugins/module_utils/ndb/profiles/profiles.py | 1 + plugins/module_utils/ndb/time_machines.py | 7 +- plugins/module_utils/prism/groups.py | 12 +- plugins/module_utils/prism/security_rules.py | 4 +- plugins/module_utils/prism/spec/vms.py | 3 + plugins/module_utils/prism/subnets.py | 11 +- .../module_utils/prism/virtual_switches.py | 14 +- plugins/module_utils/prism/vms.py | 41 +- plugins/module_utils/utils.py | 19 + plugins/modules/ntnx_foundation.py | 4 +- plugins/modules/ntnx_images_info.py | 2 +- plugins/modules/ntnx_karbon_clusters.py | 2 +- .../ntnx_karbon_clusters_node_pools.py | 363 +++++++++++ .../ntnx_ndb_database_clone_refresh.py | 16 +- plugins/modules/ntnx_ndb_database_clones.py | 7 +- plugins/modules/ntnx_ndb_profiles_info.py | 14 + plugins/modules/ntnx_ndb_tags_info.py | 192 ++++++ .../modules/ntnx_ndb_time_machines_info.py | 2 +- plugins/modules/ntnx_security_rules.py | 67 +- plugins/modules/ntnx_vms_clone.py | 4 +- requirements.txt | 6 +- tests/integration/requirements.txt | 6 +- tests/integration/targets/ntnx_acps/aliases | 1 - .../targets/ntnx_acps/tasks/create_acps.yml | 36 +- .../targets/ntnx_acps/tasks/delete_acp.yml | 13 +- .../ntnx_acps/tasks/negative_scenarios.yml | 4 +- .../targets/ntnx_acps/tasks/update_acps.yml | 24 +- .../targets/ntnx_acps_info/aliases | 1 - .../targets/ntnx_acps_info/meta/main.yml | 2 +- .../targets/ntnx_address_groups/aliases | 2 +- .../targets/ntnx_address_groups/meta/main.yml | 2 +- .../ntnx_address_groups/tasks/create.yml | 10 +- .../ntnx_address_groups/tasks/delete.yml | 8 +- .../ntnx_address_groups/tasks/update.yml | 12 +- .../targets/ntnx_address_groups_info/aliases | 2 +- .../tasks/address_groups_info.yml | 12 +- .../targets/ntnx_categories/aliases | 1 - .../targets/ntnx_categories/meta/main.yml | 2 +- .../ntnx_categories/tasks/all_operations.yml | 38 +- .../targets/ntnx_categories/tasks/main.yml | 2 +- .../targets/ntnx_categories_info/aliases | 1 - .../ntnx_categories_info/meta/main.yml | 2 +- .../ntnx_categories_info/tasks/info.yml | 8 +- .../targets/ntnx_clusters_info/aliases | 1 - .../tasks/get_clusters_info.yml | 2 +- .../ntnx_foundation/tasks/image_nodes.yml | 2 +- .../tasks/negative_scenarios.yml | 12 +- .../tasks/configure_ipmi.yml | 2 +- .../ntnx_foundation_central/vars/main.yml | 2 +- .../tasks/create_key.yml | 2 +- .../tasks/main.yml | 2 +- .../tasks/get_cluster_info.yml | 14 +- .../tasks/get_node_info.yml | 10 +- .../tasks/discover_nodes.yml | 2 +- .../aliases | 0 .../ntnx_foundation_sanity/meta/main.yml | 2 + .../tasks/image_nodes.yml | 214 +++++++ .../ntnx_foundation_sanity/tasks/main.yml | 6 + .../targets/ntnx_hosts_info/aliases | 1 - .../ntnx_hosts_info/tasks/get_hosts_info.yml | 2 +- .../aliases | 1 - .../meta/main.yml | 2 +- .../tasks/info.yml | 12 +- .../ntnx_image_placement_policy/aliases | 1 - .../ntnx_image_placement_policy/meta/main.yml | 2 +- .../tasks/create.yml | 18 +- .../tasks/delete.yml | 10 +- .../tasks/main.yml | 2 +- .../tasks/update.yml | 20 +- tests/integration/targets/ntnx_images/aliases | 1 - .../targets/ntnx_images/meta/main.yml | 2 +- .../targets/ntnx_images/tasks/create.yml | 10 +- .../targets/ntnx_images/tasks/delete.yml | 8 +- .../targets/ntnx_images/tasks/main.yml | 2 +- .../targets/ntnx_images/tasks/update.yml | 47 +- .../targets/ntnx_images_info/aliases | 1 - .../targets/ntnx_images_info/meta/main.yml | 2 +- .../targets/ntnx_images_info/tasks/info.yml | 8 +- .../{create_delete_and_info.yml => crud.yml} | 247 +++++++- .../tasks/main.yml | 4 +- ...v_scenarios.yml => negative_scenarios.yml} | 45 +- .../targets/ntnx_karbon_registries/aliases | 2 +- .../ntnx_karbon_registries/tasks/create.yml | 10 +- .../tasks/negativ_scenarios.yml | 6 +- .../ntnx_karbon_registries_info/aliases | 2 +- .../ntnx_karbon_registries_info/meta/main.yml | 2 +- .../tasks/info.yml | 4 +- .../ntnx_ndb_availability_databases/aliases | 3 +- .../ntnx_ndb_availability_databases/readme.md | 2 +- .../tasks/tests.yml | 71 ++- .../targets/ntnx_ndb_clones_info/aliases | 3 +- .../ntnx_ndb_clones_info/meta/main.yml | 2 +- .../ntnx_ndb_clones_info/tasks/info.yml | 4 +- .../targets/ntnx_ndb_clusters/aliases | 1 + .../targets/ntnx_ndb_clusters/meta/main.yml | 2 +- .../targets/ntnx_ndb_clusters/tasks/CRUD.yml | 6 +- .../targets/ntnx_ndb_database_clones/aliases | 1 + .../ntnx_ndb_database_clones/tasks/clones.yml | 219 +++++-- .../ntnx_ndb_databases_actions/aliases | 3 +- .../ntnx_ndb_databases_actions/readme.md | 2 +- .../tasks/all_actions.yml | 92 +-- .../targets/ntnx_ndb_databases_sanity/aliases | 1 + .../ntnx_ndb_databases_sanity/meta/main.yml | 2 + .../ntnx_ndb_databases_sanity/tasks/main.yml | 10 + .../ntnx_ndb_databases_sanity/tasks/tests.yml | 586 ++++++++++++++++++ .../aliases | 3 +- .../readme.md | 2 +- .../tasks/tests.yml | 96 +-- .../aliases | 3 +- .../readme.md | 2 +- .../tasks/tests.yml | 53 +- .../targets/ntnx_ndb_db_server_vms/aliases | 3 +- .../targets/ntnx_ndb_db_server_vms/readme.md | 2 +- .../ntnx_ndb_db_server_vms/tasks/crud.yml | 88 +-- .../ntnx_ndb_maintenance_windows/aliases | 2 +- .../tasks/crud.yml | 38 +- .../targets/ntnx_ndb_profiles/aliases | 3 +- .../targets/ntnx_ndb_profiles/meta/main.yml | 2 +- .../ntnx_ndb_profiles/tasks/compute.yml | 14 +- .../ntnx_ndb_profiles/tasks/db_params.yml | 22 +- .../tasks/network_profile.yml | 164 ++--- .../targets/ntnx_ndb_profiles_info/aliases | 3 +- .../ntnx_ndb_profiles_info/meta/main.yml | 2 +- .../ntnx_ndb_profiles_info/tasks/info.yml | 48 +- .../integration/targets/ntnx_ndb_slas/aliases | 3 +- .../targets/ntnx_ndb_slas/meta/main.yml | 2 +- .../targets/ntnx_ndb_slas/tasks/CRUD.yml | 20 +- .../targets/ntnx_ndb_snapshots_info/aliases | 3 +- .../ntnx_ndb_snapshots_info/meta/main.yml | 2 +- .../ntnx_ndb_snapshots_info/tasks/info.yml | 4 +- .../ntnx_ndb_software_profiles/aliases | 1 + .../ntnx_ndb_software_profiles/tasks/crud.yml | 10 +- .../integration/targets/ntnx_ndb_tags/aliases | 1 + .../targets/ntnx_ndb_tags/tasks/crud.yml | 298 ++++++++- .../ntnx_ndb_time_machines_info/aliases | 1 + .../ntnx_ndb_time_machines_info/meta/main.yml | 2 +- .../tasks/info.yml | 4 +- .../aliases | 3 +- .../meta/main.yml | 2 +- .../data_access_management_and_snapshots.yml | 12 +- .../targets/ntnx_ndb_vlans/aliases | 3 +- .../targets/ntnx_ndb_vlans/meta/main.yml | 2 +- .../ntnx_ndb_vlans/tasks/create_vlans.yml | 20 +- .../tasks/negativ_scenarios.yml | 12 +- tests/integration/targets/ntnx_ova/aliases | 1 - .../targets/ntnx_ova/tasks/create_ova.yml | 2 +- .../targets/ntnx_permissions_info/aliases | 1 - .../tasks/permissions_info.yml | 8 +- .../integration/targets/ntnx_projects/aliases | 1 - .../ntnx_projects/tasks/create_project.yml | 12 +- .../targets/ntnx_projects/tasks/main.yml | 2 +- ...ts.yml => projects_with_role_mappings.yml} | 63 +- .../ntnx_projects/tasks/update_project.yml | 16 +- .../targets/ntnx_projects_info/aliases | 1 - .../tasks/projects_info.yml | 18 +- .../targets/ntnx_projects_info/vars/main.yml | 2 +- .../targets/ntnx_protection_rules/aliases | 2 +- .../tasks/protection_rules.yml | 12 +- .../ntnx_protection_rules_info/aliases | 2 +- .../tasks/rules_info.yml | 10 +- .../ntnx_recovery_plans_and_jobs/aliases | 2 +- .../tasks/crud.yml | 16 +- .../ntnx_recovery_plans_and_jobs_info/aliases | 2 +- .../tasks/info.yml | 20 +- tests/integration/targets/ntnx_roles/aliases | 1 - .../targets/ntnx_roles/meta/main.yml | 2 +- .../targets/ntnx_roles/tasks/create.yml | 8 +- .../targets/ntnx_roles/tasks/delete.yml | 6 +- .../targets/ntnx_roles/tasks/update.yml | 8 +- .../targets/ntnx_roles_info/aliases | 1 - .../ntnx_roles_info/tasks/roles_info.yml | 10 +- .../targets/ntnx_security_rules/aliases | 2 +- .../ntnx_security_rules/tasks/app_rule.yml | 41 +- .../tasks/isolation_rule.yml | 8 +- .../tasks/quarantine_rule.yml | 6 +- .../targets/ntnx_security_rules/tasks/vdi.yml | 18 +- .../targets/ntnx_security_rules_info/aliases | 2 +- .../tasks/get_security_rules.yml | 6 +- .../targets/ntnx_service_groups/aliases | 2 +- .../targets/ntnx_service_groups/meta/main.yml | 2 +- .../ntnx_service_groups/tasks/create.yml | 22 +- .../ntnx_service_groups/tasks/main.yml | 2 +- .../ntnx_service_groups/tasks/update.yml | 8 +- .../targets/ntnx_service_groups_info/aliases | 2 +- .../ntnx_service_groups_info/meta/main.yml | 2 +- .../ntnx_service_groups_info/tasks/info.yml | 2 +- .../targets/ntnx_static_routes/aliases | 1 - .../ntnx_static_routes/tasks/create.yml | 16 +- .../targets/ntnx_static_routes_info/aliases | 1 - .../ntnx_static_routes_info/tasks/info.yml | 14 +- .../targets/ntnx_user_groups/aliases | 1 - .../targets/ntnx_user_groups/meta/main.yml | 2 +- .../targets/ntnx_user_groups/tasks/create.yml | 158 ++++- .../ntnx_user_groups_info/meta/main.yml | 2 - .../ntnx_user_groups_info/tasks/main.yml | 9 - .../tasks/user_groups_info.yml | 100 --- tests/integration/targets/ntnx_users/aliases | 1 - .../targets/ntnx_users/meta/main.yml | 2 +- .../targets/ntnx_users/tasks/create.yml | 54 +- .../targets/ntnx_users_info/aliases | 1 - .../ntnx_users_info/tasks/users_info.yml | 10 +- .../targets/ntnx_vms_clone/aliases | 1 - .../targets/ntnx_vms_clone/tasks/create.yml | 14 +- .../targets/nutanix_floating_ips/aliases | 1 - .../tasks/create_floating_ips.yml | 8 +- .../tasks/negative_scenarios.yml | 2 +- .../targets/nutanix_floating_ips_info/aliases | 1 - .../integration/targets/nutanix_pbrs/aliases | 1 - .../nutanix_pbrs/tasks/create_pbrs.yml | 4 +- .../nutanix_pbrs/tasks/negative_scenarios.yml | 57 +- .../targets/nutanix_pbrs/vars/main.yml | 2 +- .../targets/nutanix_pbrs_info/aliases | 1 - .../targets/nutanix_subnets/aliases | 1 - .../nutanix_subnets/tasks/create_subnet.yml | 13 +- .../nutanix_subnets/tasks/delete_subnet.yml | 4 +- .../tasks/negative_scenarios.yml | 10 +- .../targets/nutanix_subnets/vars/main.yml | 2 +- .../targets/nutanix_subnets_info/aliases | 1 - .../tasks/list_subnets.yml | 15 + tests/integration/targets/nutanix_vms/aliases | 1 - .../targets/nutanix_vms/tasks/create.yml | 101 ++- .../targets/nutanix_vms/tasks/delete.yml | 4 +- .../nutanix_vms/tasks/negtaive_scenarios.yml | 56 +- .../nutanix_vms/tasks/negtaive_vm_update.yml | 20 +- .../nutanix_vms/tasks/vm_operations.yml | 16 +- .../targets/nutanix_vms/tasks/vm_update.yml | 36 +- .../targets/nutanix_vms_info/aliases | 1 - .../nutanix_vms_info/tasks/list_vms.yml | 50 +- .../integration/targets/nutanix_vpcs/aliases | 1 - .../nutanix_vpcs/tasks/negative_scenarios.yml | 6 +- .../targets/nutanix_vpcs_info/aliases | 1 - .../targets/prepare_env/tasks/cleanup.yml | 88 +-- .../targets/prepare_env/tasks/prepare_env.yml | 325 +++++----- .../targets/prepare_env/vars/main.yml | 145 +++++ .../prepare_fc_env/tasks/prepare_fc_env.yml | 2 +- .../prepare_foundation_env/tasks/cleanup.yml | 2 +- .../tasks/prepare_foundation_env.yml | 4 +- .../prepare_foundation_env/vars/main.yml | 95 +++ .../prepare_ndb_env/tasks/prepare_env.yml | 11 +- .../targets/prepare_ndb_env/vars/main.yml | 184 ++++++ tests/unit/compat/builtins.py | 2 +- 336 files changed, 5357 insertions(+), 1907 deletions(-) create mode 100644 examples/inventory/ansible.cfg create mode 100644 examples/inventory/nutanix.yaml create mode 100644 examples/ndb/create_clone.yml create mode 100644 examples/ndb/refresh_clone.yml create mode 100644 plugins/module_utils/karbon/node_pools.py create mode 100644 plugins/modules/ntnx_karbon_clusters_node_pools.py create mode 100644 plugins/modules/ntnx_ndb_tags_info.py rename tests/integration/targets/{ntnx_user_groups_info => ntnx_foundation_sanity}/aliases (100%) create mode 100644 tests/integration/targets/ntnx_foundation_sanity/meta/main.yml create mode 100644 tests/integration/targets/ntnx_foundation_sanity/tasks/image_nodes.yml create mode 100644 tests/integration/targets/ntnx_foundation_sanity/tasks/main.yml rename tests/integration/targets/ntnx_karbon_clusters_and_info/tasks/{create_delete_and_info.yml => crud.yml} (56%) rename tests/integration/targets/ntnx_karbon_clusters_and_info/tasks/{negativ_scenarios.yml => negative_scenarios.yml} (80%) create mode 100644 tests/integration/targets/ntnx_ndb_databases_sanity/aliases create mode 100644 tests/integration/targets/ntnx_ndb_databases_sanity/meta/main.yml create mode 100644 tests/integration/targets/ntnx_ndb_databases_sanity/tasks/main.yml create mode 100644 tests/integration/targets/ntnx_ndb_databases_sanity/tasks/tests.yml rename tests/integration/targets/ntnx_projects/tasks/{advanced_projects.yml => projects_with_role_mappings.yml} (92%) delete mode 100644 tests/integration/targets/ntnx_user_groups_info/meta/main.yml delete mode 100644 tests/integration/targets/ntnx_user_groups_info/tasks/main.yml delete mode 100644 tests/integration/targets/ntnx_user_groups_info/tasks/user_groups_info.yml create mode 100644 tests/integration/targets/prepare_foundation_env/vars/main.yml diff --git a/.github/labeler.yml b/.github/labeler.yml index 93306afe9..ee1fc81ce 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,3 +1,4 @@ +--- 🐍 python: - "**/*.py" - "*.py" @@ -7,7 +8,7 @@ - "*.md" ⚙ ci: - - ".github/**" + - .github/** ⚙ build: - - "Makefile" \ No newline at end of file + - Makefile diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 1144aa148..7e213caaa 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -1,3 +1,4 @@ +--- name: Black on: push: @@ -15,8 +16,8 @@ jobs: - name: Set up Python 3.x (latest) uses: actions/setup-python@v2 with: - python-version: '3.x' + python-version: 3.x - name: black uses: psf/black@stable with: - version: "22.6.0" + version: 22.8.0 diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 1066a98b5..1f68cbff5 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -1,3 +1,4 @@ +--- name: Flake8 on: push: @@ -15,8 +16,8 @@ jobs: - name: Set up Python 3.9 uses: actions/setup-python@v2 with: - python-version: '3.9' + python-version: "3.9" - name: Run Flake8 run: | pip install -r requirements.txt - flake8 \ No newline at end of file + flake8 diff --git a/.github/workflows/isort.yml b/.github/workflows/isort.yml index 1d26e99e8..676cb7244 100644 --- a/.github/workflows/isort.yml +++ b/.github/workflows/isort.yml @@ -1,3 +1,4 @@ +--- name: Isort on: push: @@ -15,5 +16,5 @@ jobs: - name: Set up Python 3.x uses: actions/setup-python@v2 with: - python-version: '3.x' - - uses: isort/isort-action@master \ No newline at end of file + python-version: 3.x + - uses: isort/isort-action@master diff --git a/.github/workflows/ok-to-test-command.yml b/.github/workflows/ok-to-test-command.yml index 2b7898d96..ef80ef365 100644 --- a/.github/workflows/ok-to-test-command.yml +++ b/.github/workflows/ok-to-test-command.yml @@ -1,3 +1,4 @@ +--- name: Integration Test cases on: pull_request: @@ -10,14 +11,14 @@ jobs: strategy: max-parallel: 1 matrix: - python-version: ['3.9'] + python-version: ["3.9"] if: github.event_name == 'repository_dispatch' steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - uses: actions/checkout@v2 with: - ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge' + ref: refs/pull/${{ github.event.client_payload.pull_request.number }}/merge - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: @@ -47,13 +48,13 @@ jobs: args="${{ github.event.client_payload.slash_command.args.all }}" flag="" if [ "$args" = "allow-disabled" ] - then + then flag="--allow-disabled" fi echo '${{ secrets.FOUNDATION_CONFIG }}' > tests/integration/targets/prepare_foundation_env/vars/main.yml 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 + 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 @@ -65,23 +66,23 @@ jobs: - name: Code Coverage Check if: ${{ always() }} - run: | - cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }} - ansible-test coverage html - sshpass -p '${{ secrets.FILER_PASSWORD }}' scp -r tests/output ${{ secrets.FILER_LOCATION }} - echo "Code coverage: Checking if code coverage is above threshold..." - export COVERAGE_THRESHOLD=70 - echo "Threshold: $COVERAGE_THRESHOLD %" - totalCoverage=`grep TOTAL coverage.txt | awk '{print $6}' | sed 's/%//'` - echo "TOTAL_COVERAGE=${totalCoverage}" >> $GITHUB_ENV - echo "Current integration test coverage : $totalCoverage %" - if (( $(echo "$totalCoverage $COVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then - echo "Coverage passed" - else - echo "Current integration test coverage is below threshold. Please add more integration tests or adjust threshold to a lower value." - echo "Coverage check failed" - exit 1 - fi + run: | + cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }} + ansible-test coverage html + sshpass -p '${{ secrets.FILER_PASSWORD }}' scp -r tests/output ${{ secrets.FILER_LOCATION }} + echo "Code coverage: Checking if code coverage is above threshold..." + export COVERAGE_THRESHOLD=70 + echo "Threshold: $COVERAGE_THRESHOLD %" + totalCoverage=`grep TOTAL coverage.txt | awk '{print $6}' | sed 's/%//'` + echo "TOTAL_COVERAGE=${totalCoverage}" >> $GITHUB_ENV + echo "Current integration test coverage : $totalCoverage %" + if (( $(echo "$totalCoverage $COVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then + echo "Coverage passed" + else + echo "Current integration test coverage is below threshold. Please add more integration tests or adjust threshold to a lower value." + echo "Coverage check failed" + exit 1 + fi - run: echo "🍏 This job's status is ${{ job.status }}." @@ -105,7 +106,7 @@ jobs: number: ${{ github.event.client_payload.pull_request.number }} job: ${{ github.job }} # Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run - conclusion: ${{ job.status }} + conclusion: ${{ job.status }} with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | diff --git a/.github/workflows/ok-to-test.yml b/.github/workflows/ok-to-test.yml index f9802acba..dfe87197b 100644 --- a/.github/workflows/ok-to-test.yml +++ b/.github/workflows/ok-to-test.yml @@ -1,7 +1,7 @@ -name: 'Ok-To-Test' +--- +name: Ok-To-Test on: [issue_comment] - jobs: test: runs-on: ubuntu-latest @@ -9,7 +9,8 @@ jobs: steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}. And Github Token is ${{ secrets.GITHUB_TOKEN }}" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - run: echo "Your Github Token is ${{ secrets.GITHUB_TOKEN }}" - name: Slash Command Dispatch uses: peter-evans/slash-command-dispatch@v2 @@ -17,4 +18,4 @@ jobs: token: ${{ secrets.PAT }} commands: ok-to-test permission: write - - run: echo "🍏 This job's status is ${{ job.status }}." \ No newline at end of file + - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index af280308b..469003a2c 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -1,7 +1,8 @@ +--- name: PR Labeler on: -- pull_request + - pull_request jobs: label: @@ -9,4 +10,4 @@ jobs: steps: - uses: actions/labeler@v2 with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/unit_testing.yml b/.github/workflows/unit_testing.yml index 70c99a43e..d05b487c7 100644 --- a/.github/workflows/unit_testing.yml +++ b/.github/workflows/unit_testing.yml @@ -1,3 +1,4 @@ +--- name: Run compile and tests on: @@ -8,11 +9,12 @@ on: branches: - main jobs: - sanity: - runs-on: ubuntu-latest + sanity1: + name: Sanity tests with ansible-core==2.15.0 + runs-on: ubuntu-20.04 strategy: matrix: - python-version: ['3.9'] + python-version: ["3.9"] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} @@ -20,7 +22,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Setup Docker - uses: docker-practice/actions-setup-docker@v1 + uses: docker-practice/actions-setup-docker@master - name: Install ansible run: | pip install -r requirements.txt @@ -38,10 +40,10 @@ jobs: cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }} ansible-test sanity --docker default --python ${{ matrix.python-version }} -v unit_testing: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: matrix: - python-version: ['3.7', '3.8', '3.9'] + python-version: ["3.9"] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} @@ -49,7 +51,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Setup Docker - uses: docker-practice/actions-setup-docker@v1 + uses: docker-practice/actions-setup-docker@master - name: Install ansible run: | pip install -r requirements.txt @@ -68,18 +70,18 @@ jobs: ansible-test units --docker default --python ${{ matrix.python-version }} --coverage -v ansible-test coverage report --include */plugins/* --omit */utils.py,_fetch_url* > coverage.txt - name: Code Coverage Check - run: | - cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }} - echo "Code coverage: Checking if code coverage is above threshold..." - export TESTCOV_THRESHOLD=55 - echo "Threshold: $TESTCOV_THRESHOLD %" - totalCoverage=`grep TOTAL coverage.txt | awk '{print $6}' | sed 's/%//'` - echo "TOTAL_COVERAGE=${totalCoverage}" >> $GITHUB_ENV - echo "Current test coverage : $totalCoverage %" - if (( $(echo "$totalCoverage $TESTCOV_THRESHOLD" | awk '{print ($1 > $2)}') )); then - echo "Coverage passed" - else - echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value." - echo "Coverage check failed" - exit 1 - fi + run: | + cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }} + echo "Code coverage: Checking if code coverage is above threshold..." + export TESTCOV_THRESHOLD=55 + echo "Threshold: $TESTCOV_THRESHOLD %" + totalCoverage=`grep TOTAL coverage.txt | awk '{print $6}' | sed 's/%//'` + echo "TOTAL_COVERAGE=${totalCoverage}" >> $GITHUB_ENV + echo "Current test coverage : $totalCoverage %" + if (( $(echo "$totalCoverage $TESTCOV_THRESHOLD" | awk '{print ($1 > $2)}') )); then + echo "Coverage passed" + else + echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value." + echo "Coverage check failed" + exit 1 + fi diff --git a/CHANGELOG.md b/CHANGELOG.md index 687147663..a50429e32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,66 @@ -## v1.8.0 (28 Feb 2022) +## v1.9.2 (30 May 2024) + + +**Breaking Changes:** + +- nutanix.ncp collection - Due to all versions of ansible-core less than v2.15.0 are EOL, we are also deprecating support for same and minimum version to use this collection is ansible-core==2.15.0 + [[\#479](https://github.com/nutanix/nutanix.ansible/issues/479)] + +**Full Changelog:** [here](https://github.com/nutanix/nutanix.ansible/compare/v1.9.1...v1.9.2) + + +## v1.9.1 (09 November 2023) + + +**Improvements:** + +- docs - [Imprv] add doc regarding running integration tests locally [[\#435](https://github.com/nutanix/nutanix.ansible/issues/435)] +- info modules - [Imprv] add examples for custom_filter [[\#416](https://github.com/nutanix/nutanix.ansible/issues/416)] +- ndb clones - [Imprv] Enable database clones and clone refresh using latest snapshot flag [[\#391](https://github.com/nutanix/nutanix.ansible/issues/391)] +- ndb clones - [Imprv] add examples for NDB database clone under examples folder [[\#386](https://github.com/nutanix/nutanix.ansible/issues/386)] +- ntnx_prism_vm_inventory - Add support for PC Categories [[\#405](https://github.com/nutanix/nutanix.ansible/issues/405)] +- ntnx_prism_vm_inventory - [Imprv] add examples for dynamic inventory using ntnx_prism_vm_inventory [[\#401](https://github.com/nutanix/nutanix.ansible/issues/401)] +- ntnx_vms - [Imprv] add possibility to specify / modify vm user ownership and project [[\#378](https://github.com/nutanix/nutanix.ansible/issues/378)] +- ntnx_vms - owner association upon vm creation module [[\#359](https://github.com/nutanix/nutanix.ansible/issues/359)] +- ntnx_vms_info - [Imprv] add examples with guest customization for module ntnx_vms [[\#395](https://github.com/nutanix/nutanix.ansible/issues/395)] + +**Bugs:** + +- ntnx_foundation - [Bug] Error when Clusters Block is missing in module ntnx_foundation [[\#397](https://github.com/nutanix/nutanix.ansible/issues/397)] +- ntnx_ndb_time_machines_info - [Bug] ntnx_ndb_time_machines_info not fetching all attributes when name is used for fetching [[\#418](https://github.com/nutanix/nutanix.ansible/issues/418)] +- ntnx_security_rules - Fix Syntax Errors in Create App Security Rule Example [[\#394](https://github.com/nutanix/nutanix.ansible/pull/394/files)] +- ntnx_vms - [Bug] Error when updating size_gb using the int filter in module ntnx_vms [[\#400](https://github.com/nutanix/nutanix.ansible/issues/400)] +- ntnx_vms - [Bug] hard_poweroff has been moved to state from operation [[\#415](https://github.com/nutanix/nutanix.ansible/issues/415)] +- ntnx_vms_clone - [Bug] cannot change boot_config when cloning in module ntnx_vms_clone [[\#360](https://github.com/nutanix/nutanix.ansible/issues/359)] +- website - [Bug] Github page deployment action is failing. [[\#483](https://github.com/nutanix/nutanix.ansible/issues/483)] + +**Full Changelog:** [here](https://github.com/nutanix/nutanix.ansible/compare/v1.9.0...v1.9.1) + +## v1.9.0 (11 July 2023) + + +**Improvements:** + +- ntnx_profiles_info - [Impr] Develop ansible module for getting available IPs for given network profiles in NDB [\#345](https://github.com/nutanix/nutanix.ansible/issues/345) +- ntnx_security_rules - [Imprv] Flow Network Security Multi-Tier support in Security Policy definition [\#319](https://github.com/nutanix/nutanix.ansible/issues/319) + +**Bugs:** + +- info modules - [Bug] Multiple filters params are not considered for fetching entities in PC based info modules [[\#352](https://github.com/nutanix/nutanix.ansible/issues/352)] +- ntnx_foundation - [Bug] clusters parameters not being passed to Foundation Server in module nutanix.ncp.ntnx_foundation [[\#307](https://github.com/nutanix/nutanix.ansible/issues/307)] +- ntnx_karbon_clusters - [Bug] error in sample karbon/create_k8s_cluster.yml [[\#349](https://github.com/nutanix/nutanix.ansible/issues/349)] +- ntnx_karbon_clusters - [Bug] impossible to deploy NKE cluster with etcd using disk smaller than 120GB [[\#350](https://github.com/nutanix/nutanix.ansible/issues/350)] +- ntnx_subnets - [Bug] wrong virtual_switch selected in module ntnx_subnets [\#328](https://github.com/nutanix/nutanix.ansible/issues/328) + +**New Modules:** + +- ntnx_karbon_clusters_node_pools - Create,Update and Delete worker node pools with the provided configuration. +- ntnx_ndb_tags_info - info module for ndb tags info + +**Full Changelog:** [here](https://github.com/nutanix/nutanix.ansible/compare/v1.8.0...v1.9.0) + + +## v1.8.0 (28 Feb 2023) **Features** @@ -139,7 +201,7 @@ **Prism Central** - Ansible module for Image Management - Ansible info module for Image Management -- Ansible module for Image Placement Policy +- Ansible module for Image Placement Policy - Ansible info module for Image Placement Policies - Ansible module for Network Security Rules - Ansible info module for Network Security Rules diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a563534d7..d34f34be6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,79 @@ Nutanix.Ncp Release Notes .. contents:: Topics +v1.9.2 +====== + +Release Summary +--------------- + +Deprecating support for ansible-core less than v2.15.0 + +Breaking Changes / Porting Guide +-------------------------------- + +- nutanix.ncp collection - Due to all versions of ansible-core version less than v2.15.0 are EOL, we are also deprecating support for same and minimum version to use this collection is ansible-core==2.15.0. [[\#479](https://github.com/nutanix/nutanix.ansible/issues/479)] + +v1.9.1 +====== + +Release Summary +--------------- + +This release included bug fixes and improvement. + +Minor Changes +------------- + +- docs - [Imprv] add doc regarding running integration tests locally [[\#435](https://github.com/nutanix/nutanix.ansible/issues/435)] +- info modules - [Imprv] add examples for custom_filter [[\#416](https://github.com/nutanix/nutanix.ansible/issues/416)] +- ndb clones - [Imprv] Enable database clones and clone refresh using latest snapshot flag [[\#391](https://github.com/nutanix/nutanix.ansible/issues/391)] +- ndb clones - [Imprv] add examples for NDB database clone under examples folder [[\#386](https://github.com/nutanix/nutanix.ansible/issues/386)] +- ntnx_prism_vm_inventory - Add support for PC Categories [[\#405](https://github.com/nutanix/nutanix.ansible/issues/405)] +- ntnx_prism_vm_inventory - [Imprv] add examples for dynamic inventory using ntnx_prism_vm_inventory [[\#401](https://github.com/nutanix/nutanix.ansible/issues/401)] +- ntnx_vms - [Imprv] add possibility to specify / modify vm user ownership and project [[\#378](https://github.com/nutanix/nutanix.ansible/issues/378)] +- ntnx_vms - owner association upon vm creation module [[\#359](https://github.com/nutanix/nutanix.ansible/issues/359)] +- ntnx_vms_info - [Imprv] add examples with guest customization for module ntnx_vms [[\#395](https://github.com/nutanix/nutanix.ansible/issues/395)] + +Bugfixes +-------- + +- ntnx_foundation - [Bug] Error when Clusters Block is missing in module ntnx_foundation [[\#397](https://github.com/nutanix/nutanix.ansible/issues/397)] +- ntnx_ndb_time_machines_info - [Bug] ntnx_ndb_time_machines_info not fetching all attributes when name is used for fetching [[\#418](https://github.com/nutanix/nutanix.ansible/issues/418)] +- ntnx_security_rules - Fix Syntax Errors in Create App Security Rule Example [[\#394](https://github.com/nutanix/nutanix.ansible/pull/394/files)] +- ntnx_vms - [Bug] Error when updating size_gb using the int filter in module ntnx_vms [[\#400](https://github.com/nutanix/nutanix.ansible/issues/400)] +- ntnx_vms - [Bug] hard_poweroff has been moved to state from operation [[\#415](https://github.com/nutanix/nutanix.ansible/issues/415)] +- ntnx_vms_clone - [Bug] cannot change boot_config when cloning in module ntnx_vms_clone [[\#360](https://github.com/nutanix/nutanix.ansible/issues/359)] +- website - [Bug] Github page deployment action is failing. [[\#483](https://github.com/nutanix/nutanix.ansible/issues/483)] + +v1.9.0 +====== + +Minor Changes +------------- + +- ntnx_profiles_info - [Impr] Develop ansible module for getting available IPs for given network profiles in NDB [\#345](https://github.com/nutanix/nutanix.ansible/issues/345) +- ntnx_security_rules - [Imprv] Flow Network Security Multi-Tier support in Security Policy definition [\#319](https://github.com/nutanix/nutanix.ansible/issues/319) + +Deprecated Features +------------------- + +- ntnx_security_rules - The ``apptier`` option in target group has been removed. New option called ``apptiers`` has been added to support multi tier policy. + +Bugfixes +-------- + +- info modules - [Bug] Multiple filters params are not considered for fetching entities in PC based info modules [[\#352](https://github.com/nutanix/nutanix.ansible/issues/352)] +- ntnx_foundation - [Bug] clusters parameters not being passed to Foundation Server in module nutanix.ncp.ntnx_foundation [[\#307](https://github.com/nutanix/nutanix.ansible/issues/307)] +- ntnx_karbon_clusters - [Bug] error in sample karbon/create_k8s_cluster.yml [[\#349](https://github.com/nutanix/nutanix.ansible/issues/349)] +- ntnx_karbon_clusters - [Bug] impossible to deploy NKE cluster with etcd using disk smaller than 120GB [[\#350](https://github.com/nutanix/nutanix.ansible/issues/350)] +- ntnx_subnets - [Bug] wrong virtual_switch selected in module ntnx_subnets [\#328](https://github.com/nutanix/nutanix.ansible/issues/328) + +New Modules +----------- + +- ntnx_karbon_clusters_node_pools - Create,Update and Delete a worker node pools with the provided configuration. +- ntnx_ndb_tags_info - info module for ndb tags info v1.8.0 ====== diff --git a/README.md b/README.md index ea8f44acd..76b92b3a0 100644 --- a/README.md +++ b/README.md @@ -10,30 +10,40 @@ It is designed keeping simplicity as the core value. Hence it is Checkout this [blog](https://www.nutanix.dev/2022/08/05/getting-started-with-the-nutanix-ansible-module/) for getting started with nutanix ansible module. +## Support + +Ansible Nutanix Provider leverages the community-supported model. See [Open Source Support](https://portal.nutanix.com/page/documents/kbs/details?targetId=kA07V000000LdWPSA0) for more information about its support policy. + # Version compatibility ## Ansible -This collection and examples has been tested against following versions : - 1. ansible==5.0.1 - 2. ansible-core==2.12.3 +This collection requires ansible-core>=2.15.0 ## Python -This collection requires Python 2.7 or greater +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. -> For the 1.3.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.4. +> For the 1.3.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.4. -> For the 1.4.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.4. +> For the 1.4.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.4. > For the 1.5.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.6, pc.2022.4.0.2 and pc2022.1.0.2. > For the 1.7.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.6, pc.2022.4 and pc2022.1.0.2. -> For the 1.8.0-beta.1 release of the ansible plugin it will have N compatibility with the Prism Central APIs. This release was tested against Prism Central version pc.2022.6 . +> For the 1.8.0 release of the ansible plugin it will have N compatibility with the Prism Central APIs. This release was tested against Prism Central version pc.2022.6 . + +> For the 1.9.0 release of the ansible plugin it will have N-1 compatibility with the Prism Central APIs. This release was tested against Prism Central version pc.2023.1 and pc.2023.1.0.1 . + +> For the 1.9.1 release of the ansible plugin it will have N-1 compatibility with the Prism Central APIs. This release was tested against Prism Central version pc.2023.3 and pc.2023.1.0.2 . + +> 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 @@ -41,11 +51,15 @@ This collection requires Python 2.7 or greater 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. + 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 + Foundation based examples : https://github.com/nutanix/nutanix.ansible/tree/main/examples/foundation ## Foundation Central @@ -54,20 +68,27 @@ Foundation based examples : https://github.com/nutanix/nutanix.ansible/tree/main 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.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 + +> For the 1.9.1 release of the ansible plugin, it was tested against Karbon version v2.8.0 Karbon based examples : https://github.com/nutanix/nutanix.ansible/tree/main/examples/karbon ## Nutanix Database Service (ERA) -> For the 1.8.0-beta.1 release of the ansible plugin, it will have N-1 compatibility with the Nutanix Database Service (ERA). This release was tested against era versions v2.4.1 and v2.4.0 -> For the 1.8.0 release of the ansible plugin, it will have N-1 compatibility with the Nutanix Database Service (ERA). This release was tested against era versions v2.5.0 and v2.5.1 +> For the 1.8.0 release of the ansible plugin, it will have N-1 compatibility with the Nutanix Database Service (ERA). This release was tested against NDB versions v2.5.0 and v2.5.1 + +> For the 1.9.0 release of the ansible plugin, it was tested against NDB versions v2.5.0.2 + +> For the 1.9.1 release of the ansible plugin, it was tested against NDB versions v2.5.1.1 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** @@ -150,6 +171,7 @@ ansible-playbook examples/iaas/iaas.yml | ntnx_image_placement_policies_info | List existing image placement policies. | | ntnx_karbon_clusters | Create, Delete k8s clusters | | ntnx_karbon_clusters_info | Get clusters info. | +| ntnx_karbon_clusters_node_pools | Update node pools of kubernetes cluster | | ntnx_karbon_registries | Create, Delete a karbon private registry entry | | ntnx_karbon_registries_info | Get karbon private registry registry info. | | ntnx_pbrs | Create or delete a PBR. | @@ -211,6 +233,7 @@ ansible-playbook examples/iaas/iaas.yml | ntnx_ndb_stretched_vlans | Get stretched vlans inf in NDB | | ntnx_ndb_time_machine_clusters | Manage clusters in NDB time machines | | ntnx_ndb_tags | Create, update and delete tags | +| ntnx_ndb_tags_info | Get tags info | | ntnx_ndb_database_clones | Create, update and delete database clones | | ntnx_ndb_database_snapshots | Create, update and delete database snapshots | | ntnx_ndb_database_clone_refresh | Perform database clone refresh | @@ -246,6 +269,56 @@ We glady welcome contributions from the community. From updating the documentati * [Contributing Guide](CONTRIBUTING.md) * [Code of Conduct](CODE_OF_CONDUCT.md) +# Testing + +## Integration Testing for Nutanix Ansible Modules + +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` + +### 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. + +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 + ``` + +### Running Integration Tests +1. Conduct integration tests for all modules using: + ```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. + +### 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 + ``` + +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 diff --git a/_config.yml b/_config.yml index c4192631f..277f1f2c5 100644 --- a/_config.yml +++ b/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-cayman \ No newline at end of file +theme: jekyll-theme-cayman diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index d8e442afb..4d6506826 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -387,3 +387,73 @@ releases: name: ntnx_ndb_time_machines_info namespace: '' release_date: '2022-10-20' + 1.9.0: + changes: + bugfixes: + - info modules - [Bug] Multiple filters params are not considered for fetching + entities in PC based info modules [[\#352](https://github.com/nutanix/nutanix.ansible/issues/352)] + - ntnx_foundation - [Bug] clusters parameters not being passed to Foundation + Server in module nutanix.ncp.ntnx_foundation [[\#307](https://github.com/nutanix/nutanix.ansible/issues/307)] + - ntnx_karbon_clusters - [Bug] error in sample karbon/create_k8s_cluster.yml + [[\#349](https://github.com/nutanix/nutanix.ansible/issues/349)] + - ntnx_karbon_clusters - [Bug] impossible to deploy NKE cluster with etcd using + disk smaller than 120GB [[\#350](https://github.com/nutanix/nutanix.ansible/issues/350)] + - ntnx_subnets - [Bug] wrong virtual_switch selected in module ntnx_subnets + [\#328](https://github.com/nutanix/nutanix.ansible/issues/328) + deprecated_features: + - ntnx_security_rules - The ``apptier`` option in target group has been removed. + New option called ``apptiers`` has been added to support multi tier policy. + minor_changes: + - ntnx_profiles_info - [Impr] Develop ansible module for getting available IPs + for given network profiles in NDB [\#345](https://github.com/nutanix/nutanix.ansible/issues/345) + - ntnx_security_rules - [Imprv] Flow Network Security Multi-Tier support in + Security Policy definition [\#319](https://github.com/nutanix/nutanix.ansible/issues/319) + modules: + - description: Create,Update and Delete a worker node pools with the provided + configuration. + name: ntnx_karbon_clusters_node_pools + namespace: '' + - description: info module for ndb tags info + name: ntnx_ndb_tags_info + namespace: '' + release_date: '2023-07-11' + 1.9.1: + changes: + bugfixes: + - ntnx_foundation - [Bug] Error when Clusters Block is missing in module ntnx_foundation + [[\#397](https://github.com/nutanix/nutanix.ansible/issues/397)] + - ntnx_ndb_time_machines_info - [Bug] ntnx_ndb_time_machines_info not fetching + all attributes when name is used for fetching [[\#418](https://github.com/nutanix/nutanix.ansible/issues/418)] + - ntnx_security_rules - Fix Syntax Errors in Create App Security Rule Example + [[\#394](https://github.com/nutanix/nutanix.ansible/pull/394/files)] + - ntnx_vms - [Bug] Error when updating size_gb using the int filter in module + ntnx_vms [[\#400](https://github.com/nutanix/nutanix.ansible/issues/400)] + - ntnx_vms - [Bug] hard_poweroff has been moved to state from operation [[\#415](https://github.com/nutanix/nutanix.ansible/issues/415)] + - ntnx_vms_clone - [Bug] cannot change boot_config when cloning in module ntnx_vms_clone + [[\#360](https://github.com/nutanix/nutanix.ansible/issues/359)] + - website - [Bug] Github page deployment action is failing. [[\#483](https://github.com/nutanix/nutanix.ansible/issues/483)] + minor_changes: + - docs - [Imprv] add doc regarding running integration tests locally [[\#435](https://github.com/nutanix/nutanix.ansible/issues/435)] + - info modules - [Imprv] add examples for custom_filter [[\#416](https://github.com/nutanix/nutanix.ansible/issues/416)] + - ndb clones - [Imprv] Enable database clones and clone refresh using latest + snapshot flag [[\#391](https://github.com/nutanix/nutanix.ansible/issues/391)] + - ndb clones - [Imprv] add examples for NDB database clone under examples folder + [[\#386](https://github.com/nutanix/nutanix.ansible/issues/386)] + - ntnx_prism_vm_inventory - Add support for PC Categories [[\#405](https://github.com/nutanix/nutanix.ansible/issues/405)] + - ntnx_prism_vm_inventory - [Imprv] add examples for dynamic inventory using + ntnx_prism_vm_inventory [[\#401](https://github.com/nutanix/nutanix.ansible/issues/401)] + - ntnx_vms - [Imprv] add possibility to specify / modify vm user ownership and + project [[\#378](https://github.com/nutanix/nutanix.ansible/issues/378)] + - ntnx_vms - owner association upon vm creation module [[\#359](https://github.com/nutanix/nutanix.ansible/issues/359)] + - ntnx_vms_info - [Imprv] add examples with guest customization for module ntnx_vms + [[\#395](https://github.com/nutanix/nutanix.ansible/issues/395)] + release_summary: This release included bug fixes and improvement. + release_date: '2023-10-09' + 1.9.2: + changes: + breaking_changes: + - nutanix.ncp collection - Due to all versions of ansible-core version less + than v2.15.0 are EOL, we are also deprecating support for same and minimum + version to use this collection is ansible-core==2.15.0. [[\#479](https://github.com/nutanix/nutanix.ansible/issues/479)] + release_summary: Deprecating support for ansible-core less than v2.15.0 + release_date: '2024-05-30' diff --git a/examples/README.md b/examples/README.md index 3db7f6b17..1dc9b0c26 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,4 +1,4 @@ ## Examples Dependency These examples has been tested against following versions : 1. ansible==5.0.1 - 2. ansible-core==2.12.3 \ No newline at end of file + 2. ansible-core==2.12.3 diff --git a/examples/acp_info.yml b/examples/acp_info.yml index a05b6ef64..41850e614 100644 --- a/examples/acp_info.yml +++ b/examples/acp_info.yml @@ -12,7 +12,7 @@ validate_certs: false tasks: - + - name: List ACPs using ascending, sorting and name filter ntnx_floating_ips_info: filter: diff --git a/examples/address_groups_crud.yml b/examples/address_groups_crud.yml index 4b8612bb6..35e5febdb 100644 --- a/examples/address_groups_crud.yml +++ b/examples/address_groups_crud.yml @@ -21,31 +21,29 @@ - network_ip: "10.1.2.2" network_prefix: 32 register: ag - + - name: update address group ntnx_address_groups: state: present - address_group_uuid: "{{ag.address_group_uuid}}" + address_group_uuid: "{{ ag.address_group_uuid }}" name: test-ansible-group-1-updated desc: test-ansible-group-1-desc-updated subnets: - network_ip: "10.1.3.0" network_prefix: 24 register: updated_ag - + - name: Read the updated address group ntnx_address_groups_info: - address_group_uuid: "{{updated_ag.address_group_uuid}}" + address_group_uuid: "{{ updated_ag.address_group_uuid }}" register: ag_info - + - name: Print the address group details debug: - msg: "{{ag_info}}" + msg: "{{ ag_info }}" - - name: Delete the address group. + - name: Delete the address group. ntnx_address_groups: state: absent - address_group_uuid: "{{updated_ag.address_group_uuid}}" + address_group_uuid: "{{ updated_ag.address_group_uuid }}" register: op - - \ No newline at end of file diff --git a/examples/category_crud.yml b/examples/category_crud.yml index 5bab0cfc5..3c4c6b12e 100644 --- a/examples/category_crud.yml +++ b/examples/category_crud.yml @@ -24,7 +24,7 @@ values: - "val1" - "val2" - + - name: Create category key with values ntnx_categories: state: "present" @@ -34,7 +34,7 @@ - "val3" - "val4" register: cat2 - + - name: Add more category values to test-cat-2 ntnx_categories: state: "present" @@ -47,28 +47,22 @@ ntnx_categories_info: name: "test-cat-1" register: cat1_info - + - name: Delete val1 category value from test-cat-1 ntnx_categories: state: absent name: "test-cat-1" values: - val1 - + - name: delete all category values from test-cat-1 ntnx_categories: state: absent name: "test-cat-1" remove_values: true - - name: delete category key test-cat-2 including its all values + - name: delete category key test-cat-2 including its all values ntnx_categories: state: absent name: "test-cat-2" remove_values: true - - - - - - \ No newline at end of file diff --git a/examples/clusters_info.yml b/examples/clusters_info.yml index 12c0ec7c2..c50b8286b 100644 --- a/examples/clusters_info.yml +++ b/examples/clusters_info.yml @@ -11,7 +11,7 @@ nutanix_password: validate_certs: false - tasks: + tasks: - name: test getting all clusters ntnx_clusters_info: register: clusters @@ -28,3 +28,11 @@ sort_order: "ASCENDING" sort_attribute: "name" register: result + + - name: List clusters using filter and custom_filter + ntnx_clusters_info: + filter: + name: + custom_filter: + external_ip: + register: result diff --git a/examples/dr/protection_policy.yml b/examples/dr/protection_policy.yml index 2a13f786f..1b5a2d816 100644 --- a/examples/dr/protection_policy.yml +++ b/examples/dr/protection_policy.yml @@ -51,7 +51,7 @@ nutanix_password: "" validate_certs: false state: "absent" - rule_uuid: "{{pr.rule_uuid}}" + rule_uuid: "{{ pr.rule_uuid }}" - name: Create protection rule with async schedule ntnx_protection_rules: @@ -98,7 +98,7 @@ remote_retention_policy: num_snapshots: 1 register: result - + - name: Update previously created protection policy ntnx_protection_rules: nutanix_host: "" @@ -144,18 +144,18 @@ remote_retention_policy: num_snapshots: 2 register: pr - + - name: Get protection policy info and its associated vms info ntnx_protection_rules_info: nutanix_host: "" nutanix_username: "" nutanix_password: "" validate_certs: false - rule_uuid: "{{pr.rule_uuid}}" + rule_uuid: "{{ pr.rule_uuid }}" register: result - debug: - msg: "{{result}}" + msg: "{{ result }}" - name: delete the protection rule ntnx_protection_rules: @@ -164,5 +164,4 @@ nutanix_password: "" validate_certs: false state: "absent" - rule_uuid: "{{pr.rule_uuid}}" - \ No newline at end of file + rule_uuid: "{{ pr.rule_uuid }}" diff --git a/examples/dr/recovery_plan_with_execution.yml b/examples/dr/recovery_plan_with_execution.yml index b99c92c29..561536001 100644 --- a/examples/dr/recovery_plan_with_execution.yml +++ b/examples/dr/recovery_plan_with_execution.yml @@ -73,7 +73,7 @@ - debug: - msg: "{{result}}" + msg: "{{ result }}" - name: Update recovery plan by adding more stages and remove custom IP to enable dynamic IP allocation @@ -164,7 +164,7 @@ ignore_errors: True - debug: - msg: "{{result}}" + msg: "{{ result }}" ###################################### delete the recovery plan ################# @@ -177,4 +177,4 @@ job_uuid: "{{migrate_job.job_uuid}}" plan_uuid: "{{recovery_plan.plan_uuid}}" state: "absent" - register: result \ No newline at end of file + register: result diff --git a/examples/fc/api_keys_create.yml b/examples/fc/api_keys_create.yml index 6ffaf0e1e..41a5df90c 100644 --- a/examples/fc/api_keys_create.yml +++ b/examples/fc/api_keys_create.yml @@ -14,7 +14,7 @@ validate_certs: false alias: "test-alias" register: output - + - name: output of api_key debug: - msg: '{{ output }}' \ No newline at end of file + msg: '{{ output }}' diff --git a/examples/fc/api_keys_info.yml b/examples/fc/api_keys_info.yml index 431cb5ab8..7ea8513e5 100644 --- a/examples/fc/api_keys_info.yml +++ b/examples/fc/api_keys_info.yml @@ -6,7 +6,7 @@ - nutanix.ncp tasks: - - name: API key response with alias + - name: API key response with alias ntnx_foundation_central_api_keys: nutanix_host: "{{ pc }}" nutanix_username: "{{ username }}" @@ -15,7 +15,7 @@ alias: "test" register: output - - name: API key response with key_uuid + - name: API key response with key_uuid ntnx_foundation_central_api_keys: nutanix_host: "{{ pc }}" nutanix_username: "{{ username }}" @@ -23,7 +23,7 @@ validate_certs: false key_uuid: "" register: output - + - name: output of api_key debug: - msg: '{{ output }}' \ No newline at end of file + msg: '{{ output }}' diff --git a/examples/fc/fc.yml b/examples/fc/fc.yml index 9fcce4e1c..00f9732fb 100644 --- a/examples/fc/fc.yml +++ b/examples/fc/fc.yml @@ -95,6 +95,6 @@ url: "" register: output - - name: output of list + - name: output of list debug: msg: '{{ output }}' diff --git a/examples/fc/imaged_cluster_info.yml b/examples/fc/imaged_cluster_info.yml index a1a138716..6e23546a7 100644 --- a/examples/fc/imaged_cluster_info.yml +++ b/examples/fc/imaged_cluster_info.yml @@ -37,4 +37,4 @@ - name: details of imaged-clusters debug: - msg: '{{ output }}' \ No newline at end of file + msg: '{{ output }}' diff --git a/examples/fc/imaged_nodes_info.yml b/examples/fc/imaged_nodes_info.yml index c0c1ef607..3eda3012d 100644 --- a/examples/fc/imaged_nodes_info.yml +++ b/examples/fc/imaged_nodes_info.yml @@ -35,6 +35,6 @@ model: "" register: output - - name: details of imaged node + - name: details of imaged node debug: - msg: '{{ output }}' \ No newline at end of file + msg: '{{ output }}' diff --git a/examples/fip.yml b/examples/fip.yml index 44f0a7854..0fb7976c2 100644 --- a/examples/fip.yml +++ b/examples/fip.yml @@ -15,7 +15,7 @@ set_fact: external_subnet_name: "" vm_name: "" - + - name: Create floating ip with external subnet uuid ntnx_floating_ips: state: present @@ -24,7 +24,7 @@ name: "{{ external_subnet_name }}" register: result - - name: Assign floating ip to vm + - name: Assign floating ip to vm ntnx_floating_ips: state: present external_subnet: diff --git a/examples/fip_info.yml b/examples/fip_info.yml index ac17a5231..3d92c2c20 100644 --- a/examples/fip_info.yml +++ b/examples/fip_info.yml @@ -12,7 +12,7 @@ validate_certs: false tasks: - + - name: List floating_ips using ascending ip sorting and floating_ip filter ntnx_floating_ips_info: filter: @@ -29,3 +29,12 @@ offset: 0 register: result ignore_errors: True + + + - name: List floating_ips using filter and custom_filter + ntnx_floating_ips_info: + filter: + name: + custom_filter: + private_ip: + register: result diff --git a/examples/foundation/get_images_info.yml b/examples/foundation/get_images_info.yml index a8d74b665..9ee06f18b 100644 --- a/examples/foundation/get_images_info.yml +++ b/examples/foundation/get_images_info.yml @@ -14,8 +14,8 @@ ntnx_foundation_aos_packages_info: nutanix_host: "10.xx.xx.xx" register: nos - + - debug: msg: "{{ hyp }}" - debug: - msg: "{{ nos }}" \ No newline at end of file + msg: "{{ nos }}" diff --git a/examples/foundation/image_nodes.yml b/examples/foundation/image_nodes.yml index 1490f9fd5..6e2b7cb58 100644 --- a/examples/foundation/image_nodes.yml +++ b/examples/foundation/image_nodes.yml @@ -1,4 +1,4 @@ -# Here we will image three kind of nodes with different methods. +# Here we will image three kind of nodes with different methods. # We will image one node using manual mode. Second node, which can be dos running node, will be imaged using discovery mode using cvm # Third node, which can be nutanix imaged(aos running) node, will be imaged using discovery mode using IPMI - name: Image nodes @@ -52,7 +52,7 @@ hypervisor_hostname: "superman3" clusters: - redundancy_factor: 2 - cluster_members: + cluster_members: - "10.xx.xx.xx" - "10.xx.xx.xx" - "10.xx.xx.xx" @@ -60,4 +60,4 @@ register: output - debug: - msg: '{{ output }}' \ No newline at end of file + msg: '{{ output }}' diff --git a/examples/foundation/ipmi_config.yml b/examples/foundation/ipmi_config.yml index a3a6d3f4a..20fce2b9f 100644 --- a/examples/foundation/ipmi_config.yml +++ b/examples/foundation/ipmi_config.yml @@ -20,4 +20,4 @@ register: output - debug: - msg: '{{ output }}' \ No newline at end of file + msg: '{{ output }}' diff --git a/examples/foundation/node_discovery_network_info.yml b/examples/foundation/node_discovery_network_info.yml index 40bb7d017..2f81eb083 100644 --- a/examples/foundation/node_discovery_network_info.yml +++ b/examples/foundation/node_discovery_network_info.yml @@ -11,7 +11,7 @@ # unskip line 12 to include configured(nodes part of cluster) nodes in the output # include_configured: true register: discovered_nodes - + # get network info of nodes discovered from ntnx_foundation_discover_nodes_info module - name: Get node network info of some discovered nodes ntnx_foundation_node_network_info: @@ -21,5 +21,5 @@ - "{{discovered_nodes.blocks.1.nodes.0.ipv6_address}}" register: result - - debug: - msg: "{{ result }}" \ No newline at end of file + - debug: + msg: "{{ result }}" diff --git a/examples/hosts_info.yml b/examples/hosts_info.yml index ea7483968..f478b5249 100644 --- a/examples/hosts_info.yml +++ b/examples/hosts_info.yml @@ -11,7 +11,7 @@ nutanix_password: validate_certs: false - tasks: + tasks: - name: test getting all hosts ntnx_hosts_info: register: hosts @@ -29,3 +29,11 @@ sort_attribute: "name" register: result ignore_errors: True + + - name: List hosts using filter and custom_filter + ntnx_hosts_info: + filter: + name: + custom_filter: + serial_number: + register: result diff --git a/examples/iaas/iaas.yml b/examples/iaas/iaas.yml index 736e84a52..1275e3521 100644 --- a/examples/iaas/iaas.yml +++ b/examples/iaas/iaas.yml @@ -3,7 +3,7 @@ hosts: localhost gather_facts: false collections: - - nutanix.ncp + - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: diff --git a/examples/iaas/roles/external_subnet/tasks/external_subnet.yml b/examples/iaas/roles/external_subnet/tasks/external_subnet.yml index 651191bea..b4c232d4e 100644 --- a/examples/iaas/roles/external_subnet/tasks/external_subnet.yml +++ b/examples/iaas/roles/external_subnet/tasks/external_subnet.yml @@ -17,6 +17,6 @@ end_ip: "{{ item.eip }}" register: external_network - debug: - msg: - - "name: Ext_Nat" - - "uuid: {{ external_network.subnet_uuid }}" \ No newline at end of file + msg: + - "name: Ext_Nat" + - "uuid: {{ external_network.subnet_uuid }}" diff --git a/examples/iaas/roles/external_subnet/tasks/main.yml b/examples/iaas/roles/external_subnet/tasks/main.yml index f0e2653a4..d0a8dcff9 100644 --- a/examples/iaas/roles/external_subnet/tasks/main.yml +++ b/examples/iaas/roles/external_subnet/tasks/main.yml @@ -2,4 +2,4 @@ - name: Inputs for external subnets task include_tasks: external_subnet.yml with_items: - - { name: "{{external_subnet.name}}", vlan_id: "{{external_subnet.vlan_id}}", ip: "{{external_subnet.ip}}", prefix: "{{external_subnet.prefix}}", gip: "{{external_subnet.gip}}", sip: "{{external_subnet.sip}}", eip: "{{external_subnet.eip}}", eNat: "{{external_subnet.eNat}}" } \ No newline at end of file + - { name: "{{external_subnet.name}}", vlan_id: "{{external_subnet.vlan_id}}", ip: "{{external_subnet.ip}}", prefix: "{{external_subnet.prefix}}", gip: "{{external_subnet.gip}}", sip: "{{external_subnet.sip}}", eip: "{{external_subnet.eip}}", eNat: "{{external_subnet.eNat}}" } diff --git a/examples/iaas/roles/fip/tasks/fip.yml b/examples/iaas/roles/fip/tasks/fip.yml index 73cc943c3..9db0eda42 100644 --- a/examples/iaas/roles/fip/tasks/fip.yml +++ b/examples/iaas/roles/fip/tasks/fip.yml @@ -10,4 +10,4 @@ - debug: msg: - "VM name: {{ item.vm_name }}" - - "uuid: {{ fip.fip_uuid }}" \ No newline at end of file + - "uuid: {{ fip.fip_uuid }}" diff --git a/examples/iaas/roles/overlay_subnet/tasks/overlay_subnet.yml b/examples/iaas/roles/overlay_subnet/tasks/overlay_subnet.yml index b6b16ea5c..50866ba23 100644 --- a/examples/iaas/roles/overlay_subnet/tasks/overlay_subnet.yml +++ b/examples/iaas/roles/overlay_subnet/tasks/overlay_subnet.yml @@ -21,4 +21,4 @@ - debug: msg: - "name: {{ overlay.response.status.name }}" - - "uuid: {{ overlay.subnet_uuid }}" \ No newline at end of file + - "uuid: {{ overlay.subnet_uuid }}" diff --git a/examples/iaas/roles/pbr/tasks/pbr.yml b/examples/iaas/roles/pbr/tasks/pbr.yml index 008c9844e..760c69621 100644 --- a/examples/iaas/roles/pbr/tasks/pbr.yml +++ b/examples/iaas/roles/pbr/tasks/pbr.yml @@ -19,4 +19,4 @@ - debug: msg: - "vpc_name: {{ item.vpc_name }}" - - "uuid: {{ pbr.pbr_uuid }}" \ No newline at end of file + - "uuid: {{ pbr.pbr_uuid }}" diff --git a/examples/iaas/roles/pbr_delete/tasks/pbr_delete.yml b/examples/iaas/roles/pbr_delete/tasks/pbr_delete.yml index 9d21d90f0..dd2562cf1 100644 --- a/examples/iaas/roles/pbr_delete/tasks/pbr_delete.yml +++ b/examples/iaas/roles/pbr_delete/tasks/pbr_delete.yml @@ -6,4 +6,4 @@ register: pbr - debug: msg: - - "uuid: {{ pbr.pbr_uuid }}" \ No newline at end of file + - "uuid: {{ pbr.pbr_uuid }}" diff --git a/examples/iaas/roles/static_route/tasks/static_route.yml b/examples/iaas/roles/static_route/tasks/static_route.yml index 1163f36dd..924571431 100644 --- a/examples/iaas/roles/static_route/tasks/static_route.yml +++ b/examples/iaas/roles/static_route/tasks/static_route.yml @@ -10,5 +10,5 @@ name: "{{ item.subnet_name }}" register: static_route - debug: - msg: + msg: - "uuid: {{ static_route.response.metadata.uuid }}" diff --git a/examples/iaas/roles/vm/tasks/main.yml b/examples/iaas/roles/vm/tasks/main.yml index 832335cef..7c3949250 100644 --- a/examples/iaas/roles/vm/tasks/main.yml +++ b/examples/iaas/roles/vm/tasks/main.yml @@ -5,4 +5,4 @@ - {name: "Prod-Wordpress-App", desc: "Prod-Wordpress-App", is_connected: True, subnet_name: "{{Prod_SubnetA.name}}", image_name: "wordpress-appserver", private_ip: ""} - {name: "Prod-Wordpress-DB", desc: "Prod-Wordpress-DB", is_connected: True, subnet_name: "{{Prod_SubnetB.name}}", 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.name}}", image_name: "wordpress-appserver", private_ip: ""} - - {name: "Dev-Wordpress-DB", desc: "Dev-Wordpress-DB", is_connected: True, subnet_name: "{{Dev_SubnetB.name}}", image_name: "wordpress-db", private_ip: 10.1.2.5} \ No newline at end of file + - {name: "Dev-Wordpress-DB", desc: "Dev-Wordpress-DB", is_connected: True, subnet_name: "{{Dev_SubnetB.name}}", image_name: "wordpress-db", private_ip: 10.1.2.5} diff --git a/examples/iaas/roles/vm/tasks/vm.yml b/examples/iaas/roles/vm/tasks/vm.yml index d866fe0ef..ca2332e4c 100644 --- a/examples/iaas/roles/vm/tasks/vm.yml +++ b/examples/iaas/roles/vm/tasks/vm.yml @@ -21,4 +21,4 @@ - debug: msg: - "name: {{ vm.response.status.name }}" - - "uuid: {{ vm.vm_uuid }}" \ No newline at end of file + - "uuid: {{ vm.vm_uuid }}" diff --git a/examples/iaas/roles/vpc/tasks/vpc.yml b/examples/iaas/roles/vpc/tasks/vpc.yml index ebb989d09..a87d5b5d2 100644 --- a/examples/iaas/roles/vpc/tasks/vpc.yml +++ b/examples/iaas/roles/vpc/tasks/vpc.yml @@ -11,4 +11,4 @@ - "name: {{ vpc.response.status.name }}" - "uuid: {{ vpc.vpc_uuid }}" - set_fact: - vpc_uuids: "{{ vpc_uuids + [ vpc.vpc_uuid ] }}" \ No newline at end of file + vpc_uuids: "{{ vpc_uuids + [ vpc.vpc_uuid ] }}" diff --git a/examples/images.yml b/examples/images.yml index 1b19a917e..82f11491d 100644 --- a/examples/images.yml +++ b/examples/images.yml @@ -17,7 +17,7 @@ source_path: "" source_uri: "" clusters_name: "" - + - name: create image from local workstation ntnx_images: state: "present" @@ -81,4 +81,3 @@ state: "absent" image_uuid: "00000000-0000-0000-0000-000000000000" wait: true - \ No newline at end of file diff --git a/examples/inventory/ansible.cfg b/examples/inventory/ansible.cfg new file mode 100644 index 000000000..0dd8c2275 --- /dev/null +++ b/examples/inventory/ansible.cfg @@ -0,0 +1,5 @@ +[defaults] +inventory = nutanix.yaml + +[inventory] +enable_plugins = nutanix.ncp.ntnx_prism_vm_inventory diff --git a/examples/inventory/nutanix.yaml b/examples/inventory/nutanix.yaml new file mode 100644 index 000000000..89f3c20ce --- /dev/null +++ b/examples/inventory/nutanix.yaml @@ -0,0 +1,13 @@ +plugin: nutanix.ncp.ntnx_prism_vm_inventory +nutanix_hostname: +nutanix_username: +nutanix_password: +validate_certs: false +data: {"offset": 0, "length": 1000} +groups: + group_1: "'' in name" + group_2: "''==name" +keyed_groups: + - prefix: "host" + separator: ':' + key: "ansible_host" diff --git a/examples/karbon/cluster_info.yml b/examples/karbon/cluster_info.yml index 937073c32..b5e916b25 100644 --- a/examples/karbon/cluster_info.yml +++ b/examples/karbon/cluster_info.yml @@ -11,11 +11,11 @@ nutanix_password: validate_certs: false - tasks: + tasks: - set_fact: cluster_name: - - name: test getting cluster using name + - name: test getting cluster using name ntnx_karbon_clusters_info: cluster_name: "{{cluster_name}}" register: result diff --git a/examples/karbon/create_k8s_cluster.yml b/examples/karbon/create_k8s_cluster.yml index 08c919fe3..689975485 100644 --- a/examples/karbon/create_k8s_cluster.yml +++ b/examples/karbon/create_k8s_cluster.yml @@ -11,7 +11,7 @@ nutanix_password: validate_certs: false - tasks: + tasks: - set_fact: cluster: name: @@ -20,7 +20,9 @@ name: uuid: storage_class: - name: + name: + storage_container: + name: cni: node_cidr_mask_size: 24 service_ipv4_cidr: "172.19.0.0/16" @@ -53,13 +55,13 @@ nutanix_cluster_password: "{{nutanix_cluster_password}}" nutanix_cluster_username: "{{nutanix_cluster_username}}" default_storage_class: True - name: test-storage-class + name: "{{storage_class.name}}" reclaim_policy: Delete - storage_container: "{{storage_class.name}}" + storage_container: "{{storage_container.name}}" file_system: ext4 flash_mode: False register: result - + - name: delete dev cluster ntnx_karbon_clusters: state: absent @@ -100,13 +102,42 @@ nutanix_cluster_password: "{{nutanix_cluster_password}}" nutanix_cluster_username: "{{nutanix_cluster_username}}" default_storage_class: True - name: test-storage-class + name: "{{storage_class.name}}" reclaim_policy: Retain - storage_container: "{{storage_class.name}}" + storage_container: "{{storage_container.name}}" file_system: xfs flash_mode: true register: result + - name: Create worker node pool with subnet uuid + ntnx_karbon_clusters_node_pools: + node_subnet: + uuid: "" + node_pool_name: "{{karbon_name}}" + cluster_name: "{{cluster.name}}" + pool_config: + num_instances: 2 + cpu: 4 + memory_gb: 8 + disk_gb: 120 + register: result + ignore_errors: true + + - name: update pool by increasing cpu,memory_gb,num_instances and add labels + ntnx_karbon_clusters_node_pools: + wait: True + node_pool_name: "{{karbon_name}}" + cluster_name: "{{cluster.name}}" + pool_config: + cpu: 6 + memory_gb: 10 + disk_gb: 150 + num_instances: 4 + add_labels: + property1: "test-property1" + register: result + ignore_errors: true + - name: create prod cluster ntnx_karbon_clusters: cluster: @@ -126,7 +157,7 @@ nutanix_cluster_password: "{{nutanix_cluster_password}}" nutanix_cluster_username: "{{nutanix_cluster_username}}" default_storage_class: True - name: test-storage-class + name: "{{storage_class.name}}" reclaim_policy: Delete storage_container: "{{storage_container.name}}" file_system: ext4 @@ -148,4 +179,4 @@ cpu: 8 memory_gb: 8 disk_gb: 240 - register: result \ No newline at end of file + register: result diff --git a/examples/karbon/create_registries.yml b/examples/karbon/create_registries.yml index 70f40c2d3..42c75e310 100644 --- a/examples/karbon/create_registries.yml +++ b/examples/karbon/create_registries.yml @@ -1,5 +1,5 @@ --- -- name: create registeries +- name: create registeries hosts: localhost gather_facts: false collections: @@ -11,7 +11,7 @@ nutanix_password: validate_certs: false - tasks: + tasks: - set_fact: registry_name: url: diff --git a/examples/karbon/registries_info.yml b/examples/karbon/registries_info.yml index 122f2d019..81c2d8742 100644 --- a/examples/karbon/registries_info.yml +++ b/examples/karbon/registries_info.yml @@ -1,5 +1,5 @@ --- -- name: get registeries info +- name: get registeries info hosts: localhost gather_facts: false collections: diff --git a/examples/ndb/README.md b/examples/ndb/README.md index dbe51d2f3..761d0ec59 100644 --- a/examples/ndb/README.md +++ b/examples/ndb/README.md @@ -84,7 +84,7 @@ Example playbook task to deploy single instance postgres type database in NDB is create_new_server: name: postgres_server_ansible password: temp_password - cluster: + cluster: name: TempCluster software_profile: name: POSTGRES_10.4_OOB @@ -93,7 +93,7 @@ Example playbook task to deploy single instance postgres type database in NDB is compute_profile: name: DEFAULT_OOB_SMALL_COMPUTE pub_ssh_key: "" - + postgres: listener_port: "5432" db_name: test_ansible diff --git a/examples/ndb/all_day2_actions.yml b/examples/ndb/all_day2_actions.yml index 9320ae047..4322a1302 100644 --- a/examples/ndb/all_day2_actions.yml +++ b/examples/ndb/all_day2_actions.yml @@ -35,14 +35,14 @@ ntnx_ndb_database_snapshots: name: "{{snapshot_name}}2" time_machine_uuid: "{{time_machine_uuid}}" - expiry_days: 4 + expiry_days: 4 register: result - set_fact: snapshot_uuid: "{{result.snapshot_uuid}}" - name: rename snapshot - ntnx_ndb_database_snapshots: + ntnx_ndb_database_snapshots: snapshot_uuid: "{{snapshot_uuid}}" name: "{{snapshot_name}}2-updated" register: result @@ -54,13 +54,13 @@ register: result - name: remove expiry schedule - ntnx_ndb_database_snapshots: + ntnx_ndb_database_snapshots: snapshot_uuid: "{{snapshot_uuid}}" remove_expiry: true register: result - name: Add expiry schedule and rename - ntnx_ndb_database_snapshots: + ntnx_ndb_database_snapshots: snapshot_uuid: "{{snapshot_uuid}}" name: "{{snapshot_name}}2" expiry_days: 6 @@ -101,7 +101,7 @@ db_uuid: "{{db_uuid}}" snapshot_uuid: "{{snapshot_uuid}}" register: result - + ########################################### scaling ########################################### - name: extend database storage for scaling database @@ -118,7 +118,7 @@ - name: add databases in database instance ntnx_ndb_linked_databases: db_instance_uuid: "{{db_uuid}}" - databases: + databases: - test1 - test2 register: result @@ -127,5 +127,5 @@ ntnx_ndb_linked_databases: state: "absent" db_instance_uuid: "{{db_uuid}}" - database_uuid: "{{linked_databases.test1}}" + database_uuid: "{{linked_databases.test1}}" register: result diff --git a/examples/ndb/create_clone.yml b/examples/ndb/create_clone.yml new file mode 100644 index 000000000..468058423 --- /dev/null +++ b/examples/ndb/create_clone.yml @@ -0,0 +1,121 @@ +--- +- name: Create clone + hosts: localhost + gather_facts: false + collections: + - nutanix.ncp + module_defaults: + group/nutanix.ncp.ntnx: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + + tasks: + - set_fact: + clone_db: + name: + db_params_profile: + name: + vm: + name: + password: + cluster: + name: + network_profile: + name: + compute_profile: + name: + public_ssh_key: + time_machine: + name: