From b2f4c72685b1103e821dce028391728c9734600c Mon Sep 17 00:00:00 2001 From: george-ghawali Date: Tue, 24 Sep 2024 16:13:35 +0300 Subject: [PATCH 1/2] Adding ansible lint fixes for examples directory --- .github/workflows/ansible-lint.yml | 17 + examples/acp.yml | 9 +- examples/acp_info.yml | 11 +- examples/address_groups_crud.yml | 14 +- examples/category_crud.yml | 24 +- examples/clusters_info.yml | 44 ++- examples/dr/protection_policy.yml | 294 ++++++++------- examples/dr/recovery_plan_with_execution.yml | 310 +++++++-------- examples/fc/api_keys_create.yml | 25 +- examples/fc/api_keys_info.yml | 41 +- examples/fc/fc.yml | 177 +++++---- examples/fc/imaged_cluster_info.yml | 61 ++- examples/fc/imaged_nodes_info.yml | 61 ++- examples/fip.yml | 12 +- examples/fip_info.yml | 14 +- examples/foundation/get_images_info.yml | 21 +- examples/foundation/image_nodes.yml | 106 +++--- examples/foundation/image_upload.yml | 16 +- examples/foundation/ipmi_config.yml | 28 +- .../node_discovery_network_info.yml | 32 +- examples/hosts_info.yml | 46 ++- examples/iaas/iaas.yml | 22 +- examples/iaas/policies_create.yml | 7 +- examples/iaas/policies_delete.yml | 5 +- .../iaas/roles/external_subnet/meta/main.yml | 5 +- .../external_subnet/tasks/external_subnet.yml | 47 +-- .../iaas/roles/external_subnet/tasks/main.yml | 11 +- examples/iaas/roles/fip/meta/main.yml | 5 +- examples/iaas/roles/fip/tasks/fip.yml | 19 +- examples/iaas/roles/fip/tasks/main.yml | 6 +- .../iaas/roles/overlay_subnet/meta/main.yml | 5 +- .../iaas/roles/overlay_subnet/tasks/main.yml | 52 ++- .../overlay_subnet/tasks/overlay_subnet.yml | 21 +- examples/iaas/roles/pbr/meta/main.yml | 5 +- examples/iaas/roles/pbr/tasks/main.yml | 6 +- examples/iaas/roles/pbr/tasks/pbr.yml | 19 +- examples/iaas/roles/pbr_delete/meta/main.yml | 5 +- examples/iaas/roles/pbr_delete/tasks/main.yml | 2 +- .../roles/pbr_delete/tasks/pbr_delete.yml | 7 +- .../iaas/roles/static_route/meta/main.yml | 5 +- .../iaas/roles/static_route/tasks/main.yml | 6 +- .../roles/static_route/tasks/static_route.yml | 27 +- examples/iaas/roles/vm/meta/main.yml | 5 +- examples/iaas/roles/vm/tasks/main.yml | 30 +- examples/iaas/roles/vm/tasks/vm.yml | 25 +- examples/iaas/roles/vpc/meta/main.yml | 5 +- examples/iaas/roles/vpc/tasks/main.yml | 9 +- examples/iaas/roles/vpc/tasks/vpc.yml | 28 +- examples/iaas/vars.yml | 66 ++-- examples/images.yml | 26 +- examples/inventory/nutanix.yaml | 9 +- examples/karbon/cluster_info.yml | 37 +- examples/karbon/create_k8s_cluster.yml | 314 ++++++++-------- examples/karbon/create_registries.yml | 53 ++- examples/karbon/registries_info.yml | 16 +- examples/ndb/all_day2_actions.yml | 117 +++--- examples/ndb/create_clone.yml | 67 ++-- examples/ndb/create_stretched_vlan.yml | 18 +- examples/ndb/create_time_machine_cluster.yml | 18 +- examples/ndb/create_vlan.yml | 33 +- examples/ndb/db_server_vms.yml | 353 +++++++++--------- ...ision_database_on_registered_db_server.yml | 10 +- ...rovision_postgres_ha_instance_with_ips.yml | 95 +++-- examples/ndb/refresh_clone.yml | 34 +- examples/ndb/registr_cluster.yml | 46 ++- .../single_instance_postgress_database.yml | 12 +- .../ndb/soft_delete_database_instance.yml | 12 +- examples/ndb/software_profiles.yml | 218 ++++++----- examples/pbr.yml | 34 +- examples/pbr_info.yml | 11 +- examples/permissions_info.yml | 40 +- examples/projects_crud.yml | 16 +- examples/projects_with_role_mapping.yml | 24 +- examples/roles_crud.yml | 16 +- examples/static_routes.yml | 14 +- examples/subnet.yml | 74 ++-- examples/subnet_info.yml | 14 +- examples/user-groups.yml | 58 ++- examples/user.yml | 78 ++-- examples/vm.yml | 105 +++--- examples/vm_info.yml | 18 +- examples/vm_operations.yml | 32 +- examples/vm_update.yml | 108 +++--- examples/vpc.yml | 10 +- examples/vpc_info.yml | 13 +- 85 files changed, 1987 insertions(+), 1984 deletions(-) create mode 100644 .github/workflows/ansible-lint.yml diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml new file mode 100644 index 000000000..0f4591dc8 --- /dev/null +++ b/.github/workflows/ansible-lint.yml @@ -0,0 +1,17 @@ +--- +name: ansible-lint +on: + - pull_request + +jobs: + build: + name: Ansible Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.x (latest) + uses: actions/setup-python@v2 + with: + python-version: 3.x + - name: Run ansible-lint + uses: ansible/ansible-lint@main diff --git a/examples/acp.yml b/examples/acp.yml index 8efb39915..b48af6b08 100644 --- a/examples/acp.yml +++ b/examples/acp.yml @@ -2,8 +2,6 @@ - name: ACP playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,10 +10,9 @@ validate_certs: false tasks: - - name: Create ACP with all specfactions - ntnx_acps: - validate_certs: False + nutanix.ncp.ntnx_acps: + validate_certs: false state: present nutanix_host: "{{ IP }}" nutanix_username: "{{ username }}" @@ -41,7 +38,7 @@ collection: ALL - name: Delete ACP - ntnx_acps: + nutanix.ncp.ntnx_acps: state: absent acp_uuid: "{{ acp_uuid }}" register: result diff --git a/examples/acp_info.yml b/examples/acp_info.yml index 41850e614..9b57514bd 100644 --- a/examples/acp_info.yml +++ b/examples/acp_info.yml @@ -2,8 +2,6 @@ - name: ACP_Info playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,20 +10,19 @@ validate_certs: false tasks: - - name: List ACPs using ascending, sorting and name filter - ntnx_floating_ips_info: + nutanix.ncp.ntnx_acps_info: filter: name: "{{ acp_name }}" kind: access_control_policy sort_order: "ASCENDING" sort_attribute: "name" register: result - ignore_errors: True + ignore_errors: true - name: List ACPs using length and offset - ntnx_floating_ips_info: + nutanix.ncp.ntnx_acps_info: length: 3 offset: 0 register: result - ignore_errors: True + ignore_errors: true diff --git a/examples/address_groups_crud.yml b/examples/address_groups_crud.yml index 35e5febdb..6cd5ad0a0 100644 --- a/examples/address_groups_crud.yml +++ b/examples/address_groups_crud.yml @@ -1,8 +1,6 @@ - name: Address group crud playbook. Here we will create, update, read and delete the address group. hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -11,7 +9,7 @@ validate_certs: false tasks: - name: Create a address group - ntnx_address_groups: + nutanix.ncp.ntnx_address_groups: state: present name: test-ansible-group-1 desc: test-ansible-group-1-desc @@ -22,8 +20,8 @@ network_prefix: 32 register: ag - - name: update address group - ntnx_address_groups: + - name: Update address group + nutanix.ncp.ntnx_address_groups: state: present address_group_uuid: "{{ ag.address_group_uuid }}" name: test-ansible-group-1-updated @@ -34,16 +32,16 @@ register: updated_ag - name: Read the updated address group - ntnx_address_groups_info: + nutanix.ncp.ntnx_address_groups_info: address_group_uuid: "{{ updated_ag.address_group_uuid }}" register: ag_info - name: Print the address group details - debug: + ansible.builtin.debug: msg: "{{ ag_info }}" - name: Delete the address group. - ntnx_address_groups: + nutanix.ncp.ntnx_address_groups: state: absent address_group_uuid: "{{ updated_ag.address_group_uuid }}" register: op diff --git a/examples/category_crud.yml b/examples/category_crud.yml index 3c4c6b12e..c5c88664b 100644 --- a/examples/category_crud.yml +++ b/examples/category_crud.yml @@ -1,8 +1,6 @@ -- name: categories crud playbook. Here we will create, update, read and delete the category key values. +- name: Categories crud playbook. Here we will create, update, read and delete the category key values. hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -11,14 +9,14 @@ validate_certs: false tasks: - name: Create only category key with description - ntnx_categories: + nutanix.ncp.ntnx_categories: state: "present" name: "test-cat-1" desc: "test-cat-1-desc" register: cat1 - name: Add category values to test-cat-1 - ntnx_categories: + nutanix.ncp.ntnx_categories: state: "present" name: "test-cat-1" values: @@ -26,7 +24,7 @@ - "val2" - name: Create category key with values - ntnx_categories: + nutanix.ncp.ntnx_categories: state: "present" name: "test-cat-2" desc: "test-cat-2-desc" @@ -36,7 +34,7 @@ register: cat2 - name: Add more category values to test-cat-2 - ntnx_categories: + nutanix.ncp.ntnx_categories: state: "present" name: "test-cat-2" values: @@ -44,25 +42,25 @@ - "val6" - name: Get categories info - ntnx_categories_info: + nutanix.ncp.ntnx_categories_info: name: "test-cat-1" register: cat1_info - name: Delete val1 category value from test-cat-1 - ntnx_categories: + nutanix.ncp.ntnx_categories: state: absent name: "test-cat-1" values: - val1 - - name: delete all category values from test-cat-1 - ntnx_categories: + - name: Delete all category values from test-cat-1 + nutanix.ncp.ntnx_categories: state: absent name: "test-cat-1" remove_values: true - - name: delete category key test-cat-2 including its all values - ntnx_categories: + - name: Delete category key test-cat-2 including its all values + nutanix.ncp.ntnx_categories: state: absent name: "test-cat-2" remove_values: true diff --git a/examples/clusters_info.yml b/examples/clusters_info.yml index c50b8286b..84eb807e0 100644 --- a/examples/clusters_info.yml +++ b/examples/clusters_info.yml @@ -2,8 +2,6 @@ - name: Clusters_Info playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,27 +10,27 @@ validate_certs: false tasks: - - name: test getting all clusters - ntnx_clusters_info: - register: clusters + - name: Test getting all clusters + nutanix.ncp.ntnx_clusters_info: + register: clusters - - name: test getting particular cluster using uuid - ntnx_clusters_info: - cluster_uuid: '{{ clusters.response.entities[0].metadata.uuid }}' - register: result + - name: Test getting particular cluster using uuid + nutanix.ncp.ntnx_clusters_info: + cluster_uuid: "{{ clusters.response.entities[0].metadata.uuid }}" + register: result - - name: List clusters using length, offset, sort order and priority sort attribute - ntnx_clusters_info: - length: 2 - offset: 0 - sort_order: "ASCENDING" - sort_attribute: "name" - register: result + - name: List clusters using length, offset, sort order and priority sort attribute + nutanix.ncp.ntnx_clusters_info: + length: 2 + offset: 0 + 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 + - name: List clusters using filter and custom_filter + nutanix.ncp.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 1b5a2d816..218f64a86 100644 --- a/examples/dr/protection_policy.yml +++ b/examples/dr/protection_policy.yml @@ -1,3 +1,4 @@ +--- ######## Description ########### # Tasks done by this playbook: # 1. Create synchronous protection policy and asynchronous protection policy @@ -5,163 +6,160 @@ # 3. Get created protection plans info and associated entities # 4. Delete protection plan from primary site. ################################# - - - name: PC DR hosts: localhost gather_facts: false - collections: - - nutanix.ncp tasks: - - name: Create protection rule with synchronous schedule - ntnx_protection_rules: - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false - state: present - wait: True - name: test-ansible - desc: test-ansible-desc - protected_categories: - Environment: - - Dev - - Staging - primary_site: - availability_zone_url: "" - schedules: - - source: - availability_zone_url: "" - destination: - availability_zone_url: "" - protection_type: SYNC - auto_suspend_timeout: 20 - - source: - availability_zone_url: "" - destination: - availability_zone_url: "" - protection_type: SYNC - auto_suspend_timeout: 10 - register: pr + - name: Create protection rule with synchronous schedule + nutanix.ncp.ntnx_protection_rules: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + state: present + wait: true + name: test-ansible + desc: test-ansible-desc + protected_categories: + Environment: + - Dev + - Staging + primary_site: + availability_zone_url: + schedules: + - source: + availability_zone_url: + destination: + availability_zone_url: + protection_type: SYNC + auto_suspend_timeout: 20 + - source: + availability_zone_url: + destination: + availability_zone_url: + protection_type: SYNC + auto_suspend_timeout: 10 + register: pr - - name: delete the protection rule - ntnx_protection_rules: - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false - state: "absent" - rule_uuid: "{{ pr.rule_uuid }}" + - name: Delete the protection rule + nutanix.ncp.ntnx_protection_rules: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + state: absent + rule_uuid: "{{ pr.rule_uuid }}" - - name: Create protection rule with async schedule - ntnx_protection_rules: - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false - state: present - wait: True - name: test-ansible-1 - desc: test-ansible-desc-1 - protected_categories: - Environment: - - Dev - - Testing - primary_site: - availability_zone_url: "" - schedules: - - source: - availability_zone_url: "" - destination: - availability_zone_url: "" - protection_type: ASYNC - rpo: 1 - rpo_unit: HOUR - snapshot_type: "CRASH_CONSISTENT" - local_retention_policy: - num_snapshots: 1 - remote_retention_policy: - rollup_retention_policy: - snapshot_interval_type: HOURLY - multiple: 2 + - name: Create protection rule with async schedule + nutanix.ncp.ntnx_protection_rules: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + state: present + wait: true + name: test-ansible-1 + desc: test-ansible-desc-1 + protected_categories: + Environment: + - Dev + - Testing + primary_site: + availability_zone_url: + schedules: + - source: + availability_zone_url: + destination: + availability_zone_url: + protection_type: ASYNC + rpo: 1 + rpo_unit: HOUR + snapshot_type: CRASH_CONSISTENT + local_retention_policy: + num_snapshots: 1 + remote_retention_policy: + rollup_retention_policy: + snapshot_interval_type: HOURLY + multiple: 2 - - source: - availability_zone_url: "" - destination: - availability_zone_url: "" - protection_type: ASYNC - rpo: 1 - rpo_unit: HOUR - snapshot_type: "CRASH_CONSISTENT" - local_retention_policy: - num_snapshots: 2 - remote_retention_policy: - num_snapshots: 1 - register: result + - source: + availability_zone_url: + destination: + availability_zone_url: + protection_type: ASYNC + rpo: 1 + rpo_unit: HOUR + snapshot_type: CRASH_CONSISTENT + local_retention_policy: + num_snapshots: 2 + remote_retention_policy: + num_snapshots: 1 + register: result - - name: Update previously created protection policy - ntnx_protection_rules: - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false - state: present - wait: True - rule_uuid: "{{result.rule_uuid}}" - name: test-ansible-updated - desc: test-ansible-desc-updated - protected_categories: - Environment: - - Testing - primary_site: - availability_zone_url: "" - schedules: - - source: - availability_zone_url: "" - destination: - availability_zone_url: "" - protection_type: ASYNC - rpo: 2 - rpo_unit: DAY - snapshot_type: "APPLICATION_CONSISTENT" - local_retention_policy: - num_snapshots: 1 - remote_retention_policy: - rollup_retention_policy: - snapshot_interval_type: YEARLY - multiple: 2 + - name: Update previously created protection policy + nutanix.ncp.ntnx_protection_rules: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + state: present + wait: true + rule_uuid: "{{ result.rule_uuid }}" + name: test-ansible-updated + desc: test-ansible-desc-updated + protected_categories: + Environment: + - Testing + primary_site: + availability_zone_url: + schedules: + - source: + availability_zone_url: + destination: + availability_zone_url: + protection_type: ASYNC + rpo: 2 + rpo_unit: DAY + snapshot_type: APPLICATION_CONSISTENT + local_retention_policy: + num_snapshots: 1 + remote_retention_policy: + rollup_retention_policy: + snapshot_interval_type: YEARLY + multiple: 2 - - source: - availability_zone_url: "" - destination: - availability_zone_url: "" - protection_type: ASYNC - rpo: 2 - rpo_unit: DAY - snapshot_type: "APPLICATION_CONSISTENT" - local_retention_policy: - num_snapshots: 1 - remote_retention_policy: - num_snapshots: 2 - register: pr + - source: + availability_zone_url: + destination: + availability_zone_url: + protection_type: ASYNC + rpo: 2 + rpo_unit: DAY + snapshot_type: APPLICATION_CONSISTENT + local_retention_policy: + num_snapshots: 1 + 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 }}" - register: result + - name: Get protection policy info and its associated vms info + nutanix.ncp.ntnx_protection_rules_info: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + rule_uuid: "{{ pr.rule_uuid }}" + register: result - - debug: - msg: "{{ result }}" + - name: Print protection policy info + ansible.builtin.debug: + msg: "{{ result }}" - - name: delete the protection rule - ntnx_protection_rules: - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false - state: "absent" - rule_uuid: "{{ pr.rule_uuid }}" + - name: Delete the protection rule + nutanix.ncp.ntnx_protection_rules: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + state: absent + rule_uuid: "{{ pr.rule_uuid }}" diff --git a/examples/dr/recovery_plan_with_execution.yml b/examples/dr/recovery_plan_with_execution.yml index 561536001..92fed079d 100644 --- a/examples/dr/recovery_plan_with_execution.yml +++ b/examples/dr/recovery_plan_with_execution.yml @@ -1,3 +1,4 @@ +--- ######## Description ########### # Tasks done by this playbook: # 1. Create Recovery plan using ntnx_recovery_plans @@ -11,170 +12,169 @@ - name: PC DR hosts: localhost gather_facts: false - collections: - - nutanix.ncp tasks: -################################# Create recovery plans using ntnx_recovery_plans ############# - - name: Create recovery plan with custom ip network mapping - ntnx_recovery_plans: - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false - state: "present" - name: example-rp - desc: recovery plan desc - stages: - - vms: - - name: "test-check" - enable_script_exec: true - delay: 10 - primary_location: - url: "" - recovery_location: - url: "" - network_type: NON_STRETCH - network_mappings: - - primary: - test: - name: "" - gateway_ip: "xx.xx.xx.xx" - prefix: "24" - custom_ip_config: - - vm: - name: "test-check" - ip: "xx.xx.xx.xx" - prod: - name: "" - gateway_ip: "xx.xx.xx.xx" - prefix: "24" - custom_ip_config: - - vm: - name: "test-check" - ip: "xx.xx.xx.xx" - recovery: - test: - name: "" - gateway_ip: "xx.xx.xx.xx" - prefix: "24" - custom_ip_config: - - vm: - name: "test-check" - ip: "xx.xx.xx.xx" - prod: - name: "" - gateway_ip: "xx.xx.xx.xx" - prefix: "24" - custom_ip_config: - - vm: - name: "test-check" - ip: "xx.xx.xx.xx" - register: result + ################################# Create recovery plans using ntnx_recovery_plans ############# + - name: Create recovery plan with custom ip network mapping + nutanix.ncp.ntnx_recovery_plans: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + state: present + name: example-rp + desc: recovery plan desc + stages: + - vms: + - name: test-check + enable_script_exec: true + delay: 10 + primary_location: + url: + recovery_location: + url: + network_type: NON_STRETCH + network_mappings: + - primary: + test: + name: + gateway_ip: xx.xx.xx.xx + prefix: "24" + custom_ip_config: + - vm: + name: test-check + ip: xx.xx.xx.xx + prod: + name: + gateway_ip: xx.xx.xx.xx + prefix: "24" + custom_ip_config: + - vm: + name: test-check + ip: xx.xx.xx.xx + recovery: + test: + name: + gateway_ip: xx.xx.xx.xx + prefix: "24" + custom_ip_config: + - vm: + name: test-check + ip: xx.xx.xx.xx + prod: + name: + gateway_ip: xx.xx.xx.xx + prefix: "24" + custom_ip_config: + - vm: + name: test-check + ip: xx.xx.xx.xx + register: result + - name: Print recovery plan details + ansible.builtin.debug: + msg: "{{ result }}" - - debug: - msg: "{{ result }}" + - name: Update recovery plan by adding more stages and remove custom IP to enable dynamic IP allocation + nutanix.ncp.ntnx_recovery_plans: + plan_uuid: "{{ result.plan_uuid }}" + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + state: present + name: example-rp-updated + desc: recovery plan desc updated + stages: + - vms: + - name: test-check + enable_script_exec: true + categories: + - key: Environment + value: Staging + enable_script_exec: true + delay: 2 + - categories: + - key: Environment + value: Dev + primary_location: + url: + recovery_location: + url: + network_type: NON_STRETCH + network_mappings: + - primary: + test: + name: + prod: + name: + recovery: + test: + name: + prod: + name: + register: recovery_plan + #################################### Lets recover the vms on recovery site using ntnx_recovery_plan_jobs ################ - - name: Update recovery plan by adding more stages and remove custom IP to enable dynamic IP allocation - ntnx_recovery_plans: - plan_uuid: "{{result.plan_uuid}}" - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false - state: "present" - name: example-rp-updated - desc: recovery plan desc updated - stages: - - vms: - - name: "test-check" - enable_script_exec: true - categories: - - key: Environment - value: Staging - enable_script_exec: true - delay: 2 - - categories: - - key: Environment - value: Dev - primary_location: - url: "" - recovery_location: - url: "" - network_type: NON_STRETCH - network_mappings: - - primary: - test: - name: "" - prod: - name: "" - recovery: - test: - name: "" - prod: - name: "" - register: recovery_plan + - name: Recovery plan info and its affected entities get + nutanix.ncp.ntnx_recovery_plans_info: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + plan_uuid: "{{ recovery_plan.plan_uuid }}" + register: recovery_plan_info + - name: Print recovery plan info + ansible.builtin.debug: + msg: "{{ recovery_plan_info }}" -#################################### Lets recover the vms on recovery site using ntnx_recovery_plan_jobs ################ + # We can also perform FAILOVER, LIVE_MIGRATE and FAILOVER here + - name: Run migrate (planned failover) + nutanix.ncp.ntnx_recovery_plan_jobs: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + state: present + name: test-failover-123 + recovery_plan: + uuid: "{{ recovery_plan.plan_uuid }}" + failed_site: + url: + recovery_site: + url: + action: MIGRATE + ignore_validation_failures: true + register: migrate_job - - name: recovery plan info and its affected entities get - ntnx_recovery_plans_info: - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false - plan_uuid: "{{recovery_plan.plan_uuid}}" - register: recovery_plan_info + - name: Print migrate job + ansible.builtin.debug: + msg: "{{ migrate_job }}" - - debug: - msg: "{{recovery_plan_info}}" + - name: Get recovery plan job status using info module + nutanix.ncp.ntnx_recovery_plan_jobs_info: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + job_uuid: "{{ migrate_job.job_uuid }}" + register: result + ignore_errors: true - # We can also perform FAILOVER, LIVE_MIGRATE and FAILOVER here - - name: Run migrate (planned failover) - ntnx_recovery_plan_jobs: - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false - state: "present" - name: test-failover-123 - recovery_plan: - uuid: "{{recovery_plan.plan_uuid}}" - failed_site: - url: "" - recovery_site: - url: "" - action: MIGRATE - ignore_validation_failures: true - register: migrate_job + - name: Print recovery plan job status + ansible.builtin.debug: + msg: "{{ result }}" - - debug: - msg: "{{migrate_job}}" + ###################################### delete the recovery plan ################# - - name: Get recovery plan job status using info module - ntnx_recovery_plan_jobs_info: - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false - job_uuid: "{{migrate_job.job_uuid}}" - register: result - ignore_errors: True - - - debug: - msg: "{{ result }}" - - ###################################### delete the recovery plan ################# - - - name: Delete recovery plan - ntnx_recovery_plans: - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false - job_uuid: "{{migrate_job.job_uuid}}" - plan_uuid: "{{recovery_plan.plan_uuid}}" - state: "absent" - register: result + - name: Delete recovery plan + nutanix.ncp.ntnx_recovery_plans: + nutanix_host: + nutanix_username: + nutanix_password: + validate_certs: false + job_uuid: "{{ migrate_job.job_uuid }}" + plan_uuid: "{{ recovery_plan.plan_uuid }}" + state: absent + register: result diff --git a/examples/fc/api_keys_create.yml b/examples/fc/api_keys_create.yml index 41a5df90c..6618cf2b8 100644 --- a/examples/fc/api_keys_create.yml +++ b/examples/fc/api_keys_create.yml @@ -2,19 +2,16 @@ - name: API Keys Playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp - tasks: - - name: Create a new API Key - ntnx_foundation_central_api_keys: - nutanix_host: "{{ pc }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - alias: "test-alias" - register: output + - name: Create a new API Key + nutanix.ncp.ntnx_foundation_central_api_keys: + nutanix_host: "{{ pc }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + alias: test-alias + register: output - - name: output of api_key - debug: - msg: '{{ output }}' + - name: Output of api_key + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/fc/api_keys_info.yml b/examples/fc/api_keys_info.yml index 7ea8513e5..5999781d0 100644 --- a/examples/fc/api_keys_info.yml +++ b/examples/fc/api_keys_info.yml @@ -2,28 +2,25 @@ - name: API Keys Info Playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp - tasks: - - name: API key response with alias - ntnx_foundation_central_api_keys: - nutanix_host: "{{ pc }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - alias: "test" - register: output + - name: API key response with alias + nutanix.ncp.ntnx_foundation_central_api_keys: + nutanix_host: "{{ pc }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + alias: test + register: output - - name: API key response with key_uuid - ntnx_foundation_central_api_keys: - nutanix_host: "{{ pc }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - key_uuid: "" - register: output + - name: API key response with key_uuid + nutanix.ncp.ntnx_foundation_central_api_keys: + nutanix_host: "{{ pc }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + key_uuid: + register: output - - name: output of api_key - debug: - msg: '{{ output }}' + - name: Output of api_key + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/fc/fc.yml b/examples/fc/fc.yml index 00f9732fb..0489d25d1 100644 --- a/examples/fc/fc.yml +++ b/examples/fc/fc.yml @@ -2,99 +2,96 @@ - name: Foundation Central Playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp - tasks: - - name: Nodes Imaging with Cluster Creation with manual mode. - ntnx_foundation_central: - nutanix_host: "{{ pc }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - cluster_name: "test" - # skip_cluster_creation: false #set this to true to skip cluster creation - common_network_settings: - cvm_dns_servers: - - 10.x.xx.xx - hypervisor_dns_servers: - - 10.x.xx.xx - cvm_ntp_servers: - - "ntp" - hypervisor_ntp_servers: - - "ntp" - nodes_list: - - manual_mode: - cvm_gateway: "10.xx.xx.xx" - cvm_netmask: "xx.xx.xx.xx" - cvm_ip: "10.x.xx.xx" - hypervisor_gateway: "10.x.xx.xxx" - hypervisor_netmask: "xx.xx.xx.xx" - hypervisor_ip: "10.x.x.xx" - hypervisor_hostname: "Host-1" - imaged_node_uuid: "" - use_existing_network_settings: false - ipmi_gateway: "10.x.xx.xx" - ipmi_netmask: "xx.xx.xx.xx" - ipmi_ip: "10.x.xx.xx" - image_now: true - hypervisor_type: "kvm" + - name: Nodes Imaging with Cluster Creation with manual mode. + nutanix.ncp.ntnx_foundation_central: + nutanix_host: "{{ pc }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + cluster_name: test + # skip_cluster_creation: false #set this to true to skip cluster creation + common_network_settings: + cvm_dns_servers: + - 10.x.xx.xx + hypervisor_dns_servers: + - 10.x.xx.xx + cvm_ntp_servers: + - ntp + hypervisor_ntp_servers: + - ntp + nodes_list: + - manual_mode: + cvm_gateway: 10.xx.xx.xx + cvm_netmask: xx.xx.xx.xx + cvm_ip: 10.x.xx.xx + hypervisor_gateway: 10.x.xx.xxx + hypervisor_netmask: xx.xx.xx.xx + hypervisor_ip: 10.x.x.xx + hypervisor_hostname: Host-1 + imaged_node_uuid: + use_existing_network_settings: false + ipmi_gateway: 10.x.xx.xx + ipmi_netmask: xx.xx.xx.xx + ipmi_ip: 10.x.xx.xx + image_now: true + hypervisor_type: kvm - - manual_mode: - cvm_gateway: "10.xx.xx.xx" - cvm_netmask: "xx.xx.xx.xx" - cvm_ip: "10.x.xx.xx" - hypervisor_gateway: "10.x.xx.xxx" - hypervisor_netmask: "xx.xx.xx.xx" - hypervisor_ip: "10.x.x.xx" - hypervisor_hostname: "Host-2" - imaged_node_uuid: "" - use_existing_network_settings: false - ipmi_gateway: "10.x.xx.xx" - ipmi_netmask: "xx.xx.xx.xx" - ipmi_ip: "10.x.xx.xx" - image_now: true - hypervisor_type: "kvm" + - manual_mode: + cvm_gateway: 10.xx.xx.xx + cvm_netmask: xx.xx.xx.xx + cvm_ip: 10.x.xx.xx + hypervisor_gateway: 10.x.xx.xxx + hypervisor_netmask: xx.xx.xx.xx + hypervisor_ip: 10.x.x.xx + hypervisor_hostname: Host-2 + imaged_node_uuid: + use_existing_network_settings: false + ipmi_gateway: 10.x.xx.xx + ipmi_netmask: xx.xx.xx.xx + ipmi_ip: 10.x.xx.xx + image_now: true + hypervisor_type: kvm - redundancy_factor: 2 - aos_package_url: "" - hypervisor_iso_details: - url: "" - register: output + redundancy_factor: 2 + aos_package_url: + hypervisor_iso_details: + url: + register: output - - name: Nodes Imaging without Cluster Creation with discovery mode. - ntnx_foundation_central: - nutanix_host: "{{ pc }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - cluster_name: "test" - skip_cluster_creation: true - common_network_settings: - cvm_dns_servers: - - 10.x.xx.xx - hypervisor_dns_servers: - - 10.x.xx.xx - cvm_ntp_servers: - - "ntp" - hypervisor_ntp_servers: - - "ntp" - nodes_list: - - discovery_mode: - node_serial: "" - - discovery_mode: - node_serial: "" - - discovery_mode: - node_serial: "" - discovery_override: - cvm_ip: + - name: Nodes Imaging without Cluster Creation with discovery mode. + nutanix.ncp.ntnx_foundation_central: + nutanix_host: "{{ pc }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + cluster_name: test + skip_cluster_creation: true + common_network_settings: + cvm_dns_servers: + - 10.x.xx.xx + hypervisor_dns_servers: + - 10.x.xx.xx + cvm_ntp_servers: + - ntp + hypervisor_ntp_servers: + - ntp + nodes_list: + - discovery_mode: + node_serial: + - discovery_mode: + node_serial: + - discovery_mode: + node_serial: + discovery_override: + cvm_ip: - redundancy_factor: 2 - aos_package_url: "" - hypervisor_iso_details: - url: "" - register: output + redundancy_factor: 2 + aos_package_url: + hypervisor_iso_details: + url: + register: output - - name: output of list - debug: - msg: '{{ output }}' + - name: Output of list + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/fc/imaged_cluster_info.yml b/examples/fc/imaged_cluster_info.yml index 6e23546a7..f6fe53e88 100644 --- a/examples/fc/imaged_cluster_info.yml +++ b/examples/fc/imaged_cluster_info.yml @@ -2,39 +2,36 @@ - name: Imaged Clusters Playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp - tasks: - - name: Imaged-Cluster details with imaged_cluster_uuid - ntnx_foundation_central_imaged_clusters_info: - nutanix_host: "{{ pc }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - imaged_cluster_uuid: "" - register: output + - name: Imaged-Cluster details with imaged_cluster_uuid + nutanix.ncp.ntnx_foundation_central_imaged_clusters_info: + nutanix_host: "{{ pc }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + imaged_cluster_uuid: + register: output - - name: Imaged-Cluster details with filters - ntnx_foundation_central_imaged_clusters_info: - nutanix_host: "{{ pc }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - filters: - archived: true - register: output + - name: Imaged-Cluster details with filters + nutanix.ncp.ntnx_foundation_central_imaged_clusters_info: + nutanix_host: "{{ pc }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filters: + archived: true + register: output - - name: Imaged-Cluster details with custom filter - ntnx_foundation_central_imaged_clusters_info: - nutanix_host: "{{ pc }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - custom_filter: - cvm_gateway: "" - register: output + - name: Imaged-Cluster details with custom filter + nutanix.ncp.ntnx_foundation_central_imaged_clusters_info: + nutanix_host: "{{ pc }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + custom_filter: + cvm_gateway: + register: output - - name: details of imaged-clusters - debug: - msg: '{{ output }}' + - name: Details of imaged-clusters + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/fc/imaged_nodes_info.yml b/examples/fc/imaged_nodes_info.yml index 3eda3012d..0cdf06ae3 100644 --- a/examples/fc/imaged_nodes_info.yml +++ b/examples/fc/imaged_nodes_info.yml @@ -2,39 +2,36 @@ - name: Imaged Nodes Playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp - tasks: - - name: Imaged-Node details with imaged_node_uuid - ntnx_foundation_central_imaged_nodes_info: - nutanix_host: "{{ pc }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - imaged_node_uuid: "" - register: output + - name: Imaged-Node details with imaged_node_uuid + nutanix.ncp.ntnx_foundation_central_imaged_nodes_info: + nutanix_host: "{{ pc }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + imaged_node_uuid: + register: output - - name: Imaged-Node details with filters - ntnx_foundation_central_imaged_nodes_info: - nutanix_host: "{{ pc }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - filters: - node_state: "STATE_IMAGING" - register: output + - name: Imaged-Node details with filters + nutanix.ncp.ntnx_foundation_central_imaged_nodes_info: + nutanix_host: "{{ pc }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + filters: + node_state: STATE_IMAGING + register: output - - name: Imaged-Node details with custom filter - ntnx_foundation_central_imaged_nodes_info: - nutanix_host: "{{ pc }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - custom_filter: - model: "" - register: output + - name: Imaged-Node details with custom filter + nutanix.ncp.ntnx_foundation_central_imaged_nodes_info: + nutanix_host: "{{ pc }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + custom_filter: + model: + register: output - - name: details of imaged node - debug: - msg: '{{ output }}' + - name: Details of imaged node + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/fip.yml b/examples/fip.yml index 0fb7976c2..985a8b62b 100644 --- a/examples/fip.yml +++ b/examples/fip.yml @@ -2,8 +2,6 @@ - name: FIP playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,20 +10,20 @@ validate_certs: false tasks: - name: Setting Variables - set_fact: + ansible.builtin.set_fact: external_subnet_name: "" vm_name: "" - name: Create floating ip with external subnet uuid - ntnx_floating_ips: + nutanix.ncp.ntnx_floating_ips: state: present - wait: True + wait: true external_subnet: name: "{{ external_subnet_name }}" register: result - name: Assign floating ip to vm - ntnx_floating_ips: + nutanix.ncp.ntnx_floating_ips: state: present external_subnet: name: "{{ external_subnet.name }}" @@ -34,7 +32,7 @@ register: result - name: Delete all created floating ips - ntnx_floating_ips: + nutanix.ncp.ntnx_floating_ips: state: absent fip_uuid: "{{ result.fip_uuid }}" register: result diff --git a/examples/fip_info.yml b/examples/fip_info.yml index 3d92c2c20..aa3e9cbd2 100644 --- a/examples/fip_info.yml +++ b/examples/fip_info.yml @@ -2,8 +2,6 @@ - name: FIP_Info playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,27 +10,25 @@ validate_certs: false tasks: - - name: List floating_ips using ascending ip sorting and floating_ip filter - ntnx_floating_ips_info: + nutanix.ncp.ntnx_floating_ips_info: filter: floating_ip: "10.0.1.2" kind: floating_ip sort_order: "ASCENDING" sort_attribute: "floating_ip" register: result - ignore_errors: True + ignore_errors: true - name: List floating_ips using length and offset - ntnx_floating_ips_info: + nutanix.ncp.ntnx_floating_ips_info: length: 3 offset: 0 register: result - ignore_errors: True - + ignore_errors: true - name: List floating_ips using filter and custom_filter - ntnx_floating_ips_info: + nutanix.ncp.ntnx_floating_ips_info: filter: name: custom_filter: diff --git a/examples/foundation/get_images_info.yml b/examples/foundation/get_images_info.yml index 9ee06f18b..31b5095e7 100644 --- a/examples/foundation/get_images_info.yml +++ b/examples/foundation/get_images_info.yml @@ -1,21 +1,22 @@ +--- # pull hypervisor and nos packages info from FVM - name: Get hypervisor and nos packages info from FVM hosts: localhost gather_facts: false - collections: - - nutanix.ncp tasks: - - name: get hypervisor images info from foundation - ntnx_foundation_hypervisor_images_info: - nutanix_host: "10.xx.xx.xx" + - name: Get hypervisor images info from foundation + nutanix.ncp.ntnx_foundation_hypervisor_images_info: + nutanix_host: 10.xx.xx.xx register: hyp - - name: get aos images info from foundation - ntnx_foundation_aos_packages_info: - nutanix_host: "10.xx.xx.xx" + - name: Get aos images info from foundation + nutanix.ncp.ntnx_foundation_aos_packages_info: + nutanix_host: 10.xx.xx.xx register: nos - - debug: + - name: Print available hypervisor image details + ansible.builtin.debug: msg: "{{ hyp }}" - - debug: + - name: Print available NOS image details + ansible.builtin.debug: msg: "{{ nos }}" diff --git a/examples/foundation/image_nodes.yml b/examples/foundation/image_nodes.yml index 6e2b7cb58..0e486f6c0 100644 --- a/examples/foundation/image_nodes.yml +++ b/examples/foundation/image_nodes.yml @@ -1,63 +1,63 @@ +--- # 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 hosts: localhost gather_facts: false - collections: - - nutanix.ncp tasks: - - name: Image nodes using manual and discovery modes. Create cluster - ntnx_foundation: - timeout: 4500 - nutanix_host: "10.xx.xx.xx" - cvm_gateway: "10.xx.xx.xx" - cvm_netmask: "xx.xx.xx.xx" - hypervisor_gateway: "10.xx.xx.xx" - hypervisor_netmask: "xx.xx.xx.xx" - default_ipmi_user: "" - nos_package: "" - blocks: - - block_id: "xxxxx" - nodes: - - manual_mode: - cvm_ip: "10.xx.xx.xx" - cvm_gb_ram: 50 - hypervisor_hostname: "superman1" - ipmi_netmask: "xx.xx.xx.xx" - ipmi_gateway: "10.xx.xx.xx" - ipmi_ip: "10.xx.xx.xx" - ipmi_password: "" - hypervisor: "kvm" - hypervisor_ip: "10.xx.xx.xx" - node_position: "A" - #dos node using cvm and discover it using discovery mode. Here we have to provide hypervisor details mandatorily as its dos nodes. - #You can skip hypervisor details incase of aos running node and discovery mode. AOS running nodes have hypervisor running and network - #configuration is pulled internally. - - discovery_mode: - cvm_gb_ram: 50 - node_serial: "xxxxxx" - device_hint: "vm_installer" - discovery_override: - hypervisor_hostname: "superman2" - hypervisor_ip: "10.xx.xx.xx" - cvm_ip: "10.xx.xx.xx" - hypervisor: "kvm" - #image aos running node using ipmi and discover it using discovery mode - - discovery_mode: - cvm_gb_ram: 50 - ipmi_password: "" - node_serial: "xxxxxx" - discovery_override: - hypervisor_hostname: "superman3" - clusters: + - name: Image nodes using manual and discovery modes. Create cluster + nutanix.ncp.ntnx_foundation: + timeout: 4500 + nutanix_host: 10.xx.xx.xx + cvm_gateway: 10.xx.xx.xx + cvm_netmask: xx.xx.xx.xx + hypervisor_gateway: 10.xx.xx.xx + hypervisor_netmask: xx.xx.xx.xx + default_ipmi_user: + nos_package: + blocks: + - block_id: xxxxx + nodes: + - manual_mode: + cvm_ip: 10.xx.xx.xx + cvm_gb_ram: 50 + hypervisor_hostname: superman1 + ipmi_netmask: xx.xx.xx.xx + ipmi_gateway: 10.xx.xx.xx + ipmi_ip: 10.xx.xx.xx + ipmi_password: + hypervisor: kvm + hypervisor_ip: 10.xx.xx.xx + node_position: A + # dos node using cvm and discover it using discovery mode. Here we have to provide hypervisor details mandatorily as its dos nodes. + # You can skip hypervisor details incase of aos running node and discovery mode. AOS running nodes have hypervisor running and network + # configuration is pulled internally. + - discovery_mode: + cvm_gb_ram: 50 + node_serial: xxxxxx + device_hint: vm_installer + discovery_override: + hypervisor_hostname: superman2 + hypervisor_ip: 10.xx.xx.xx + cvm_ip: 10.xx.xx.xx + hypervisor: kvm + # image aos running node using ipmi and discover it using discovery mode + - discovery_mode: + cvm_gb_ram: 50 + ipmi_password: + node_serial: xxxxxx + discovery_override: + hypervisor_hostname: superman3 + clusters: - redundancy_factor: 2 cluster_members: - - "10.xx.xx.xx" - - "10.xx.xx.xx" - - "10.xx.xx.xx" - name: "test-cluster" - register: output + - 10.xx.xx.xx + - 10.xx.xx.xx + - 10.xx.xx.xx + name: test-cluster + register: output - - debug: - msg: '{{ output }}' + - name: Print output + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/foundation/image_upload.yml b/examples/foundation/image_upload.yml index cb1463240..cd4d9171b 100644 --- a/examples/foundation/image_upload.yml +++ b/examples/foundation/image_upload.yml @@ -1,22 +1,22 @@ +--- # Here this will upload image from local machine (where this script runs) to the FVM - name: Upload images hosts: localhost gather_facts: false - collections: - - nutanix.ncp tasks: - name: Image upload # check_mode: yes - ntnx_foundation_image_upload: - nutanix_host: "10.xx.xx.xx" + nutanix.ncp.ntnx_foundation_image_upload: + nutanix_host: 10.xx.xx.xx # change state to "absent" to delete this image. For delete, source is not required state: present - source: "" - filename: "" + source: + filename: # value of installer_type must be one of: kvm, esx, hyperv, xen or nos installer_type: kvm timeout: 1800 register: upload_result - - debug: - msg: '{{ upload_result }}' + - name: Print upload result + ansible.builtin.debug: + msg: "{{ upload_result }}" diff --git a/examples/foundation/ipmi_config.yml b/examples/foundation/ipmi_config.yml index 20fce2b9f..7f7342a5a 100644 --- a/examples/foundation/ipmi_config.yml +++ b/examples/foundation/ipmi_config.yml @@ -1,23 +1,23 @@ +--- # Here we will configure IPMI of one node - name: Configure IPMI hosts: localhost gather_facts: false - collections: - - nutanix.ncp tasks: - - name: configure ipmi + - name: Configure ipmi # check_mode: yes - ntnx_foundation_bmc_ipmi_config: - nutanix_host: "10.xx.xx.xx" - ipmi_user: "" - ipmi_password: "" - ipmi_netmask: "xx.xx.xx.xx" - ipmi_gateway: "10.xx.xx.xx" - blocks: + nutanix.ncp.ntnx_foundation_bmc_ipmi_config: + nutanix_host: 10.xx.xx.xx + ipmi_user: + ipmi_password: + ipmi_netmask: xx.xx.xx.xx + ipmi_gateway: 10.xx.xx.xx + blocks: - nodes: - ipmi_mac: xx:xx:xx:xx:xx:xx - ipmi_ip: "10.xx.xx.xx" - register: output + ipmi_ip: 10.xx.xx.xx + register: output - - debug: - msg: '{{ output }}' + - name: Print output + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/foundation/node_discovery_network_info.yml b/examples/foundation/node_discovery_network_info.yml index 2f81eb083..526d77338 100644 --- a/examples/foundation/node_discovery_network_info.yml +++ b/examples/foundation/node_discovery_network_info.yml @@ -1,25 +1,25 @@ +--- # Here we will discover nodes and also get node network info of particular some discovered nodes - name: Discover nodes and get their network info hosts: localhost gather_facts: false - collections: - - nutanix.ncp tasks: - - name: Discover all nodes - ntnx_foundation_discover_nodes_info: - nutanix_host: "10.xx.xx.xx" + - name: Discover all nodes + nutanix.ncp.ntnx_foundation_discover_nodes_info: + nutanix_host: 10.xx.xx.xx # unskip line 12 to include configured(nodes part of cluster) nodes in the output # include_configured: true - register: discovered_nodes + 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: - nutanix_host: "10.xx.xx.xx" - nodes: - - "{{discovered_nodes.blocks.0.nodes.0.ipv6_address}}" - - "{{discovered_nodes.blocks.1.nodes.0.ipv6_address}}" - register: result + # get network info of nodes discovered from ntnx_foundation_discover_nodes_info module + - name: Get node network info of some discovered nodes + nutanix.ncp.ntnx_foundation_node_network_info: + nutanix_host: 10.xx.xx.xx + nodes: + - "{{discovered_nodes.blocks.0.nodes.0.ipv6_address}}" + - "{{discovered_nodes.blocks.1.nodes.0.ipv6_address}}" + register: result - - debug: - msg: "{{ result }}" + - name: Print node network info + ansible.builtin.debug: + msg: "{{ result }}" diff --git a/examples/hosts_info.yml b/examples/hosts_info.yml index f478b5249..0d204ea7f 100644 --- a/examples/hosts_info.yml +++ b/examples/hosts_info.yml @@ -2,8 +2,6 @@ - name: Hosts_Info playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,28 +10,28 @@ validate_certs: false tasks: - - name: test getting all hosts - ntnx_hosts_info: - register: hosts + - name: Test getting all hosts + nutanix.ncp.ntnx_hosts_info: + register: hosts_list - - name: test getting particular host using uuid - ntnx_hosts_info: - host_uuid: '{{ hosts.response.entities[0].metadata.uuid }}' - register: result + - name: Test getting particular host using uuid + nutanix.ncp.ntnx_hosts_info: + host_uuid: "{{ hosts_list.response.entities[0].metadata.uuid }}" + register: result - - name: List hosts using length, offset, sort order and name sort attribute - ntnx_hosts_info: - length: 2 - offset: 0 - sort_order: "ASCENDING" - sort_attribute: "name" - register: result - ignore_errors: True + - name: List hosts using length, offset, sort order and name sort attribute + nutanix.ncp.ntnx_hosts_info: + length: 2 + offset: 0 + sort_order: "ASCENDING" + 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 + - name: List hosts using filter and custom_filter + nutanix.ncp.ntnx_hosts_info: + filter: + name: + custom_filter: + serial_number: + register: result diff --git a/examples/iaas/iaas.yml b/examples/iaas/iaas.yml index 1275e3521..5c1059560 100644 --- a/examples/iaas/iaas.yml +++ b/examples/iaas/iaas.yml @@ -2,8 +2,6 @@ - name: IaaS Provisioning hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,17 +10,23 @@ validate_certs: false tasks: - name: Include vars file - include_vars: + ansible.builtin.include_vars: file: vars.yml - - include_role: + - name: Include external_subnet role + ansible.builtin.include_role: name: external_subnet - - include_role: + - name: Include vpc role + ansible.builtin.include_role: name: vpc - - include_role: + - name: Include static_route role + ansible.builtin.include_role: name: static_route - - include_role: + - name: Include overlay_subnet role + ansible.builtin.include_role: name: overlay_subnet - - include_role: + - name: Include vm role + ansible.builtin.include_role: name: vm - - include_role: + - name: Include fip role + ansible.builtin.include_role: name: fip diff --git a/examples/iaas/policies_create.yml b/examples/iaas/policies_create.yml index c0150c2c7..9ae92b544 100644 --- a/examples/iaas/policies_create.yml +++ b/examples/iaas/policies_create.yml @@ -2,8 +2,6 @@ - name: Policy based routing - NACLs hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,7 +10,8 @@ validate_certs: false tasks: - name: Include vars file - include_vars: + ansible.builtin.include_vars: file: vars.yml - - include_role: + - name: Include pbr role + ansible.builtin.include_role: name: pbr diff --git a/examples/iaas/policies_delete.yml b/examples/iaas/policies_delete.yml index b2ff1aea0..7bf4ff32f 100644 --- a/examples/iaas/policies_delete.yml +++ b/examples/iaas/policies_delete.yml @@ -2,8 +2,6 @@ - name: Policy based routing - NACLs hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -11,5 +9,6 @@ nutanix_password: validate_certs: false tasks: - - include_role: + - name: Include pbr role + ansible.builtin.include_role: name: pbr_delete diff --git a/examples/iaas/roles/external_subnet/meta/main.yml b/examples/iaas/roles/external_subnet/meta/main.yml index a734b2343..5289004d7 100644 --- a/examples/iaas/roles/external_subnet/meta/main.yml +++ b/examples/iaas/roles/external_subnet/meta/main.yml @@ -1,2 +1,3 @@ - collections: - - nutanix.ncp +--- +collections: + - nutanix.ncp diff --git a/examples/iaas/roles/external_subnet/tasks/external_subnet.yml b/examples/iaas/roles/external_subnet/tasks/external_subnet.yml index b4c232d4e..f7c889d7d 100644 --- a/examples/iaas/roles/external_subnet/tasks/external_subnet.yml +++ b/examples/iaas/roles/external_subnet/tasks/external_subnet.yml @@ -1,22 +1,27 @@ --- - - name: Create {{ item.name }} external subnet - ntnx_subnets: - state: present - name: "{{ item.name }}" - external_subnet: - vlan_id: "{{ item.vlan_id }}" - cluster: - name: "{{ cluster.name }}" - enable_nat: "{{ item.eNat }}" - ipam: - network_ip: "{{ item.ip }}" - network_prefix: "{{ item.prefix }}" - gateway_ip: "{{ item.gip }}" - ip_pools: - - start_ip: "{{ item.sip }}" - end_ip: "{{ item.eip }}" - register: external_network - - debug: - msg: - - "name: Ext_Nat" - - "uuid: {{ external_network.subnet_uuid }}" +- name: Start external subnet task + ansible.builtin.debug: + msg: Create {{ item.name }} external subnet + +- name: Create external subnet + nutanix.ncp.ntnx_subnets: + state: present + name: "{{ item.name }}" + external_subnet: + vlan_id: "{{ item.vlan_id }}" + cluster: + name: "{{ cluster.name }}" + enable_nat: "{{ item.eNat }}" + ipam: + network_ip: "{{ item.ip }}" + network_prefix: "{{ item.prefix }}" + gateway_ip: "{{ item.gip }}" + ip_pools: + - start_ip: "{{ item.sip }}" + end_ip: "{{ item.eip }}" + register: external_network +- name: Print external subnet name and uuid + ansible.builtin.debug: + 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 d0a8dcff9..e1c78b4f7 100644 --- a/examples/iaas/roles/external_subnet/tasks/main.yml +++ b/examples/iaas/roles/external_subnet/tasks/main.yml @@ -1,5 +1,12 @@ --- - name: Inputs for external subnets task - include_tasks: external_subnet.yml + ansible.builtin.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}}" } + - 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/meta/main.yml b/examples/iaas/roles/fip/meta/main.yml index a734b2343..5289004d7 100644 --- a/examples/iaas/roles/fip/meta/main.yml +++ b/examples/iaas/roles/fip/meta/main.yml @@ -1,2 +1,3 @@ - collections: - - nutanix.ncp +--- +collections: + - nutanix.ncp diff --git a/examples/iaas/roles/fip/tasks/fip.yml b/examples/iaas/roles/fip/tasks/fip.yml index 9db0eda42..56f3c36f7 100644 --- a/examples/iaas/roles/fip/tasks/fip.yml +++ b/examples/iaas/roles/fip/tasks/fip.yml @@ -1,13 +1,14 @@ --- - name: Assign Floating IP for "{{ item.vm_name }}" - ntnx_floating_ips: - state: present - external_subnet: - name: "Ext-Nat" - vm: - name: "{{ item.vm_name }}" + nutanix.ncp.ntnx_floating_ips: + state: present + external_subnet: + name: Ext-Nat + vm: + name: "{{ item.vm_name }}" register: fip -- debug: +- name: Print fip uuid and vm name + ansible.builtin.debug: msg: - - "VM name: {{ item.vm_name }}" - - "uuid: {{ fip.fip_uuid }}" + - "VM name: {{ item.vm_name }}" + - "uuid: {{ fip.fip_uuid }}" diff --git a/examples/iaas/roles/fip/tasks/main.yml b/examples/iaas/roles/fip/tasks/main.yml index 5f20326a5..aa531a7f6 100644 --- a/examples/iaas/roles/fip/tasks/main.yml +++ b/examples/iaas/roles/fip/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Inputs for Floating IP task - include_tasks: fip.yml + ansible.builtin.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/examples/iaas/roles/overlay_subnet/meta/main.yml b/examples/iaas/roles/overlay_subnet/meta/main.yml index a734b2343..5289004d7 100644 --- a/examples/iaas/roles/overlay_subnet/meta/main.yml +++ b/examples/iaas/roles/overlay_subnet/meta/main.yml @@ -1,2 +1,3 @@ - collections: - - nutanix.ncp +--- +collections: + - nutanix.ncp diff --git a/examples/iaas/roles/overlay_subnet/tasks/main.yml b/examples/iaas/roles/overlay_subnet/tasks/main.yml index 357cd3989..3831c3133 100644 --- a/examples/iaas/roles/overlay_subnet/tasks/main.yml +++ b/examples/iaas/roles/overlay_subnet/tasks/main.yml @@ -1,14 +1,44 @@ --- - name: Inputs for overlay subnets - include_tasks: overlay_subnet.yml + ansible.builtin.include_tasks: overlay_subnet.yml with_items: - - { name: "{{Prod_SubnetA.name}}", vpc_name: "{{Prod_SubnetA.vpc_name}}", - nip: "{{Prod_SubnetA.nip}}", prefix: "{{Prod_SubnetA.prefix}}", - gip: "{{Prod_SubnetA.gip}}", sip: "{{Prod_SubnetA.sip}}", eip: "{{Prod_SubnetA.eip}}", - domain_name: "{{domain_name}}", dns_servers: "{{dns_servers}}", domain_search: "{{domain_search}}" } - - { name: "{{Prod_SubnetB.name}}", vpc_name: "{{Prod_SubnetB.vpc_name}}", nip: "{{Prod_SubnetB.nip}}", prefix: "{{Prod_SubnetB.prefix}}", gip: "{{Prod_SubnetB.gip}}", sip: "{{Prod_SubnetB.sip}}", eip: "{{Prod_SubnetB.eip}}", - domain_name: "{{domain_name}}", dns_servers: "{{dns_servers}}", domain_search: "{{domain_search}}" } - - { name: "{{Dev_SubnetA.name}}", vpc_name: "{{Dev_SubnetA.vpc_name}}", nip: "{{Dev_SubnetA.nip}}", prefix: "{{Dev_SubnetA.prefix}}", gip: "{{Dev_SubnetA.gip}}", sip: "{{Dev_SubnetA.sip}}", eip: "{{Dev_SubnetA.eip}}", - domain_name: "{{domain_name}}", dns_servers: "{{dns_servers}}", domain_search: "{{domain_search}}" } - - { name: "{{Dev_SubnetB.name}}", vpc_name: "{{Dev_SubnetB.vpc_name}}", nip: "{{Dev_SubnetB.nip}}", prefix: "{{Dev_SubnetB.prefix}}", gip: "{{Dev_SubnetB.gip}}", sip: "{{Dev_SubnetB.sip}}", eip: "{{Dev_SubnetB.eip}}", - domain_name: "{{domain_name}}", dns_servers: "{{dns_servers}}", domain_search: "{{domain_search}}" } + - name: "{{ Prod_SubnetA.name }}" + vpc_name: "{{ Prod_SubnetA.vpc_name }}" + nip: "{{ Prod_SubnetA.nip }}" + prefix: "{{ Prod_SubnetA.prefix }}" + gip: "{{ Prod_SubnetA.gip }}" + sip: "{{ Prod_SubnetA.sip }}" + eip: "{{ Prod_SubnetA.eip }}" + domain_name: "{{ domain_name }}" + dns_servers: "{{ dns_servers }}" + domain_search: "{{ domain_search }}" + - name: "{{ Prod_SubnetB.name }}" + vpc_name: "{{ Prod_SubnetB.vpc_name }}" + nip: "{{ Prod_SubnetB.nip }}" + prefix: "{{ Prod_SubnetB.prefix }}" + gip: "{{ Prod_SubnetB.gip }}" + sip: "{{ Prod_SubnetB.sip }}" + eip: "{{ Prod_SubnetB.eip }}" + domain_name: "{{ domain_name }}" + dns_servers: "{{ dns_servers }}" + domain_search: "{{ domain_search }}" + - name: "{{ Dev_SubnetA.name }}" + vpc_name: "{{ Dev_SubnetA.vpc_name }}" + nip: "{{ Dev_SubnetA.nip }}" + prefix: "{{ Dev_SubnetA.prefix }}" + gip: "{{ Dev_SubnetA.gip }}" + sip: "{{ Dev_SubnetA.sip }}" + eip: "{{ Dev_SubnetA.eip }}" + domain_name: "{{ domain_name }}" + dns_servers: "{{ dns_servers }}" + domain_search: "{{ domain_search }}" + - name: "{{ Dev_SubnetB.name }}" + vpc_name: "{{ Dev_SubnetB.vpc_name }}" + nip: "{{ Dev_SubnetB.nip }}" + prefix: "{{ Dev_SubnetB.prefix }}" + gip: "{{ Dev_SubnetB.gip }}" + sip: "{{ Dev_SubnetB.sip }}" + eip: "{{ Dev_SubnetB.eip }}" + domain_name: "{{ domain_name }}" + dns_servers: "{{ dns_servers }}" + domain_search: "{{ domain_search }}" diff --git a/examples/iaas/roles/overlay_subnet/tasks/overlay_subnet.yml b/examples/iaas/roles/overlay_subnet/tasks/overlay_subnet.yml index 50866ba23..1e02cb1d3 100644 --- a/examples/iaas/roles/overlay_subnet/tasks/overlay_subnet.yml +++ b/examples/iaas/roles/overlay_subnet/tasks/overlay_subnet.yml @@ -1,6 +1,10 @@ --- -- name: Create {{ item.name }} overlay subnet - ntnx_subnets: +- name: Start overlay subnet task + ansible.builtin.debug: + msg: Create {{ item.name }} overlay subnet + +- name: Create overlay subnet + nutanix.ncp.ntnx_subnets: state: present name: "{{ item.name }}" overlay_subnet: @@ -11,14 +15,15 @@ network_prefix: "{{ item.prefix }}" gateway_ip: "{{ item.gip }}" ip_pools: - - start_ip: "{{ item.sip }}" - end_ip: "{{ item.eip }}" + - start_ip: "{{ item.sip }}" + end_ip: "{{ item.eip }}" dhcp: - dns_servers: "{{ item.dns_servers }}" - domain_name: "{{ item.domain_name }}" - domain_search: "{{ item.domain_search }}" + dns_servers: "{{ item.dns_servers }}" + domain_name: "{{ item.domain_name }}" + domain_search: "{{ item.domain_search }}" register: overlay -- debug: +- name: Print overlay name and uuid + ansible.builtin.debug: msg: - "name: {{ overlay.response.status.name }}" - "uuid: {{ overlay.subnet_uuid }}" diff --git a/examples/iaas/roles/pbr/meta/main.yml b/examples/iaas/roles/pbr/meta/main.yml index a734b2343..5289004d7 100644 --- a/examples/iaas/roles/pbr/meta/main.yml +++ b/examples/iaas/roles/pbr/meta/main.yml @@ -1,2 +1,3 @@ - collections: - - nutanix.ncp +--- +collections: + - nutanix.ncp diff --git a/examples/iaas/roles/pbr/tasks/main.yml b/examples/iaas/roles/pbr/tasks/main.yml index 72428dd2b..6c1f2e67b 100644 --- a/examples/iaas/roles/pbr/tasks/main.yml +++ b/examples/iaas/roles/pbr/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Include PBR task - include_tasks: pbr.yml + ansible.builtin.include_tasks: pbr.yml with_items: - - { vpc_name: "{{vpc_names[0]}}", priority: 101, nip: 10.1.2.0, prefix: 24 } - - { vpc_name: "{{vpc_names[1]}}", priority: 101, nip: 10.1.2.0, prefix: 24 } + - { vpc_name: "{{ vpc_names[0] }}", priority: 101, nip: 10.1.2.0, prefix: 24 } + - { vpc_name: "{{ vpc_names[1] }}", priority: 101, nip: 10.1.2.0, prefix: 24 } diff --git a/examples/iaas/roles/pbr/tasks/pbr.yml b/examples/iaas/roles/pbr/tasks/pbr.yml index 760c69621..1cd490972 100644 --- a/examples/iaas/roles/pbr/tasks/pbr.yml +++ b/examples/iaas/roles/pbr/tasks/pbr.yml @@ -1,22 +1,23 @@ --- - name: Create PBR for vpc "{{ item.vpc_name }}" - ntnx_pbrs: + nutanix.ncp.ntnx_pbrs: state: present vpc: name: "{{ item.vpc_name }}" priority: "{{ item.priority }}" source: network: - ip: "{{item.nip}}" - prefix: "{{item.prefix}}" + ip: "{{ item.nip }}" + prefix: "{{ item.prefix }}" destination: - external: True + external: true protocol: - any: True + any: true action: - deny: True + deny: true register: pbr -- debug: +- name: Print vpc name and pbr uuid + ansible.builtin.debug: msg: - - "vpc_name: {{ item.vpc_name }}" - - "uuid: {{ pbr.pbr_uuid }}" + - "vpc_name: {{ item.vpc_name }}" + - "uuid: {{ pbr.pbr_uuid }}" diff --git a/examples/iaas/roles/pbr_delete/meta/main.yml b/examples/iaas/roles/pbr_delete/meta/main.yml index a734b2343..5289004d7 100644 --- a/examples/iaas/roles/pbr_delete/meta/main.yml +++ b/examples/iaas/roles/pbr_delete/meta/main.yml @@ -1,2 +1,3 @@ - collections: - - nutanix.ncp +--- +collections: + - nutanix.ncp diff --git a/examples/iaas/roles/pbr_delete/tasks/main.yml b/examples/iaas/roles/pbr_delete/tasks/main.yml index 0129299a5..209c40f68 100644 --- a/examples/iaas/roles/pbr_delete/tasks/main.yml +++ b/examples/iaas/roles/pbr_delete/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Include PBR task - include_tasks: pbr_delete.yml + ansible.builtin.include_tasks: pbr_delete.yml with_items: - { pbr_uuid: 8c6ce427-a63d-482d-bf59-b8a14a062c1d } - { pbr_uuid: fb6fb539-7b24-48a1-b285-9a1fb8b97e5f } diff --git a/examples/iaas/roles/pbr_delete/tasks/pbr_delete.yml b/examples/iaas/roles/pbr_delete/tasks/pbr_delete.yml index dd2562cf1..d758c66f1 100644 --- a/examples/iaas/roles/pbr_delete/tasks/pbr_delete.yml +++ b/examples/iaas/roles/pbr_delete/tasks/pbr_delete.yml @@ -1,9 +1,10 @@ --- - name: Delete PBR "{{ item.pbr_uuid }}" - ntnx_pbrs: + nutanix.ncp.nutanix.ncp.ntnx_pbrs: state: absent pbr_uuid: "{{ item.pbr_uuid }}" register: pbr -- debug: +- name: Print pbr uuid + ansible.builtin.debug: msg: - - "uuid: {{ pbr.pbr_uuid }}" + - "uuid: {{ pbr.pbr_uuid }}" diff --git a/examples/iaas/roles/static_route/meta/main.yml b/examples/iaas/roles/static_route/meta/main.yml index a734b2343..5289004d7 100644 --- a/examples/iaas/roles/static_route/meta/main.yml +++ b/examples/iaas/roles/static_route/meta/main.yml @@ -1,2 +1,3 @@ - collections: - - nutanix.ncp +--- +collections: + - nutanix.ncp diff --git a/examples/iaas/roles/static_route/tasks/main.yml b/examples/iaas/roles/static_route/tasks/main.yml index c4a177a8f..3bfe9cf24 100644 --- a/examples/iaas/roles/static_route/tasks/main.yml +++ b/examples/iaas/roles/static_route/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Inputs for static routes task - include_tasks: static_route.yml + ansible.builtin.include_tasks: static_route.yml with_items: - - { vpc_uuid: "{{vpc_uuids[0]}}", subnet_name: "{{external_subnet.name}}", destination: "10.2.2.0/24"} - - { vpc_uuid: "{{vpc_uuids[1]}}", subnet_name: "{{external_subnet.name}}", destination: "10.2.3.0/24"} + - { vpc_uuid: "{{ vpc_uuids[0] }}", subnet_name: "{{ external_subnet.name }}", destination: 10.2.2.0/24 } + - { vpc_uuid: "{{ vpc_uuids[1] }}", subnet_name: "{{ external_subnet.name }}", destination: 10.2.3.0/24 } diff --git a/examples/iaas/roles/static_route/tasks/static_route.yml b/examples/iaas/roles/static_route/tasks/static_route.yml index 924571431..fbe1202f9 100644 --- a/examples/iaas/roles/static_route/tasks/static_route.yml +++ b/examples/iaas/roles/static_route/tasks/static_route.yml @@ -1,14 +1,15 @@ --- - - name: Create static route - ntnx_static_routes: - state: present - vpc_uuid: "{{ item.vpc_uuid }}" - static_routes: - - destination: "{{ item.destination }}" - next_hop: - external_subnet_ref: - name: "{{ item.subnet_name }}" - register: static_route - - debug: - msg: - - "uuid: {{ static_route.response.metadata.uuid }}" +- name: Create static route + nutanix.ncp.ntnx_static_routes: + state: present + vpc_uuid: "{{ item.vpc_uuid }}" + static_routes: + - destination: "{{ item.destination }}" + next_hop: + external_subnet_ref: + name: "{{ item.subnet_name }}" + register: static_route +- name: Print static route uuid + ansible.builtin.debug: + msg: + - "uuid: {{ static_route.response.metadata.uuid }}" diff --git a/examples/iaas/roles/vm/meta/main.yml b/examples/iaas/roles/vm/meta/main.yml index a734b2343..5289004d7 100644 --- a/examples/iaas/roles/vm/meta/main.yml +++ b/examples/iaas/roles/vm/meta/main.yml @@ -1,2 +1,3 @@ - collections: - - nutanix.ncp +--- +collections: + - nutanix.ncp diff --git a/examples/iaas/roles/vm/tasks/main.yml b/examples/iaas/roles/vm/tasks/main.yml index 7c3949250..829884979 100644 --- a/examples/iaas/roles/vm/tasks/main.yml +++ b/examples/iaas/roles/vm/tasks/main.yml @@ -1,8 +1,28 @@ --- - name: Inputs for vm task - include_tasks: vm.yml + ansible.builtin.include_tasks: vm.yml with_items: - - {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} + - 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 diff --git a/examples/iaas/roles/vm/tasks/vm.yml b/examples/iaas/roles/vm/tasks/vm.yml index ca2332e4c..e07e64578 100644 --- a/examples/iaas/roles/vm/tasks/vm.yml +++ b/examples/iaas/roles/vm/tasks/vm.yml @@ -1,6 +1,10 @@ --- -- name: Create "{{ item.name }}" VM - ntnx_vms: +- name: Start vm task + ansible.builtin.debug: + msg: Create "{{ item.name }}" VM + +- name: Create VM + nutanix.ncp.ntnx_vms: state: present name: "{{ item.name }}" desc: "{{ item.desc }}" @@ -12,13 +16,14 @@ name: "{{ item.subnet_name }}" private_ip: "{{ item.private_ip }}" disks: - - type: "DISK" - size_gb: 30 - bus: "SATA" - clone_image: - name: "{{ item.image_name }}" + - type: DISK + size_gb: 30 + bus: SATA + clone_image: + name: "{{ item.image_name }}" register: vm -- debug: +- name: Print vm name and uuid + ansible.builtin.debug: msg: - - "name: {{ vm.response.status.name }}" - - "uuid: {{ vm.vm_uuid }}" + - "name: {{ vm.response.status.name }}" + - "uuid: {{ vm.vm_uuid }}" diff --git a/examples/iaas/roles/vpc/meta/main.yml b/examples/iaas/roles/vpc/meta/main.yml index a734b2343..5289004d7 100644 --- a/examples/iaas/roles/vpc/meta/main.yml +++ b/examples/iaas/roles/vpc/meta/main.yml @@ -1,2 +1,3 @@ - collections: - - nutanix.ncp +--- +collections: + - nutanix.ncp diff --git a/examples/iaas/roles/vpc/tasks/main.yml b/examples/iaas/roles/vpc/tasks/main.yml index 21ce27258..a15150041 100644 --- a/examples/iaas/roles/vpc/tasks/main.yml +++ b/examples/iaas/roles/vpc/tasks/main.yml @@ -1,8 +1,9 @@ --- -- set_fact: +- name: Define vpc_uuids variable + ansible.builtin.set_fact: vpc_uuids: [] - name: Inputs vpcs task - include_tasks: vpc.yml + ansible.builtin.include_tasks: vpc.yml with_items: - - { name: "{{vpc_names[0]}}", subnet_name: "{{external_subnet.name}}"} - - { name: "{{vpc_names[1]}}", subnet_name: "{{external_subnet.name}}"} + - { name: "{{ vpc_names[0] }}", subnet_name: "{{ external_subnet.name }}" } + - { name: "{{ vpc_names[1] }}", subnet_name: "{{ external_subnet.name }}" } diff --git a/examples/iaas/roles/vpc/tasks/vpc.yml b/examples/iaas/roles/vpc/tasks/vpc.yml index a87d5b5d2..9513ff964 100644 --- a/examples/iaas/roles/vpc/tasks/vpc.yml +++ b/examples/iaas/roles/vpc/tasks/vpc.yml @@ -1,14 +1,20 @@ --- -- name: Create {{ item.name }} VPC with external connectivity to "{{ item.subnet_name }}" - ntnx_vpcs: - state: present - name: "{{ item.name }}" - external_subnets: - - subnet_name: "{{ item.subnet_name }}" +- name: Start vpc task + ansible.builtin.debug: + msg: Create {{ item.name }} VPC with external connectivity to "{{ item.subnet_name }}" + +- name: Create VPC with external connectivity + nutanix.ncp.ntnx_vpcs: + state: present + name: "{{ item.name }}" + external_subnets: + - subnet_name: "{{ item.subnet_name }}" register: vpc -- debug: +- name: Print vpc response + ansible.builtin.debug: msg: - - "name: {{ vpc.response.status.name }}" - - "uuid: {{ vpc.vpc_uuid }}" -- set_fact: - vpc_uuids: "{{ vpc_uuids + [ vpc.vpc_uuid ] }}" + - "name: {{ vpc.response.status.name }}" + - "uuid: {{ vpc.vpc_uuid }}" +- name: Define vpc_uuids variable + ansible.builtin.set_fact: + vpc_uuids: "{{ vpc_uuids + [vpc.vpc_uuid] }}" diff --git a/examples/iaas/vars.yml b/examples/iaas/vars.yml index ff9daee05..86cf7a804 100644 --- a/examples/iaas/vars.yml +++ b/examples/iaas/vars.yml @@ -9,41 +9,41 @@ external_subnet: gip: 10.44.3.193 sip: 10.44.3.198 eip: 10.44.3.207 - eNat: True -vpc_names: ["Prod", "Dev"] -domain_search: ["calm.nutanix.com", "eng.nutanix.com"] -dns_servers: ["8.8.8.8", "8.8.8.4"] -domain_name: "calm.nutanix.com" + eNat: true +vpc_names: [Prod, Dev] +domain_search: [calm.nutanix.com, eng.nutanix.com] +dns_servers: [8.8.8.8, 8.8.8.4] +domain_name: calm.nutanix.com Prod_SubnetA: - 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 + 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 Prod_SubnetB: - 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 + 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 Dev_SubnetA: - 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 + 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 Dev_SubnetB: - 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 + 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 diff --git a/examples/images.yml b/examples/images.yml index 82f11491d..5624ac958 100644 --- a/examples/images.yml +++ b/examples/images.yml @@ -2,8 +2,6 @@ - name: Images playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,14 +10,14 @@ validate_certs: false tasks: - name: Setting Variables - set_fact: + ansible.builtin.set_fact: image_uuid: "" source_path: "" source_uri: "" - clusters_name: "" + clusters_name: "" - - name: create image from local workstation - ntnx_images: + - name: Create image from local workstation + nutanix.ncp.ntnx_images: state: "present" source_path: "{{source_path}}" clusters: @@ -38,8 +36,8 @@ product_version: "1.2.0" wait: true - - name: create image from with source as remote server file location - ntnx_images: + - name: Create image from with source as remote server file location + nutanix.ncp.ntnx_images: state: "present" source_uri: "{{source_uri}}" clusters: @@ -58,8 +56,8 @@ product_version: "1.2.0" wait: true - - name: override categories of existing image - ntnx_images: + - name: Override categories of existing image + nutanix.ncp.ntnx_images: state: "present" image_uuid: "{{image-uuid}}" categories: @@ -69,15 +67,15 @@ - Backup wait: true - - name: dettach all categories from existing image - ntnx_images: + - name: Dettach all categories from existing image + nutanix.ncp.ntnx_images: state: "present" image_uuid: "00000000-0000-0000-0000-000000000000" remove_categories: true wait: true - - name: delete existing image - ntnx_images: + - name: Delete existing image + nutanix.ncp.ntnx_images: state: "absent" image_uuid: "00000000-0000-0000-0000-000000000000" wait: true diff --git a/examples/inventory/nutanix.yaml b/examples/inventory/nutanix.yaml index 89f3c20ce..16abac947 100644 --- a/examples/inventory/nutanix.yaml +++ b/examples/inventory/nutanix.yaml @@ -1,13 +1,14 @@ +--- plugin: nutanix.ncp.ntnx_prism_vm_inventory nutanix_hostname: nutanix_username: nutanix_password: validate_certs: false -data: {"offset": 0, "length": 1000} +data: { offset: 0, length: 1000 } groups: group_1: "'' in name" group_2: "''==name" keyed_groups: - - prefix: "host" - separator: ':' - key: "ansible_host" + - prefix: host + separator: ":" + key: ansible_host diff --git a/examples/karbon/cluster_info.yml b/examples/karbon/cluster_info.yml index b5e916b25..7c56ebf71 100644 --- a/examples/karbon/cluster_info.yml +++ b/examples/karbon/cluster_info.yml @@ -1,9 +1,7 @@ --- -- name: get k8s cluster info +- name: Get k8s cluster info hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,22 +10,23 @@ validate_certs: false tasks: - - set_fact: - cluster_name: + - name: Set cluster name + ansible.builtin.set_fact: + cluster_name: - - name: test getting cluster using name - ntnx_karbon_clusters_info: - cluster_name: "{{cluster_name}}" - register: result + - name: Test getting cluster using name + nutanix.ncp.ntnx_karbon_clusters_info: + cluster_name: "{{ cluster_name }}" + register: result - - name: test getting cluster with ssh config using cluster name - ntnx_karbon_clusters_info: - cluster_name: "{{cluster_name}}" - fetch_ssh_credentials: true - register: result + - name: Test getting cluster with ssh config using cluster name + nutanix.ncp.ntnx_karbon_clusters_info: + cluster_name: "{{ cluster_name }}" + fetch_ssh_credentials: true + register: result - - name: test getting cluster with kubeconfig config using cluster name - ntnx_karbon_clusters_info: - cluster_name: "{{cluster_name}}" - fetch_kubeconfig: true - register: result + - name: Test getting cluster with kubeconfig config using cluster name + nutanix.ncp.ntnx_karbon_clusters_info: + cluster_name: "{{ cluster_name }}" + fetch_kubeconfig: true + register: result diff --git a/examples/karbon/create_k8s_cluster.yml b/examples/karbon/create_k8s_cluster.yml index 689975485..ae17d9e4d 100644 --- a/examples/karbon/create_k8s_cluster.yml +++ b/examples/karbon/create_k8s_cluster.yml @@ -1,9 +1,7 @@ --- -- name: create k8s cluster +- name: Create k8s cluster hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,171 +10,171 @@ validate_certs: false tasks: - - set_fact: - cluster: - name: - uuid: - node_subnet: - name: - uuid: - storage_class: - name: - storage_container: - name: - cni: - node_cidr_mask_size: 24 - service_ipv4_cidr: "172.19.0.0/16" - pod_ipv4_cidr: "172.20.0.0/16" - karbon_name: test-module21 - k8s_version: "1.19.8-0" - host_os: "ntnx-1.0" - nutanix_cluster_password: - nutanix_cluster_username: - control_plane_virtual_ip: + - name: Set vars + ansible.builtin.set_fact: + cluster: + name: + uuid: + node_subnet: + name: + uuid: + storage_class: + name: + storage_container: + name: + cni: + node_cidr_mask_size: 24 + service_ipv4_cidr: 172.19.0.0/16 + pod_ipv4_cidr: 172.20.0.0/16 + karbon_name: test-module21 + k8s_version: 1.19.8-0 + host_os: ntnx-1.0 + nutanix_cluster_password: + nutanix_cluster_username: + control_plane_virtual_ip: + ############################# + - name: Create DEV cluster with Flannel network provider + nutanix.ncp.ntnx_karbon_clusters: + cluster: + uuid: "{{ cluster.uuid }}" + name: "{{ karbon_name }}" + k8s_version: "{{ k8s_version }}" + host_os: "{{ host_os }}" + node_subnet: + name: "{{ node_subnet.name }}" + cluster_type: DEV + cni: + 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: "{{ storage_class.name }}" + reclaim_policy: Delete + storage_container: "{{ storage_container.name }}" + file_system: ext4 + flash_mode: false + register: result - ############################# - - name: create DEV cluster with Flannel network provider - ntnx_karbon_clusters: - cluster: - uuid: "{{cluster.uuid}}" - name: "{{karbon_name}}" - k8s_version: "{{k8s_version}}" - host_os: "{{host_os}}" - node_subnet: - name: "{{node_subnet.name}}" - cluster_type: DEV - cni: - 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: "{{storage_class.name}}" - reclaim_policy: Delete - storage_container: "{{storage_container.name}}" - file_system: ext4 - flash_mode: False - register: result + - name: Delete dev cluster + nutanix.ncp.ntnx_karbon_clusters: + state: absent + name: "{{ result.response.name }}" + register: result - - name: delete dev cluster - ntnx_karbon_clusters: - state: absent - name: "{{result.response.name}}" - register: result + - name: Create DEV cluster with Calico network provider + nutanix.ncp.ntnx_karbon_clusters: + cluster: + name: "{{ cluster.name }}" + name: "{{ karbon_name }}" + k8s_version: "{{ k8s_version }}" + host_os: "{{ host_os }}" + node_subnet: + uuid: "{{ node_subnet.uuid }}" + cni: + 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 + custom_node_configs: + etcd: + num_instances: 1 + cpu: 4 + memory_gb: 8 + disk_gb: 120 + masters: + num_instances: 1 + cpu: 4 + memory_gb: 8 + disk_gb: 120 + workers: + num_instances: 1 + cpu: 8 + memory_gb: 8 + disk_gb: 120 + storage_class: + nutanix_cluster_password: "{{ nutanix_cluster_password }}" + nutanix_cluster_username: "{{ nutanix_cluster_username }}" + default_storage_class: true + name: "{{ storage_class.name }}" + reclaim_policy: Retain + storage_container: "{{ storage_container.name }}" + file_system: xfs + flash_mode: true + register: result - - name: create DEV cluster with Calico network provider - ntnx_karbon_clusters: - cluster: - name: "{{cluster.name}}" - name: "{{karbon_name}}" - k8s_version: "{{k8s_version}}" - host_os: "{{host_os}}" - node_subnet: - uuid: "{{node_subnet.uuid}}" - cni: - 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 - custom_node_configs: - etcd: - num_instances: 1 + - name: Create worker node pool with subnet uuid + nutanix.ncp.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 - masters: - num_instances: 1 - cpu: 4 - memory_gb: 8 - disk_gb: 120 - workers: - num_instances: 1 - cpu: 8 - memory_gb: 8 - disk_gb: 120 - storage_class: - nutanix_cluster_password: "{{nutanix_cluster_password}}" - nutanix_cluster_username: "{{nutanix_cluster_username}}" - default_storage_class: True - name: "{{storage_class.name}}" - reclaim_policy: Retain - 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 + 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: + - name: Update pool by increasing cpu,memory_gb,num_instances and add labels + nutanix.ncp.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 + add_labels: + property1: test-property1 + register: result + ignore_errors: true - - name: create prod cluster - ntnx_karbon_clusters: - cluster: - uuid: "{{cluster.uuid}}" - name: "{{karbon_name}}" - k8s_version: "{{k8s_version}}" - host_os: "{{host_os}}" - node_subnet: - name: "{{node_subnet.name}}" - cluster_type: PROD - cni: - node_cidr_mask_size: "{{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: "{{storage_class.name}}" - reclaim_policy: Delete - storage_container: "{{storage_container.name}}" - file_system: ext4 - flash_mode: False - control_plane_virtual_ip: "{{control_plane_virtual_ip}}" - custom_node_configs: - etcd: - num_instances: 1 - cpu: 4 - memory_gb: 8 - disk_gb: 240 - masters: - num_instances: 1 - cpu: 4 - memory_gb: 8 - disk_gb: 240 - workers: - num_instances: 1 - cpu: 8 - memory_gb: 8 - disk_gb: 240 - register: result + - name: Create prod cluster + nutanix.ncp.ntnx_karbon_clusters: + cluster: + uuid: "{{ cluster.uuid }}" + name: "{{ karbon_name }}" + k8s_version: "{{ k8s_version }}" + host_os: "{{ host_os }}" + node_subnet: + name: "{{ node_subnet.name }}" + cluster_type: PROD + cni: + node_cidr_mask_size: "{{ 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: "{{ storage_class.name }}" + reclaim_policy: Delete + storage_container: "{{ storage_container.name }}" + file_system: ext4 + flash_mode: false + control_plane_virtual_ip: "{{ control_plane_virtual_ip }}" + custom_node_configs: + etcd: + num_instances: 1 + cpu: 4 + memory_gb: 8 + disk_gb: 240 + masters: + num_instances: 1 + cpu: 4 + memory_gb: 8 + disk_gb: 240 + workers: + num_instances: 1 + cpu: 8 + memory_gb: 8 + disk_gb: 240 + register: result diff --git a/examples/karbon/create_registries.yml b/examples/karbon/create_registries.yml index 42c75e310..5992fbee8 100644 --- a/examples/karbon/create_registries.yml +++ b/examples/karbon/create_registries.yml @@ -1,9 +1,7 @@ --- -- name: create registeries +- name: Create registeries hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,30 +10,31 @@ validate_certs: false tasks: - - set_fact: - registry_name: - url: - port_number: - username: - password: + - name: Set vars + ansible.builtin.set_fact: + registry_name: + url: + port_number: + username: + password: - - name: create registry - ntnx_karbon_registries: - name: "{{registry_name}}" - url: "{{url}}" - port: "{{port_number}}" - register: result + - name: Create registry + nutanix.ncp.ntnx_karbon_registries: + name: "{{ registry_name }}" + url: "{{ url }}" + port: "{{ port_number }}" + register: result - - name: delete registry - ntnx_karbon_registries: - name: "{{registry_name}}" - state: absent - register: result + - name: Delete registry + nutanix.ncp.ntnx_karbon_registries: + name: "{{ registry_name }}" + state: absent + register: result - - name: create registry with username and password - ntnx_karbon_registries: - name: "{{registry_name}}" - url: "{{url}}" - username: "{{username}}" - password: "{{password}}" - register: result + - name: Create registry with username and password + nutanix.ncp.ntnx_karbon_registries: + name: "{{ registry_name }}" + url: "{{ url }}" + username: "{{ username }}" + password: "{{ password }}" + register: result diff --git a/examples/karbon/registries_info.yml b/examples/karbon/registries_info.yml index 81c2d8742..935658ee6 100644 --- a/examples/karbon/registries_info.yml +++ b/examples/karbon/registries_info.yml @@ -1,9 +1,7 @@ --- -- name: get registeries info +- name: Get registeries info hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,11 +10,11 @@ validate_certs: false tasks: - - name: test getting all registries - ntnx_karbon_registries_info: - register: registries + - name: Test getting all registries + nutanix.ncp.ntnx_karbon_registries_info: + register: registries - - name: test getting particular register using name - ntnx_karbon_registries_info: + - name: Test getting particular register using name + nutanix.ncp.ntnx_karbon_registries_info: registry_name: "{{ registries.response[1].name }}" - register: result + register: result diff --git a/examples/ndb/all_day2_actions.yml b/examples/ndb/all_day2_actions.yml index 4322a1302..35dc5e2e7 100644 --- a/examples/ndb/all_day2_actions.yml +++ b/examples/ndb/all_day2_actions.yml @@ -7,13 +7,9 @@ # 4. Restore database to previously created snapshot and latest snapshot # 5. Scale database # 6. Add/Remove linked databases - - -- name: perform day2 actions +- name: Perform day2 actions hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -22,110 +18,109 @@ validate_certs: false tasks: - ############################################ snapshots ########################################### - - name: create snapshot with minimal spec - ntnx_ndb_database_snapshots: - name: "{{snapshot_name}}1" - time_machine_uuid: "{{time_machine_uuid}}" + - name: Create snapshot with minimal spec + nutanix.ncp.ntnx_ndb_database_snapshots: + name: "{{ snapshot_name }}1" + time_machine_uuid: "{{ time_machine_uuid }}" register: result - - name: create snapshot with expiry - ntnx_ndb_database_snapshots: - name: "{{snapshot_name}}2" - time_machine_uuid: "{{time_machine_uuid}}" + - name: Create snapshot with expiry + nutanix.ncp.ntnx_ndb_database_snapshots: + name: "{{ snapshot_name }}2" + time_machine_uuid: "{{ time_machine_uuid }}" expiry_days: 4 register: result - - set_fact: - snapshot_uuid: "{{result.snapshot_uuid}}" + - name: Set snapshot uuid + ansible.builtin.set_fact: + snapshot_uuid: "{{ result.snapshot_uuid }}" - - name: rename snapshot - ntnx_ndb_database_snapshots: - snapshot_uuid: "{{snapshot_uuid}}" - name: "{{snapshot_name}}2-updated" + - name: Rename snapshot + nutanix.ncp.ntnx_ndb_database_snapshots: + snapshot_uuid: "{{ snapshot_uuid }}" + name: "{{ snapshot_name }}2-updated" register: result - - name: update expiry - ntnx_ndb_database_snapshots: - snapshot_uuid: "{{snapshot_uuid}}" + - name: Update expiry + nutanix.ncp.ntnx_ndb_database_snapshots: + snapshot_uuid: "{{ snapshot_uuid }}" expiry_days: 5 register: result - - name: remove expiry schedule - ntnx_ndb_database_snapshots: - snapshot_uuid: "{{snapshot_uuid}}" + - name: Remove expiry schedule + nutanix.ncp.ntnx_ndb_database_snapshots: + snapshot_uuid: "{{ snapshot_uuid }}" remove_expiry: true register: result - name: Add expiry schedule and rename - ntnx_ndb_database_snapshots: - snapshot_uuid: "{{snapshot_uuid}}" - name: "{{snapshot_name}}2" + nutanix.ncp.ntnx_ndb_database_snapshots: + snapshot_uuid: "{{ snapshot_uuid }}" + name: "{{ snapshot_name }}2" expiry_days: 6 register: result - ############################################ log catchup ###################################### - - name: perform log catchup for restore - ntnx_ndb_database_log_catchup: - time_machine_uuid: "{{time_machine_uuid}}" + - name: Perform log catchup for restore + nutanix.ncp.ntnx_ndb_database_log_catchup: + time_machine_uuid: "{{ time_machine_uuid }}" for_restore: true register: result - - name: perform log catchup - ntnx_ndb_database_log_catchup: - time_machine_uuid: "{{time_machine_uuid}}" + - name: Perform log catchup + nutanix.ncp.ntnx_ndb_database_log_catchup: + time_machine_uuid: "{{ time_machine_uuid }}" for_restore: true register: result ########################################### restore ########################################### - - name: perform using pitr timestamp - ntnx_ndb_database_restore: - db_uuid: "{{db_uuid}}" + - name: Perform using pitr timestamp + nutanix.ncp.ntnx_ndb_database_restore: + db_uuid: "{{ db_uuid }}" pitr_timestamp: "2023-01-02 11:02:22" - timezone: "UTC" + timezone: UTC register: result - - name: perform restore using latest snapshot - ntnx_ndb_database_restore: - db_uuid: "{{db_uuid}}" - snapshot_uuid: "{{snapshot_uuid}}" + - name: Perform restore using latest snapshot + nutanix.ncp.ntnx_ndb_database_restore: + db_uuid: "{{ db_uuid }}" + snapshot_uuid: "{{ snapshot_uuid }}" register: result - - name: perform restore using snapshot uuid - ntnx_ndb_database_restore: - db_uuid: "{{db_uuid}}" - snapshot_uuid: "{{snapshot_uuid}}" + - name: Perform restore using snapshot uuid + nutanix.ncp.ntnx_ndb_database_restore: + db_uuid: "{{ db_uuid }}" + snapshot_uuid: "{{ snapshot_uuid }}" register: result ########################################### scaling ########################################### - - name: extend database storage for scaling database - ntnx_ndb_database_scale: - db_uuid: "{{db_uuid}}" + - name: Extend database storage for scaling database + nutanix.ncp.ntnx_ndb_database_scale: + db_uuid: "{{ db_uuid }}" storage_gb: 2 - pre_update_cmd: "ls" - post_update_cmd: "ls -a" + pre_update_cmd: ls + post_update_cmd: ls -a register: result ############################################ add / remove linked databases ########################################### - - name: add databases in database instance - ntnx_ndb_linked_databases: - db_instance_uuid: "{{db_uuid}}" + - name: Add databases in database instance + nutanix.ncp.ntnx_ndb_linked_databases: + db_instance_uuid: "{{ db_uuid }}" databases: - test1 - test2 register: result - - name: remove databases in database instance - ntnx_ndb_linked_databases: - state: "absent" - db_instance_uuid: "{{db_uuid}}" - database_uuid: "{{linked_databases.test1}}" + - name: Remove databases in database instance + nutanix.ncp.ntnx_ndb_linked_databases: + state: absent + db_instance_uuid: "{{ db_uuid }}" + database_uuid: "{{ linked_databases.test1 }}" register: result diff --git a/examples/ndb/create_clone.yml b/examples/ndb/create_clone.yml index 468058423..5fd9f98e4 100644 --- a/examples/ndb/create_clone.yml +++ b/examples/ndb/create_clone.yml @@ -2,8 +2,6 @@ - name: Create clone hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,7 +10,8 @@ validate_certs: false tasks: - - set_fact: + - name: Set vars + ansible.builtin.set_fact: clone_db: name: db_params_profile: @@ -32,21 +31,21 @@ snapshot: uuid: - - name: create clone using snapshot - ntnx_ndb_database_clones: - name: "{{clone_db.name}}" - desc: "ansible-created-clone" + - name: Create clone using snapshot + nutanix.ncp.ntnx_ndb_database_clones: + name: "{{ clone_db.name }}" + desc: ansible-created-clone db_params_profile: - name: "{{db_params_profile.name}}" + name: "{{ db_params_profile.name }}" db_vm: create_new_server: name: "{{ vm.name }}" - desc: "vm for db server" + desc: vm for db server password: "{{ vm.password }}" cluster: - name: "{{cluster.name}}" + name: "{{ cluster.name }}" network_profile: name: "{{ network_profile.name }}" compute_profile: @@ -54,43 +53,44 @@ pub_ssh_key: "{{ public_ssh_key }}" postgres: - db_password: "{{vm.password}}" + db_password: "{{ vm.password }}" time_machine: - name: "{{time_machine.name}}" - snapshot_uuid: "{{snapshot.uuid}}" + name: "{{ time_machine.name }}" + snapshot_uuid: "{{ snapshot.uuid }}" removal_schedule: days: 2 - timezone: "Asia/Calcutta" + timezone: Asia/Calcutta remind_before_in_days: 1 - delete_database: True + delete_database: true refresh_schedule: days: 2 time: "12:00:00" - timezone: "Asia/Calcutta" + timezone: Asia/Calcutta register: output - - debug: - msg: "{{output}}" + - name: Print output + ansible.builtin.debug: + msg: "{{ output }}" - - name: create clone using point in time - ntnx_ndb_database_clones: - name: "{{clone_db.name}}" - desc: "ansible-created-clone" + - name: Create clone using point in time + nutanix.ncp.ntnx_ndb_database_clones: + name: "{{ clone_db.name }}" + desc: ansible-created-clone db_params_profile: - name: "{{db_params_profile.name}}" + name: "{{ db_params_profile.name }}" db_vm: create_new_server: name: "{{ vm.name }}" - desc: "vm for db server" + desc: vm for db server password: "{{ vm.password }}" cluster: - name: "{{cluster.name}}" + name: "{{ cluster.name }}" network_profile: name: "{{ network_profile.name }}" compute_profile: @@ -98,24 +98,25 @@ pub_ssh_key: "{{ public_ssh_key }}" postgres: - db_password: "{{vm.password}}" + db_password: "{{ vm.password }}" time_machine: - name: "{{time_machine.name}}" + name: "{{ time_machine.name }}" pitr_timestamp: "2023-02-28 12:00:00" - timestamp: "Asia/Calcutta" + timestamp: Asia/Calcutta removal_schedule: days: 2 - timezone: "Asia/Calcutta" + timezone: Asia/Calcutta remind_before_in_days: 1 - delete_database: True + delete_database: true refresh_schedule: days: 2 time: "12:00:00" - timezone: "Asia/Calcutta" + timezone: Asia/Calcutta register: output - - debug: - msg: "{{output}}" + - name: Print output + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/ndb/create_stretched_vlan.yml b/examples/ndb/create_stretched_vlan.yml index 29e6c9e20..54b19f85e 100644 --- a/examples/ndb/create_stretched_vlan.yml +++ b/examples/ndb/create_stretched_vlan.yml @@ -2,8 +2,6 @@ - name: Create stretched vlan hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,15 +10,15 @@ validate_certs: false tasks: - - name: Create stretched vlan - ntnx_ndb_stretched_vlans: - name: "{{st_vlan.name}}" - desc: "{{st_vlan.desc}}" + nutanix.ncp.ntnx_ndb_stretched_vlans: + name: "{{ st_vlan.name }}" + desc: "{{ st_vlan.desc }}" vlans: - - "" - - "" + - + - register: output - - debug: - msg: "{{output}}" + - name: Print output + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/ndb/create_time_machine_cluster.yml b/examples/ndb/create_time_machine_cluster.yml index 95f23a22a..bf64731d9 100644 --- a/examples/ndb/create_time_machine_cluster.yml +++ b/examples/ndb/create_time_machine_cluster.yml @@ -2,8 +2,6 @@ - name: NDB time machine's cluster creation hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,16 +10,16 @@ validate_certs: false tasks: - - name: NDB time machine's cluster creation - ntnx_ndb_time_machine_clusters: - time_machine_uuid: "{{time_machine.uuid}}" + nutanix.ncp.ntnx_ndb_time_machine_clusters: + time_machine_uuid: "{{ time_machine.uuid }}" cluster: - name: "{{cluster.name}}" + name: "{{ cluster.name }}" sla: - name: "{{sla.name}}" - type: "{{type}}" + name: "{{ sla.name }}" + type: "{{ type }}" register: output - - debug: - msg: "{{output}}" + - name: Print output + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/ndb/create_vlan.yml b/examples/ndb/create_vlan.yml index a77864d95..29207f24f 100644 --- a/examples/ndb/create_vlan.yml +++ b/examples/ndb/create_vlan.yml @@ -2,8 +2,6 @@ - name: Create Dhcp ndb vlan hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,33 +10,34 @@ validate_certs: false tasks: - - name: Create Dhcp ndb vlan - ntnx_ndb_vlans: - name: "{{ndb_vlan.name}}" + nutanix.ncp.ntnx_ndb_vlans: + name: "{{ ndb_vlan.name }}" vlan_type: DHCP cluster: - uuid: "{{cluster.uuid}}" + uuid: "{{ cluster.uuid }}" register: output - - debug: - msg: "{{output}}" + - name: Print output + ansible.builtin.debug: + msg: "{{ output }}" - name: Create Static ndb vlan - ntnx_ndb_vlans: - name: "{{ndb_vlan.name}}" + nutanix.ncp.ntnx_ndb_vlans: + name: "{{ ndb_vlan.name }}" vlan_type: Static - gateway: "{{ndb_vlan.gateway}}" - subnet_mask: "{{ndb_vlan.subnet_mask}}" + gateway: "{{ ndb_vlan.gateway }}" + subnet_mask: "{{ ndb_vlan.subnet_mask }}" ip_pools: - 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}}" 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}}" + primary_dns: "{{ ndb_vlan.primary_dns }}" + secondary_dns: "{{ ndb_vlan.secondary_dns }}" + dns_domain: "{{ ndb_vlan.dns_domain }}" register: output - - debug: - msg: "{{output}}" + - name: Print output + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/ndb/db_server_vms.yml b/examples/ndb/db_server_vms.yml index 7ae35cc47..faa0f288a 100644 --- a/examples/ndb/db_server_vms.yml +++ b/examples/ndb/db_server_vms.yml @@ -2,8 +2,6 @@ - name: NDB db server vms hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,44 +10,43 @@ validate_certs: false tasks: - - - name: create spec for db server vm using time machine - check_mode: yes - ntnx_ndb_db_server_vms: - wait: True - name: "ansible-created-vm1-from-time-machine" - desc: "ansible-created-vm1-from-time-machine-time-machine" + - name: Create spec for db server vm using time machine + check_mode: true + nutanix.ncp.ntnx_ndb_db_server_vms: + wait: true + name: ansible-created-vm1-from-time-machine + desc: ansible-created-vm1-from-time-machine-time-machine time_machine: - uuid: "test_uuid" - snapshot_uuid: "test_snapshot_uuid" + uuid: test_uuid + snapshot_uuid: test_snapshot_uuid compute_profile: - uuid: "test_compute_uuid" + uuid: test_compute_uuid network_profile: - uuid: "test_network_uuid" + uuid: test_network_uuid cluster: - uuid: "test_cluster_uuid" - password: "test_password" - pub_ssh_key: "test_public_key" - database_type: "postgres_database" + uuid: test_cluster_uuid + password: test_password + pub_ssh_key: test_public_key + database_type: postgres_database automated_patching: maintenance_window: - uuid: "test_window_uuid" + uuid: test_window_uuid tasks: - - type: "OS_PATCHING" - pre_task_cmd: "ls" - post_task_cmd: "ls -a" - - type: "DB_PATCHING" - pre_task_cmd: "ls -l" - post_task_cmd: "ls -F" + - type: OS_PATCHING + pre_task_cmd: ls + post_task_cmd: ls -a + - type: DB_PATCHING + pre_task_cmd: ls -l + post_task_cmd: ls -F register: check_mode_result - - name: create spec for db server vm using software profile and names of profile - check_mode: yes - ntnx_ndb_db_server_vms: - wait: True + - name: Create spec for db server vm using software profile and names of profile + check_mode: true + nutanix.ncp.ntnx_ndb_db_server_vms: + wait: true name: "{{ vm1_name }}" - desc: "ansible-created-vm1-desc" + desc: ansible-created-vm1-desc software_profile: name: "{{ software_profile.name }}" compute_profile: @@ -60,25 +57,25 @@ name: "{{ cluster.cluster1.name }}" password: "{{ vm_password }}" pub_ssh_key: "{{ public_ssh_key }}" - time_zone: "UTC" - database_type: "postgres_database" + time_zone: UTC + database_type: postgres_database automated_patching: maintenance_window: name: "{{ maintenance.window_name }}" tasks: - - type: "OS_PATCHING" - pre_task_cmd: "ls" - post_task_cmd: "ls -a" - - type: "DB_PATCHING" - pre_task_cmd: "ls -l" - post_task_cmd: "ls -F" + - type: OS_PATCHING + pre_task_cmd: ls + post_task_cmd: ls -a + - type: DB_PATCHING + pre_task_cmd: ls -l + post_task_cmd: ls -F register: result - - name: create db server vm using software profile - ntnx_ndb_db_server_vms: - wait: True + - name: Create db server vm using software profile + nutanix.ncp.ntnx_ndb_db_server_vms: + wait: true name: "{{ vm1_name }}" - desc: "ansible-created-vm1-desc" + desc: ansible-created-vm1-desc software_profile: name: "{{ software_profile.name }}" compute_profile: @@ -89,232 +86,226 @@ name: "{{ cluster.cluster1.name }}" password: "{{ vm_password }}" pub_ssh_key: "{{ public_ssh_key }}" - time_zone: "UTC" - database_type: "postgres_database" + time_zone: UTC + database_type: postgres_database automated_patching: maintenance_window: name: "{{ maintenance.window_name }}" tasks: - - type: "OS_PATCHING" - pre_task_cmd: "ls" - post_task_cmd: "ls -a" - - type: "DB_PATCHING" - pre_task_cmd: "ls -l" - post_task_cmd: "ls -F" + - type: OS_PATCHING + pre_task_cmd: ls + post_task_cmd: ls -a + - type: DB_PATCHING + pre_task_cmd: ls -l + post_task_cmd: ls -F register: result - - - name: update db server vm name, desc, credentials, tags - ntnx_ndb_db_server_vms: - 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 + - name: Update db server vm name, desc, credentials, tags + nutanix.ncp.ntnx_ndb_db_server_vms: + 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 update_credentials: - - username: "{{vm_username}}" - password: "{{vm_password}}" + - username: "{{ vm_username }}" + password: "{{ vm_password }}" tags: ansible-db-server-vms: ansible-updated register: result - - name: create spec for update db server vm credentials - check_mode: yes - ntnx_ndb_db_server_vms: - wait: True - uuid: "{{db_server_uuid}}" + - name: Create spec for update db server vm credentials + check_mode: true + nutanix.ncp.ntnx_ndb_db_server_vms: + wait: true + uuid: "{{ db_server_uuid }}" update_credentials: - - username: "user" - password: "pass" + - username: user + password: pass register: result - - name: List NDB db_servers - ntnx_ndb_db_servers_info: + nutanix.ncp.ntnx_ndb_db_servers_info: register: db_servers - - - name: get NDB db_servers using it's name - ntnx_ndb_db_servers_info: + - name: Get NDB db_servers using it's name + nutanix.ncp.ntnx_ndb_db_servers_info: filters: load_metrics: true - load_databases: True + load_databases: true value_type: name - value: "{{db_servers.response[0].name}}" + value: "{{ db_servers.response[0].name }}" register: result - - name: get NDB db_servers using it's ip - ntnx_ndb_db_servers_info: + - name: Get NDB db_servers using it's ip + nutanix.ncp.ntnx_ndb_db_servers_info: filters: value_type: ip - value: "{{db_servers.response[0].ipAddresses[0]}}" + value: "{{ db_servers.response[0].ipAddresses[0] }}" register: result - - name: get NDB db_servers using it's name - ntnx_ndb_db_servers_info: - name: "{{db_servers.response[0].name}}" + - name: Get NDB db_servers using it's name + nutanix.ncp.ntnx_ndb_db_servers_info: + name: "{{ db_servers.response[0].name }}" register: result - - name: get NDB db_servers using it's id - ntnx_ndb_db_servers_info: - uuid: "{{db_servers.response[0].id}}" + - name: Get NDB db_servers using it's id + nutanix.ncp.ntnx_ndb_db_servers_info: + uuid: "{{ db_servers.response[0].id }}" register: result - - name: get NDB db_servers using ip - ntnx_ndb_db_servers_info: - server_ip: "{{db_servers.response[0].ipAddresses[0]}}" + - name: Get NDB db_servers using ip + nutanix.ncp.ntnx_ndb_db_servers_info: + server_ip: "{{ db_servers.response[0].ipAddresses[0] }}" register: result ################################### maintenance tasks update tasks ############################# - - name: create spec for adding maintenance window tasks to db server vm - check_mode: yes - ntnx_ndb_maintenance_tasks: + - name: Create spec for adding maintenance window tasks to db server vm + check_mode: true + nutanix.ncp.ntnx_ndb_maintenance_tasks: db_server_vms: - - name: "{{vm1_name_updated}}" - - uuid: "test_vm_1" + - name: "{{ vm1_name_updated }}" + - uuid: test_vm_1 db_server_clusters: - - uuid: "test_cluter_1" - - uuid: "test_cluter_2" + - uuid: test_cluter_1 + - uuid: test_cluter_2 maintenance_window: - name: "{{maintenance.window_name}}" + name: "{{ maintenance.window_name }}" tasks: - - type: "OS_PATCHING" - pre_task_cmd: "ls -a" - post_task_cmd: "ls" - - type: "DB_PATCHING" - pre_task_cmd: "ls -a" - post_task_cmd: "ls" + - type: OS_PATCHING + pre_task_cmd: ls -a + post_task_cmd: ls + - type: DB_PATCHING + pre_task_cmd: ls -a + post_task_cmd: ls register: result - - name: create spec for removing maintenance window tasks from above created vm - check_mode: yes - ntnx_ndb_maintenance_tasks: + - name: Create spec for removing maintenance window tasks from above created vm + check_mode: true + nutanix.ncp.ntnx_ndb_maintenance_tasks: db_server_vms: - - uuid: "{{db_server_uuid}}" + - uuid: "{{ db_server_uuid }}" maintenance_window: - uuid: "{{maintenance.window_uuid}}" + uuid: "{{ maintenance.window_uuid }}" tasks: [] register: result - - - name: remove maintenance tasks - ntnx_ndb_maintenance_tasks: + - name: Remove maintenance tasks + nutanix.ncp.ntnx_ndb_maintenance_tasks: db_server_vms: - - uuid: "{{db_server_uuid}}" + - uuid: "{{ db_server_uuid }}" maintenance_window: - uuid: "{{maintenance.window_uuid}}" + uuid: "{{ maintenance.window_uuid }}" tasks: [] register: result - name: Add maitenance window task for vm - ntnx_ndb_maintenance_tasks: + nutanix.ncp.ntnx_ndb_maintenance_tasks: db_server_vms: - - name: "{{vm1_name_updated}}" + - name: "{{ vm1_name_updated }}" maintenance_window: - name: "{{maintenance.window_name}}" + name: "{{ maintenance.window_name }}" tasks: - - type: "OS_PATCHING" - pre_task_cmd: "ls -a" - post_task_cmd: "ls" - - type: "DB_PATCHING" - pre_task_cmd: "ls -a" - post_task_cmd: "ls" + - type: OS_PATCHING + pre_task_cmd: ls -a + post_task_cmd: ls + - type: DB_PATCHING + pre_task_cmd: ls -a + post_task_cmd: ls register: result ################################### DB server VM unregistration tasks ############################# - - name: generate check mode spec for unregister with default values - check_mode: yes - ntnx_ndb_db_server_vms: - state: "absent" - wait: True - uuid: "{{db_server_uuid}}" + - name: Generate check mode spec for unregister with default values + check_mode: true + nutanix.ncp.ntnx_ndb_db_server_vms: + state: absent + wait: true + uuid: "{{ db_server_uuid }}" register: result - - name: genereate check mode spec for delete vm with vgs and snapshots - check_mode: yes - ntnx_ndb_db_server_vms: - state: "absent" - uuid: "{{db_server_uuid}}" - delete_from_cluster: True - delete_vgs: True - delete_vm_snapshots: True + - name: Genereate check mode spec for delete vm with vgs and snapshots + check_mode: true + nutanix.ncp.ntnx_ndb_db_server_vms: + state: absent + uuid: "{{ db_server_uuid }}" + delete_from_cluster: true + delete_vgs: true + delete_vm_snapshots: true register: result - - name: unregister vm - ntnx_ndb_db_server_vms: - state: "absent" - wait: True - uuid: "{{db_server_uuid}}" - delete_from_cluster: False - soft_remove: True - delete_vgs: True - delete_vm_snapshots: True + - name: Unregister vm + nutanix.ncp.ntnx_ndb_db_server_vms: + state: absent + wait: true + uuid: "{{ db_server_uuid }}" + delete_from_cluster: false + soft_remove: true + delete_vgs: true + delete_vm_snapshots: true register: result ################################### DB server VM Registration tasks ############################# - - - name: generate spec for registeration of the previous unregistered vm using check mode - check_mode: yes - ntnx_ndb_register_db_server_vm: - ip: "{{vm_ip}}" - desc: "register-vm-desc" + - name: Generate spec for registeration of the previous unregistered vm using check mode + check_mode: true + nutanix.ncp.ntnx_ndb_register_db_server_vm: + ip: "{{ vm_ip }}" + desc: register-vm-desc reset_desc_in_ntnx_cluster: true cluster: - name: "{{cluster.cluster1.name}}" + name: "{{ cluster.cluster1.name }}" postgres: - software_path: "{{postgres.software_home}}" - private_ssh_key: "check-key" - username: "{{vm_username}}" + software_path: "{{ postgres.software_home }}" + private_ssh_key: check-key + username: "{{ vm_username }}" automated_patching: maintenance_window: name: "{{ maintenance.window_name }}" tasks: - - type: "OS_PATCHING" - pre_task_cmd: "ls" - post_task_cmd: "ls -a" - - type: "DB_PATCHING" - pre_task_cmd: "ls -l" - post_task_cmd: "ls -F" - working_directory: "/check" + - type: OS_PATCHING + pre_task_cmd: ls + post_task_cmd: ls -a + - type: DB_PATCHING + pre_task_cmd: ls -l + post_task_cmd: ls -F + working_directory: /check register: result - - name: register the previous unregistered vm - ntnx_ndb_register_db_server_vm: - ip: "{{vm_ip}}" - desc: "register-vm-desc" + - name: Register the previous unregistered vm + nutanix.ncp.ntnx_ndb_register_db_server_vm: + ip: "{{ vm_ip }}" + desc: register-vm-desc cluster: - name: "{{cluster.cluster1.name}}" + name: "{{ cluster.cluster1.name }}" postgres: listener_port: 5432 - software_path: "{{postgres.software_home}}" - username: "{{vm_username}}" - password: "{{vm_password}}" + software_path: "{{ postgres.software_home }}" + username: "{{ vm_username }}" + password: "{{ vm_password }}" automated_patching: maintenance_window: name: "{{ maintenance.window_name }}" tasks: - - type: "OS_PATCHING" - pre_task_cmd: "ls" - post_task_cmd: "ls -a" - - type: "DB_PATCHING" - pre_task_cmd: "ls -l" - post_task_cmd: "ls -F" + - type: OS_PATCHING + pre_task_cmd: ls + post_task_cmd: ls -a + - type: DB_PATCHING + pre_task_cmd: ls -l + post_task_cmd: ls -F register: result ################################### DB server VM Delete tasks ############################# - - - name: unregister db server vm - ntnx_ndb_db_server_vms: - state: "absent" - wait: True - uuid: "{{db_server_uuid}}" + - name: Unregister db server vm + nutanix.ncp.ntnx_ndb_db_server_vms: + state: absent + 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 diff --git a/examples/ndb/provision_database_on_registered_db_server.yml b/examples/ndb/provision_database_on_registered_db_server.yml index ca196cc88..110d010f1 100644 --- a/examples/ndb/provision_database_on_registered_db_server.yml +++ b/examples/ndb/provision_database_on_registered_db_server.yml @@ -2,8 +2,6 @@ - name: Single instance postgres database creation on registered db server hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,9 +10,8 @@ validate_certs: false tasks: - - name: Create single instance postgres database on registered db server vm - ntnx_ndb_databases: + nutanix.ncp.ntnx_ndb_databases: name: POSTGRES_DATABASE_ANSIBLE @@ -46,5 +43,6 @@ register: output - - debug: - msg: "{{output}}" + - name: Print output + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/ndb/provision_postgres_ha_instance_with_ips.yml b/examples/ndb/provision_postgres_ha_instance_with_ips.yml index 00e95fc68..e9c3621b8 100644 --- a/examples/ndb/provision_postgres_ha_instance_with_ips.yml +++ b/examples/ndb/provision_postgres_ha_instance_with_ips.yml @@ -4,8 +4,6 @@ - name: Create stretched vlan hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -14,64 +12,64 @@ validate_certs: false tasks: - - name: create HA instance postgres database with static IP assignments to vms and cluster IP - ntnx_ndb_databases: + - name: Create HA instance postgres database with static IP assignments to vms and cluster IP + nutanix.ncp.ntnx_ndb_databases: wait: true timeout: 5400 - name: "" - desc: "ansible-created-db-desc" + name: + desc: ansible-created-db-desc db_params_profile: - name: "" + name: db_server_cluster: new_cluster: - name: "" + name: cluster: - name: "" + name: ips: - cluster: - name: "" - ip: "" + name: + ip: software_profile: - name: "" + name: network_profile: - name: "" + name: compute_profile: - name: "" - password: "" - pub_ssh_key: "" + name: + password: + pub_ssh_key: vms: - - name: "vm-1" - node_type: "database" - role: "Primary" - ip: "" + - name: vm-1 + node_type: database + role: Primary + ip: - - name: "vm-2" - node_type: "database" - role: "Secondary" - ip: "" + - name: vm-2 + node_type: database + role: Secondary + ip: - - name: "vm-3" - node_type: "database" - role: "Secondary" - ip: "" + - name: vm-3 + node_type: database + role: Secondary + ip: - - name: "vm-ha-proxy1" - node_type: "haproxy" - ip: "" + - name: vm-ha-proxy1 + node_type: haproxy + ip: - - name: "vm-ha-proxy2" - node_type: "haproxy" - ip: "" + - name: vm-ha-proxy2 + node_type: haproxy + ip: postgres: - type: "ha" + type: ha db_name: testAnsible - db_password: "" + db_password: db_size: 200 - patroni_cluster_name: "" + patroni_cluster_name: ha_proxy: provision_virtual_ip: true @@ -79,7 +77,7 @@ name: TM2 desc: TM-desc sla: - name: "" + name: schedule: daily: "11:10:02" weekly: WEDNESDAY @@ -88,22 +86,23 @@ log_catchup: 30 snapshots_per_day: 2 clusters: - - name: "" + - name: tags: - ansible-databases: "ha-instance-dbs" + ansible-databases: ha-instance-dbs automated_patching: maintenance_window: - name: "" + name: tasks: - - type: "OS_PATCHING" - pre_task_cmd: "ls" - post_task_cmd: "ls -a" - - type: "DB_PATCHING" - pre_task_cmd: "ls -l" - post_task_cmd: "ls -F" + - type: OS_PATCHING + pre_task_cmd: ls + post_task_cmd: ls -a + - type: DB_PATCHING + pre_task_cmd: ls -l + post_task_cmd: ls -F register: result - - debug: + - name: Print output + ansible.builtin.debug: msg: "{{ result }}" diff --git a/examples/ndb/refresh_clone.yml b/examples/ndb/refresh_clone.yml index 3806fb9d9..a420d28f4 100644 --- a/examples/ndb/refresh_clone.yml +++ b/examples/ndb/refresh_clone.yml @@ -2,8 +2,6 @@ - name: Create Refresh clone hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,29 +10,31 @@ validate_certs: false tasks: - - set_fact: + - name: Set vars + ansible.builtin.set_fact: clone_db: uuid: snapshot: uuid: - - name: create spec for refresh clone to a pitr timestamp - check_mode: yes - ntnx_ndb_database_clone_refresh: - uuid: "{{clone_db.uuid}}" + - name: Create spec for refresh clone to a pitr timestamp + check_mode: true + nutanix.ncp.ntnx_ndb_database_clone_refresh: + uuid: "{{ clone_db.uuid }}" pitr_timestamp: "2023-02-04 07:29:36" - timezone: "UTC" + timezone: UTC register: output + - name: Print output + ansible.builtin.debug: + msg: "{{ output }}" - - debug: - msg: "{{output}}" - - - name: refresh db clone - ntnx_ndb_database_clone_refresh: - uuid: "{{clone_db.uuid}}" - snapshot_uuid: "{{snapshot.uuid}}" + - name: Refresh db clone + nutanix.ncp.ntnx_ndb_database_clone_refresh: + uuid: "{{ clone_db.uuid }}" + snapshot_uuid: "{{ snapshot.uuid }}" register: output - - debug: - msg: "{{output}}" + - name: Print output + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/ndb/registr_cluster.yml b/examples/ndb/registr_cluster.yml index 80108160d..c425abba4 100644 --- a/examples/ndb/registr_cluster.yml +++ b/examples/ndb/registr_cluster.yml @@ -2,8 +2,6 @@ - name: NDB cluster creation hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,34 +10,34 @@ validate_certs: false tasks: - - name: NDB cluster creation - ntnx_ndb_clusters: - name: "{{cluster.name}}" - desc: "{{cluster.desc}}" - name_prefix: "{{cluster.name_prefix}}" - cluster_ip: "{{cluster.cluster_ip}}" + nutanix.ncp.ntnx_ndb_clusters: + name: "{{ cluster.name }}" + desc: "{{ cluster.desc }}" + name_prefix: "{{ cluster.name_prefix }}" + cluster_ip: "{{ cluster.cluster_ip }}" cluster_credentials: - username: "{{cluster_credentials.username}}" - password: "{{cluster_credentials.password}}" + username: "{{ cluster_credentials.username }}" + password: "{{ cluster_credentials.password }}" agent_network: dns_servers: - - "{{agent_network.dns_servers[0]}}" - - "{{agent_network.dns_servers[1]}}" + - "{{ agent_network.dns_servers[0] }}" + - "{{ agent_network.dns_servers[1] }}" ntp_servers: - - "{{agent_network.ntp_servers[0]}}" - - "{{agent_network.ntp_servers[1]}}" - - "{{agent_network.ntp_servers[2]}}" - - "{{agent_network.ntp_servers[3]}}" + - "{{ agent_network.ntp_servers[0] }}" + - "{{ agent_network.ntp_servers[1] }}" + - "{{ agent_network.ntp_servers[2] }}" + - "{{ agent_network.ntp_servers[3] }}" vlan_access: prism_vlan: - vlan_name: "{{prism_vlan.vlan_name}}" - vlan_type: "{{prism_vlan.vlan_type}}" - static_ip: "{{prism_vlan.static_ip}}" - gateway: "{{prism_vlan.gateway}}" - subnet_mask: "{{prism_vlan.subnet_mask}}" - storage_container: "{{storage_container.name}}" + vlan_name: "{{ prism_vlan.vlan_name }}" + vlan_type: "{{ prism_vlan.vlan_type }}" + static_ip: "{{ prism_vlan.static_ip }}" + gateway: "{{ prism_vlan.gateway }}" + subnet_mask: "{{ prism_vlan.subnet_mask }}" + storage_container: "{{ storage_container.name }}" register: output - - debug: - msg: "{{output}}" + - name: Print output + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/ndb/single_instance_postgress_database.yml b/examples/ndb/single_instance_postgress_database.yml index 8f8f83339..62f8e5351 100644 --- a/examples/ndb/single_instance_postgress_database.yml +++ b/examples/ndb/single_instance_postgress_database.yml @@ -2,8 +2,6 @@ - name: Single instance postgres database creation with new db server VM hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,9 +10,8 @@ validate_certs: false tasks: - - name: Create single instance postgres database - ntnx_ndb_databases: + nutanix.ncp.ntnx_ndb_databases: name: POSTGRES_DATABASE_ANSIBLE @@ -33,7 +30,7 @@ name: DEFAULT_OOB_POSTGRESQL_NETWORK compute_profile: name: DEFAULT_OOB_SMALL_COMPUTE - pub_ssh_key: "" + pub_ssh_key: postgres: listener_port: "5432" @@ -56,5 +53,6 @@ register: output - - debug: - msg: "{{output}}" + - name: Print output + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/ndb/soft_delete_database_instance.yml b/examples/ndb/soft_delete_database_instance.yml index 07b15fab1..0ba663012 100644 --- a/examples/ndb/soft_delete_database_instance.yml +++ b/examples/ndb/soft_delete_database_instance.yml @@ -2,8 +2,6 @@ - name: Soft delete single instance database and time machine associated hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,14 +10,14 @@ validate_certs: false tasks: - - name: Soft delete single instance database and time machine associated - ntnx_ndb_databases: - state: "absent" + nutanix.ncp.ntnx_ndb_databases: + state: absent db_uuid: c0a4433a-49f2-40f3-ae52-d88788d2824b soft_delete: true delete_time_machine: true register: output - - debug: - msg: "{{output}}" + - name: Print output + ansible.builtin.debug: + msg: "{{ output }}" diff --git a/examples/ndb/software_profiles.yml b/examples/ndb/software_profiles.yml index fa22d873c..3af55b2b2 100644 --- a/examples/ndb/software_profiles.yml +++ b/examples/ndb/software_profiles.yml @@ -10,8 +10,6 @@ - name: Create software profiles hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -20,168 +18,168 @@ validate_certs: false tasks: - - name: create software profile create spec - check_mode: yes - ntnx_ndb_profiles: - name: "{{profile1_name}}" - desc: "{{profile1_name}}-desc" - type: "software" - database_type: "postgres" + - name: Create software profile create spec + check_mode: true + nutanix.ncp.ntnx_ndb_profiles: + name: "{{ profile1_name }}" + desc: "{{ profile1_name }}-desc" + type: software + database_type: postgres software: - topology: "cluster" - name: "v1.0" - desc: "v1.0-desc" + topology: cluster + name: v1.0 + desc: v1.0-desc notes: - os: "os_notes" - db_software: "db_notes" + os: os_notes + db_software: db_notes db_server_vm: - name: "{{db_server_vm.name}}" + name: "{{ db_server_vm.name }}" clusters: - - name: "" - - uuid: "" + - name: + - uuid: register: result - - name: create software profile with base version and cluster instance topology. Replicate to multiple clusters - ntnx_ndb_profiles: - name: "{{profile1_name}}-replicated" - desc: "{{profile1_name}}-desc-replicated" - type: "software" - database_type: "postgres" + - name: Create software profile with base version and cluster instance topology. Replicate to multiple clusters + nutanix.ncp.ntnx_ndb_profiles: + name: "{{ profile1_name }}-replicated" + desc: "{{ profile1_name }}-desc-replicated" + type: software + database_type: postgres software: - topology: "cluster" - name: "v1.0" - desc: "v1.0-desc" + topology: cluster + name: v1.0 + desc: v1.0-desc notes: - os: "os_notes" - db_software: "db_notes" + os: os_notes + db_software: db_notes db_server_vm: - uuid: "{{db_server_vm.uuid}}" + uuid: "{{ db_server_vm.uuid }}" clusters: - - name: "" - - uuid: "" + - name: + - uuid: register: result - - name: create software profile with base version and single instance topology - ntnx_ndb_profiles: - name: "{{profile2_name}}" - desc: "{{profile2_name}}-desc" - type: "software" - database_type: "postgres" + - name: Create software profile with base version and single instance topology + nutanix.ncp.ntnx_ndb_profiles: + name: "{{ profile2_name }}" + desc: "{{ profile2_name }}-desc" + type: software + database_type: postgres software: - topology: "single" - name: "v1.0" - desc: "v1.0-desc" + topology: single + name: v1.0 + desc: v1.0-desc notes: - os: "os_notes" - db_software: "db_notes" + os: os_notes + db_software: db_notes db_server_vm: - uuid: "{{db_server_vm.uuid}}" + uuid: "{{ db_server_vm.uuid }}" clusters: - - name: "" + - name: register: result - - name: update software profile - ntnx_ndb_profiles: - profile_uuid: "{{profile_uuid}}" - name: "{{profile1_name}}-updated1" - desc: "{{profile1_name}}-desc-updated" + - name: Update software profile + nutanix.ncp.ntnx_ndb_profiles: + profile_uuid: "{{ profile_uuid }}" + name: "{{ profile1_name }}-updated1" + desc: "{{ profile1_name }}-desc-updated" register: result - - name: create software profile version spec - check_mode: yes - ntnx_ndb_profiles: - profile_uuid: "{{profile_uuid}}" - database_type: "postgres" + - name: Create software profile version spec + check_mode: true + nutanix.ncp.ntnx_ndb_profiles: + profile_uuid: "{{ profile_uuid }}" + database_type: postgres software: - name: "v2.0" - desc: "v2.0-desc" + name: v2.0 + desc: v2.0-desc notes: - os: "os_notes for v2" - db_software: "db_notes for v2" + os: os_notes for v2 + db_software: db_notes for v2 db_server_vm: - name: "{{db_server_vm.name}}" + name: "{{ db_server_vm.name }}" register: result - - name: create software profile version - ntnx_ndb_profiles: - profile_uuid: "{{profile_uuid}}" - database_type: "postgres" + - name: Create software profile version + nutanix.ncp.ntnx_ndb_profiles: + profile_uuid: "{{ profile_uuid }}" + database_type: postgres software: - name: "v2.0" - desc: "v2.0-desc" + name: v2.0 + desc: v2.0-desc notes: - os: "os_notes for v2" - db_software: "db_notes for v2" + os: os_notes for v2 + db_software: db_notes for v2 db_server_vm: - uuid: "{{db_server_vm.uuid}}" + uuid: "{{ db_server_vm.uuid }}" register: result - - name: create spec for update software profile version - check_mode: yes - ntnx_ndb_profiles: - profile_uuid: "{{profile_uuid}}" - database_type: "postgres" + - name: Create spec for update software profile version + check_mode: true + nutanix.ncp.ntnx_ndb_profiles: + profile_uuid: "{{ profile_uuid }}" + database_type: postgres software: - version_uuid: "{{result.version_uuid}}" - name: "v2.0-updated" - desc: "v2.0-desc-updated" + version_uuid: "{{ result.version_uuid }}" + name: v2.0-updated + desc: v2.0-desc-updated register: result - - name: update software profile version - ntnx_ndb_profiles: - profile_uuid: "{{profile_uuid}}" - database_type: "postgres" + - name: Update software profile version + nutanix.ncp.ntnx_ndb_profiles: + profile_uuid: "{{ profile_uuid }}" + database_type: postgres software: - version_uuid: "{{result.version_uuid}}" - name: "v2.0-updated" - desc: "v2.0-desc-updated" + version_uuid: "{{ result.version_uuid }}" + name: v2.0-updated + desc: v2.0-desc-updated register: result - - name: publish software profile version - ntnx_ndb_profiles: - profile_uuid: "{{profile_uuid}}" + - name: Publish software profile version + nutanix.ncp.ntnx_ndb_profiles: + profile_uuid: "{{ profile_uuid }}" software: - version_uuid: "{{version_uuid}}" - publish: True + version_uuid: "{{ version_uuid }}" + publish: true register: result - - name: unpublish software profile version - ntnx_ndb_profiles: - profile_uuid: "{{profile_uuid}}" + - name: Unpublish software profile version + nutanix.ncp.ntnx_ndb_profiles: + profile_uuid: "{{ profile_uuid }}" software: - version_uuid: "{{version_uuid}}" + version_uuid: "{{ version_uuid }}" publish: false register: result - - name: deprecate software profile version - ntnx_ndb_profiles: - profile_uuid: "{{profile_uuid}}" + - name: Deprecate software profile version + nutanix.ncp.ntnx_ndb_profiles: + profile_uuid: "{{ profile_uuid }}" software: - version_uuid: "{{version_uuid}}" - deprecate: True + version_uuid: "{{ version_uuid }}" + deprecate: true register: result - - name: delete software profile version - ntnx_ndb_profiles: - profile_uuid: "{{profile_uuid}}" + - name: Delete software profile version + nutanix.ncp.ntnx_ndb_profiles: + profile_uuid: "{{ profile_uuid }}" software: - version_uuid: "{{version_uuid}}" - state: "absent" + version_uuid: "{{ version_uuid }}" + state: absent register: result - - name: replicate software profile - ntnx_ndb_profiles: - profile_uuid: "{{profile_uuid}}" + - name: Replicate software profile + nutanix.ncp.ntnx_ndb_profiles: + profile_uuid: "{{ profile_uuid }}" clusters: - - name: "{{cluster.cluster2.name}}" + - name: "{{ cluster.cluster2.name }}" register: result - - name: delete software profile - ntnx_ndb_profiles: - profile_uuid: "{{profile_uuid}}" - state: "absent" + - name: Delete software profile + nutanix.ncp.ntnx_ndb_profiles: + profile_uuid: "{{ profile_uuid }}" + state: absent register: result diff --git a/examples/pbr.yml b/examples/pbr.yml index 3e36f8097..eca3ac302 100644 --- a/examples/pbr.yml +++ b/examples/pbr.yml @@ -2,8 +2,6 @@ - name: PBR playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,28 +10,28 @@ validate_certs: false tasks: - name: Setting Variables - set_fact: + ansible.builtin.set_fact: cluster_name: "" cluster_uuid: "" priority: "" vpc_uuid: "" - - name: create PBR with vpc uuid with any source or destination or protocol with deny action - ntnx_pbrs: - state: present - priority: "{{ priority }}" - vpc: - uuid: "{{ vpc_uuid }}" - source: - any: True - destination: - any: True - action: - deny: True - protocol: - any: True + - name: Create PBR with vpc uuid with any source or destination or protocol with deny action + nutanix.ncp.ntnx_pbrs: + state: present + priority: "{{ priority }}" + vpc: + uuid: "{{ vpc_uuid }}" + source: + any: true + destination: + any: true + action: + deny: true + protocol: + any: true register: result - name: Delete pbrs - ntnx_pbrs: + nutanix.ncp.ntnx_pbrs: state: absent pbr_uuid: "{{ result.pbr_uuid }}" diff --git a/examples/pbr_info.yml b/examples/pbr_info.yml index d59512893..ae712a1ad 100644 --- a/examples/pbr_info.yml +++ b/examples/pbr_info.yml @@ -2,8 +2,6 @@ - name: PBR_Info playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,17 +10,16 @@ validate_certs: false tasks: - - name: List pbrs using length and offset - ntnx_pbrs_info: + nutanix.ncp.ntnx_pbrs_info: length: 1 offset: 0 register: result - ignore_errors: True + ignore_errors: true - name: List pbrs using ascending priority sorting - ntnx_pbrs_info: + nutanix.ncp.ntnx_pbrs_info: sort_order: "ASCENDING" sort_attribute: "priority" register: result - ignore_errors: True + ignore_errors: true diff --git a/examples/permissions_info.yml b/examples/permissions_info.yml index 8b8bc3960..d84376659 100644 --- a/examples/permissions_info.yml +++ b/examples/permissions_info.yml @@ -2,31 +2,29 @@ - name: PC permissions hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: - nutanix_host: "" - nutanix_username: "" - nutanix_password: "" - validate_certs: false + nutanix_host: "" + nutanix_username: "" + nutanix_password: "" + validate_certs: false tasks: - - name: get all permissions - ntnx_permissions_info: - register: op1 + - name: Get all permissions + nutanix.ncp.ntnx_permissions_info: + register: op1 - - name: get permissions using filter - ntnx_permissions_info: - filter: - name: - register: op2 + - name: Get permissions using filter + nutanix.ncp.ntnx_permissions_info: + filter: + name: + register: op2 - - name: get permission using uuid - ntnx_permissions_info: - permission_uuid: - register: op3 + - name: Get permission using uuid + nutanix.ncp.ntnx_permissions_info: + permission_uuid: + register: op3 - - name: output - debug: - msg: "{{ op3 }}" + - name: Output + ansible.builtin.debug: + msg: "{{ op3 }}" diff --git a/examples/projects_crud.yml b/examples/projects_crud.yml index ff785196a..1a715edf5 100644 --- a/examples/projects_crud.yml +++ b/examples/projects_crud.yml @@ -1,8 +1,6 @@ -- name: projects crud playbook. Here we will create, update, read and delete the project. +- name: Projects crud playbook. Here we will create, update, read and delete the project. hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -11,7 +9,7 @@ validate_certs: false tasks: - name: Create a project - ntnx_projects: + nutanix.ncp.ntnx_projects: name: "test-ansible-project-1" desc: "desc-123" subnets: @@ -31,8 +29,8 @@ - name: register: project1 - - name: update project - ntnx_projects: + - name: Update project + nutanix.ncp.ntnx_projects: state: present project_uuid: "{{project1.project_uuid}}" name: "test-ansible-project-1" @@ -45,16 +43,16 @@ register: updated_project - name: Read the updated project - ntnx_projects_info: + nutanix.ncp.ntnx_projects_info: project_uuid: "{{updated_project.project_uuid}}" register: project_info - name: Print the project details - debug: + ansible.builtin.debug: msg: "{{project_info}}" - name: Delete the project - ntnx_projects: + nutanix.ncp.ntnx_projects: state: absent project_uuid: "{{updated_project.project_uuid}}" register: op diff --git a/examples/projects_with_role_mapping.yml b/examples/projects_with_role_mapping.yml index c66fb47d5..e289cc271 100644 --- a/examples/projects_with_role_mapping.yml +++ b/examples/projects_with_role_mapping.yml @@ -1,8 +1,6 @@ -- name: projects crud playbook. Here we will create, update, read and delete the project with role mappings. +- name: Projects crud playbook. Here we will create, update, read and delete the project with role mappings. hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -11,7 +9,7 @@ validate_certs: false tasks: - name: Create a project with role mappings - ntnx_projects: + nutanix.ncp.ntnx_projects: name: "test-ansible-project-1" desc: "desc-123" clusters: @@ -30,18 +28,18 @@ - name: accounts: - name: - collaboration: True + collaboration: true role_mappings: - user: uuid: role: name: "Project Admin" - user_group: - uuid: + uuid: role: name: "Developer" - user: - uuid: + uuid: role: name: "Consumer" - user: @@ -57,13 +55,13 @@ name: "Consumer" register: project1 - - name: update role mappings of project - ntnx_projects: + - name: Update role mappings of project + nutanix.ncp.ntnx_projects: state: present project_uuid: "{{project1.project_uuid}}" name: "test-ansible-project-1" desc: "test-ansible-project-1-updated" - collaboration: True + collaboration: true role_mappings: - user: uuid: @@ -76,17 +74,17 @@ register: updated_project - name: Read the updated project - ntnx_projects_info: + nutanix.ncp.ntnx_projects_info: project_uuid: "{{updated_project.project_uuid}}" include_acps: true register: project_info - name: Print the project details - debug: + ansible.builtin.debug: msg: "{{project_info}}" - name: Delete the project - ntnx_projects: + nutanix.ncp.ntnx_projects: state: absent project_uuid: "{{updated_project.project_uuid}}" register: op diff --git a/examples/roles_crud.yml b/examples/roles_crud.yml index b01c02eca..d364c804f 100644 --- a/examples/roles_crud.yml +++ b/examples/roles_crud.yml @@ -1,8 +1,6 @@ - name: Roles crud playbook. Here we will create, update, read and delete the role. hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -10,12 +8,12 @@ nutanix_password: validate_certs: false tasks: - - name: get some permissions for adding in roles - ntnx_permissions_info: + - name: Get some permissions for adding in roles + nutanix.ncp.ntnx_permissions_info: register: permissions - name: Create a role with 2 permissions. Here we will be using name or uuid for referenceing permissions - ntnx_roles: + nutanix.ncp.ntnx_roles: state: present name: test-ansible-role-1 desc: @@ -26,7 +24,7 @@ register: role1 - name: Update role - ntnx_roles: + nutanix.ncp.ntnx_roles: state: present role_uuid: "{{ role1.role_uuid }}" name: test-ansible-role-1 @@ -36,16 +34,16 @@ register: updated_role1 - name: Read the updated role - ntnx_roles_info: + nutanix.ncp.ntnx_roles_info: role_uuid: "{{ updated_role1.role_uuid }}" register: role1_info - name: Print the role details - debug: + ansible.builtin.debug: msg: "{{role1_info}}" - name: Delete the role. - ntnx_roles: + nutanix.ncp.ntnx_roles: state: absent role_uuid: "{{ updated_role1.role_uuid }}" wait: true diff --git a/examples/static_routes.yml b/examples/static_routes.yml index 846168e3a..c3a54a6ce 100644 --- a/examples/static_routes.yml +++ b/examples/static_routes.yml @@ -2,8 +2,6 @@ - name: Static Routes playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,15 +10,15 @@ validate_certs: false tasks: - name: Setting Variables - set_fact: + ansible.builtin.set_fact: vpc_uuid: "" vpn_uuid: "" external_nat_subnet: name: "" - uuid: "" + uuid: "" - - name: create static routes and default static routes with external nat subnet - ntnx_static_routes: + - name: Create static routes and default static routes with external nat subnet + nutanix.ncp.ntnx_static_routes: vpc_uuid: "{{ vpc_uuid }}" static_routes: - destination: "0.0.0.0/0" @@ -40,7 +38,7 @@ vpn_connection_ref: uuid: "{{ vpn_uuid }}" - - name: remove all routes excluding dynamic and local routes - ntnx_static_routes: + - name: Remove all routes excluding dynamic and local routes + nutanix.ncp.ntnx_static_routes: vpc_uuid: "{{ vpc_uuid }}" remove_all_routes: true diff --git a/examples/subnet.yml b/examples/subnet.yml index c77be095a..68003406b 100644 --- a/examples/subnet.yml +++ b/examples/subnet.yml @@ -1,8 +1,6 @@ - name: Subnet playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -11,7 +9,7 @@ validate_certs: false tasks: - name: Setting Variables - set_fact: + ansible.builtin.set_fact: cluster_name: "" cluster_uuid: "" virtual_switch_name: "" @@ -30,71 +28,71 @@ vpc_name: "" vpc_uuid: "" - - name: 'VLAN subnet with IPAM, IP pools and DHCP' - ntnx_subnets: + - name: "VLAN subnet with IPAM, IP pools and DHCP" + nutanix.ncp.ntnx_subnets: state: present name: VLAN subnet with IPAM IP pools and DHCP vlan_subnet: vlan_id: 29 virtual_switch: - name: '{{ virtual_switch_name }}' + name: "{{ virtual_switch_name }}" cluster: - name: '{{ cluster_name }}' + name: "{{ cluster_name }}" ipam: - network_ip: '{{ network_ip }}' - network_prefix: '{{ network_prefix }}' - gateway_ip: '{{ gateway_ip_address }}' + network_ip: "{{ network_ip }}" + network_prefix: "{{ network_prefix }}" + gateway_ip: "{{ gateway_ip_address }}" ip_pools: - - start_ip: '{{ start_address }}' - end_ip: '{{ end_address }}' + - start_ip: "{{ start_address }}" + end_ip: "{{ end_address }}" dhcp: - dns_servers: '{{ dns_servers }}' - domain_search: '{{ domain_search }}' - domain_name: '{{ domain_name }}' - tftp_server_name: '{{ tftp_server_name }}' - boot_file: '{{ boot_file }}' - dhcp_server_ip: '{{ dhcp_server_address }}' + dns_servers: "{{ dns_servers }}" + domain_search: "{{ domain_search }}" + domain_name: "{{ domain_name }}" + tftp_server_name: "{{ tftp_server_name }}" + boot_file: "{{ boot_file }}" + dhcp_server_ip: "{{ dhcp_server_address }}" register: result ignore_errors: true - name: External subnet with NAT - ntnx_subnets: + nutanix.ncp.ntnx_subnets: state: present - name: ' External subnet with NAT ' + name: " External subnet with NAT " external_subnet: vlan_id: 30 enable_nat: true cluster: - name: '{{ cluster_name }}' + name: "{{ cluster_name }}" ipam: - network_ip: '{{ network_ip }}' - network_prefix: '{{ network_prefix }}' - gateway_ip: '{{ gateway_ip_address }}' + network_ip: "{{ network_ip }}" + network_prefix: "{{ network_prefix }}" + gateway_ip: "{{ gateway_ip_address }}" ip_pools: - - start_ip: '{{ start_address }}' - end_ip: '{{ end_address }}' + - start_ip: "{{ start_address }}" + end_ip: "{{ end_address }}" register: result ignore_errors: true - name: Overlay Subnet with IP_pools and DHCP - ntnx_subnets: + nutanix.ncp.ntnx_subnets: state: present name: Overlay Subnet with IP_pools and DHCP overlay_subnet: vpc: - name: '{{ vpc_name }}' + name: "{{ vpc_name }}" ipam: - network_ip: '{{ network_ip }}' - network_prefix: '{{ network_prefix }}' - gateway_ip: '{{ gateway_ip_address }}' + network_ip: "{{ network_ip }}" + network_prefix: "{{ network_prefix }}" + gateway_ip: "{{ gateway_ip_address }}" ip_pools: - - start_ip: '{{ start_address }}' - end_ip: '{{ end_address }}' + - start_ip: "{{ start_address }}" + end_ip: "{{ end_address }}" dhcp: - dns_servers: '{{ dns_servers }}' - domain_search: '{{ domain_search }}' - domain_name: '{{ domain_name }}' - tftp_server_name: '{{ tftp_server_name }}' - boot_file_name: '{{ boot_file }}' + dns_servers: "{{ dns_servers }}" + domain_search: "{{ domain_search }}" + domain_name: "{{ domain_name }}" + tftp_server_name: "{{ tftp_server_name }}" + boot_file_name: "{{ boot_file }}" register: result ignore_errors: true diff --git a/examples/subnet_info.yml b/examples/subnet_info.yml index ce5bb045d..e4cf5e36d 100644 --- a/examples/subnet_info.yml +++ b/examples/subnet_info.yml @@ -2,8 +2,6 @@ - name: Subnet_Info playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -13,25 +11,25 @@ tasks: - name: List subnets using subnet_type filter criteria - ntnx_subnets_info: + nutanix.ncp.ntnx_subnets_info: filter: - subnet_type: "VLAN" + subnet_type: "VLAN" kind: subnet register: result - ignore_errors: True + ignore_errors: true - name: List subnets using length, offset and vlan_id ascending sorting - ntnx_subnets_info: + nutanix.ncp.ntnx_subnets_info: length: 1 offset: 2 sort_order: "ASCENDING" sort_attribute: "vlan_id" check_mode: true register: result - ignore_errors: True + ignore_errors: true - name: List subnets filter and custom_filter - ntnx_subnets_info: + nutanix.ncp.ntnx_subnets_info: filter: name: custom_filter: diff --git a/examples/user-groups.yml b/examples/user-groups.yml index 9dcc96e91..2075ee485 100644 --- a/examples/user-groups.yml +++ b/examples/user-groups.yml @@ -1,9 +1,7 @@ --- -- name: user_group playbook +- name: User_group playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -11,8 +9,8 @@ nutanix_password: validate_certs: false tasks: - - name: Setting Variables - set_fact: + - name: Setting Variables + ansible.builtin.set_fact: distinguished_name: "" principal_name: "" directory_service_uuid: "" @@ -20,31 +18,31 @@ project: uuid: "" - - name: create user group - ntnx_user_groups: - distinguished_name: "{{distinguished_name}}" - project: - uuid: "{{project.uuid}}" - categories: - Environment: - - "Dev" - register: result + - name: Create user group + nutanix.ncp.ntnx_user_groups: + distinguished_name: "{{distinguished_name}}" + project: + uuid: "{{project.uuid}}" + categories: + Environment: + - "Dev" + register: result - - name: delete user group - ntnx_user_groups: - state: absent - user_group_uuid: "{{result.user_group_uuid}}" - register: result + - name: Delete user group + nutanix.ncp.ntnx_user_groups: + state: absent + user_group_uuid: "{{result.user_group_uuid}}" + register: result - - name: create user group with idp - ntnx_user_groups: - idp: - idp_uuid: "{{identity_provider_uuid}}" - group_name: test_group_987 - register: result + - name: Create user group with idp + nutanix.ncp.ntnx_user_groups: + idp: + idp_uuid: "{{identity_provider_uuid}}" + group_name: test_group_987 + register: result - - name: delete user group - ntnx_user_groups: - state: absent - user_group_uuid: "{{result.user_group_uuid}}" - register: result + - name: Delete user group + nutanix.ncp.ntnx_user_groups: + state: absent + user_group_uuid: "{{result.user_group_uuid}}" + register: result diff --git a/examples/user.yml b/examples/user.yml index e70b61b14..1afca3252 100644 --- a/examples/user.yml +++ b/examples/user.yml @@ -1,9 +1,7 @@ --- -- name: users playbook +- name: Users playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -11,51 +9,51 @@ nutanix_password: validate_certs: false tasks: - - name: Setting Variables - set_fact: + - name: Setting Variables + ansible.builtin.set_fact: directory_service_uuid: "" principal_name: "" project: uuid: "" identity_provider_uuid: "" - - name: create local user - ntnx_users: - principal_name: "{{principal_name}}" - directory_service_uuid: "{{directory_service_uuid}}" - register: result + - name: Create local user + nutanix.ncp.ntnx_users: + principal_name: "{{principal_name}}" + directory_service_uuid: "{{directory_service_uuid}}" + register: result - - name: Delete created user - ntnx_users: - state: absent - user_uuid: "{{ result.user_uuid }}" + - name: Delete created user + nutanix.ncp.ntnx_users: + state: absent + user_uuid: "{{ result.user_uuid }}" - - name: create local user with project and categories - ntnx_users: - principal_name: "{{principal_name}}" - directory_service_uuid: "{{directory_service_uuid}}" - project: - uuid: "{{project.uuid}}" - categories: - Environment: - - "Dev" - AppType: - - "Default" - register: result + - name: Create local user with project and categories + nutanix.ncp.ntnx_users: + principal_name: "{{principal_name}}" + directory_service_uuid: "{{directory_service_uuid}}" + project: + uuid: "{{project.uuid}}" + categories: + Environment: + - "Dev" + AppType: + - "Default" + register: result - - name: Delete created user - ntnx_users: - state: absent - user_uuid: "{{ result.user_uuid }}" + - name: Delete created user + nutanix.ncp.ntnx_users: + state: absent + user_uuid: "{{ result.user_uuid }}" - - name: create idp user - ntnx_users: - identity_provider_uuid: "{{identity_provider_uuid}}" - username: testing_user - register: result - ignore_errors: true + - name: Create idp user + nutanix.ncp.ntnx_users: + identity_provider_uuid: "{{identity_provider_uuid}}" + username: testing_user + register: result + ignore_errors: true - - name: Delete created user - ntnx_users: - state: absent - user_uuid: "{{ result.user_uuid }}" + - name: Delete created user + nutanix.ncp.ntnx_users: + state: absent + user_uuid: "{{ result.user_uuid }}" diff --git a/examples/vm.yml b/examples/vm.yml index f88ab7064..e6c83b471 100644 --- a/examples/vm.yml +++ b/examples/vm.yml @@ -2,8 +2,6 @@ - name: VM playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -11,8 +9,8 @@ nutanix_password: validate_certs: false tasks: - - name: Setting Variables - set_fact: + - name: Setting Variables + ansible.builtin.set_fact: cluster_name: "" script_path: "" subnet_name: "" @@ -20,55 +18,56 @@ password: "" fqdn: "" - - name: Create Cloud-init Script file - copy: - dest: "cloud_init.yml" - content: | - #cloud-config - chpasswd: - list: | - root: "{{ password }}" - expire: False - fqdn: "{{ fqdn }}" + - name: Create Cloud-init Script file + ansible.builtin.copy: + mode: "0644" + dest: "cloud_init.yml" + content: | + #cloud-config + chpasswd: + list: | + root: "{{ password }}" + expire: False + fqdn: "{{ fqdn }}" - - name: create Vm - ntnx_vms: - state: present - name: "ansible_automation_demo" - desc: "ansible_vm_description" - categories: - AppType: - - "Apache_Spark" - cluster: - name: "{{cluster_name}}" - networks: - - is_connected: True - subnet: - name: "{{ subnet_name }}" - # mention cluster only when there are multiple subnets with same name accross clusters - # and subnet name is set above - cluster: - name: "{{cluster_name}}" - disks: - - type: "DISK" - size_gb: 30 - bus: "SATA" - clone_image: - name: "{{ image_name }}" - vcpus: 1 - cores_per_vcpu: 1 - memory_gb: 1 - guest_customization: - type: "cloud_init" - script_path: "./cloud_init.yml" - is_overridable: True - register: output + - name: Create Vm + nutanix.ncp.ntnx_vms: + state: present + name: "ansible_automation_demo" + desc: "ansible_vm_description" + categories: + AppType: + - "Apache_Spark" + cluster: + name: "{{cluster_name}}" + networks: + - is_connected: true + subnet: + name: "{{ subnet_name }}" + # mention cluster only when there are multiple subnets with same name accross clusters + # and subnet name is set above + cluster: + name: "{{cluster_name}}" + disks: + - type: "DISK" + size_gb: 30 + bus: "SATA" + clone_image: + name: "{{ image_name }}" + vcpus: 1 + cores_per_vcpu: 1 + memory_gb: 1 + guest_customization: + type: "cloud_init" + script_path: "./cloud_init.yml" + is_overridable: true + register: output - - name: output of vm created - debug: - msg: '{{ output }}' + - name: Output of vm created + ansible.builtin.debug: + msg: "{{ output }}" - - name: delete VM - ntnx_vms: - state: absent - vm_uuid: "{{output.vm_uuid}}" + - name: Delete VM + nutanix.ncp.ntnx_vms: + state: absent + vm_uuid: "{{output.vm_uuid}}" diff --git a/examples/vm_info.yml b/examples/vm_info.yml index 309102064..6ae7dc8e3 100644 --- a/examples/vm_info.yml +++ b/examples/vm_info.yml @@ -2,8 +2,6 @@ - name: VM_Info playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,34 +10,34 @@ validate_certs: false tasks: - name: Setting Variables - set_fact: + ansible.builtin.set_fact: vm_name: "" - name: List vms using name filter criteria - ntnx_vms_info: + nutanix.ncp.ntnx_vms_info: filter: vm_name: "{{ vm_name }}" kind: vm register: result - ignore_errors: True + ignore_errors: true - name: List vms using FIQL filter string - ntnx_vms_info: + nutanix.ncp.ntnx_vms_info: filter_string: "vm_name=={{vm.name}};power_state==off" register: result - ignore_errors: True + ignore_errors: true - name: List vms using length, offset and ascending vm_name sorting - ntnx_vms_info: + nutanix.ncp.ntnx_vms_info: length: 10 offset: 1 sort_order: "ASCENDING" sort_attribute: "vm_name" register: result - ignore_errors: True + ignore_errors: true - name: List vms using filter and custom_filter - ntnx_vms_info: + nutanix.ncp.ntnx_vms_info: filter: vm_name: custom_filter: diff --git a/examples/vm_operations.yml b/examples/vm_operations.yml index c6bef4dbc..54b1f24d7 100644 --- a/examples/vm_operations.yml +++ b/examples/vm_operations.yml @@ -3,8 +3,6 @@ - name: VM operations playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,31 +10,31 @@ nutanix_password: validate_certs: false tasks: - - name: Setting Variables - set_fact: + - name: Setting Variables + ansible.builtin.set_fact: script_path: "" subnet_name: "" vm_uuid: "" - - name: hard power off the vm - ntnx_vms: + - name: Hard power off the vm + nutanix.ncp.ntnx_vms: state: hard_poweroff vm_uuid: "{{ vm_uuid }}" - register: result - ignore_errors: true + register: result + ignore_errors: true - - name: create_ova_image while vm is on - ntnx_vms_ova: + - name: Create_ova_image while vm is on + nutanix.ncp.ntnx_vms_ova: state: present src_vm_uuid: "{{ vm_uuid }}" name: integration_test_VMDK_ova file_format: VMDK wait: true - register: result - ignore_errors: true + register: result + ignore_errors: true - - name: clone vm while it's off also add network and script - ntnx_vms_clone: + - name: Clone vm while it's off also add network and script + nutanix.ncp.ntnx_vms_clone: state: present src_vm_uuid: "{{ vm_uuid }}" networks: @@ -46,6 +44,6 @@ guest_customization: type: "cloud_init" script_path: "{{ script_path }}" - is_overridable: True - register: result - ignore_errors: true + is_overridable: true + register: result + ignore_errors: true diff --git a/examples/vm_update.yml b/examples/vm_update.yml index 45de3d642..33865a528 100644 --- a/examples/vm_update.yml +++ b/examples/vm_update.yml @@ -3,8 +3,6 @@ - name: VM update playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,8 +10,8 @@ nutanix_password: validate_certs: false tasks: - - name: Setting Variables - set_fact: + - name: Setting Variables + ansible.builtin.set_fact: cluster_name: "" script_path: "" subnet_name: "" @@ -26,56 +24,56 @@ remove_disk_uuid: "" subnet_uuid: "" - - name: Update VM - ntnx_vms: - vm_uuid: "{{ vm_uuid }}" - name: updated - desc: updated - categories: - AppType: - - Apache_Spark - disks: - - type: "DISK" - clone_image: - name: "{{ image_name }}" - bus: "SCSI" - size_gb: 20 - - type: DISK - size_gb: 3 - bus: PCI - - type: DISK - size_gb: 1 - bus: SCSI - storage_container: - uuid: "{{ storage_container_uuid }}" - networks: - - is_connected: true - subnet: - uuid: "{{ network_dhcp_uuid }}" - - is_connected: false - subnet: - uuid: "{{ static.uuid }}" - private_ip: "{{ network_static_ip }}" - register: result + - name: Update VM + nutanix.ncp.ntnx_vms: + vm_uuid: "{{ vm_uuid }}" + name: updated + desc: updated + categories: + AppType: + - Apache_Spark + disks: + - type: "DISK" + clone_image: + name: "{{ image_name }}" + bus: "SCSI" + size_gb: 20 + - type: DISK + size_gb: 3 + bus: PCI + - type: DISK + size_gb: 1 + bus: SCSI + storage_container: + uuid: "{{ storage_container_uuid }}" + networks: + - is_connected: true + subnet: + uuid: "{{ network_dhcp_uuid }}" + - is_connected: false + subnet: + uuid: "{{ static.uuid }}" + private_ip: "{{ network_static_ip }}" + register: result - - name: Update VM by deleting and editing disks and subnets - ntnx_vms: - vm_uuid: "{{ vm_uuid }}" - name: update diks - desc: update disks - disks: - - type: "DISK" - uuid: "{{ disk_uuid }}" - size_gb: 30 - - state: absent - uuid: "{{ remove_disk_uuid }}" - networks: - - state: absent - uuid: "{{ subnet_uuid }}" - register: result + - name: Update VM by deleting and editing disks and subnets + nutanix.ncp.ntnx_vms: + vm_uuid: "{{ vm_uuid }}" + name: update diks + desc: update disks + disks: + - type: "DISK" + uuid: "{{ disk_uuid }}" + size_gb: 30 + - state: absent + uuid: "{{ remove_disk_uuid }}" + networks: + - state: absent + uuid: "{{ subnet_uuid }}" + register: result - - name: Update VM by deleting it - ntnx_vms: - state: absent - vm_uuid: "{{ vm_uuid }}" - register: result + - name: Update VM by deleting it + nutanix.ncp.ntnx_vms: + state: absent + vm_uuid: "{{ vm_uuid }}" + register: result diff --git a/examples/vpc.yml b/examples/vpc.yml index 3af08fa53..5bf24dc1e 100644 --- a/examples/vpc.yml +++ b/examples/vpc.yml @@ -2,8 +2,6 @@ - name: VPC playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,21 +10,21 @@ validate_certs: false tasks: - name: Setting Variables - set_fact: + ansible.builtin.set_fact: external_subnet_name: "" vm_name: "" - name: Create min VPC with subnet name - ntnx_vpcs: + nutanix.ncp.ntnx_vpcs: state: present - wait: True + wait: true name: MinVPC external_subnets: - subnet_name: "{{ external_subnet.name }}" register: result - name: Delete all created vpcs - ntnx_vpcs: + nutanix.ncp.ntnx_vpcs: state: absent vpc_uuid: "{{ result.vpc_uuid }}" register: result diff --git a/examples/vpc_info.yml b/examples/vpc_info.yml index 652d157fd..583a2ba6f 100644 --- a/examples/vpc_info.yml +++ b/examples/vpc_info.yml @@ -2,8 +2,6 @@ - name: VPC_Info playbook hosts: localhost gather_facts: false - collections: - - nutanix.ncp module_defaults: group/nutanix.ncp.ntnx: nutanix_host: @@ -12,24 +10,23 @@ validate_certs: false tasks: - name: Setting Variables - set_fact: + ansible.builtin.set_fact: vpc_name: "" - name: List VPC using name filter criteria - ntnx_vpcs_info: + nutanix.ncp.ntnx_vpcs_info: filter: name: "{{ vpc_name }}" kind: vpc register: result - ignore_errors: True - + ignore_errors: true - name: List VPC using length, offset and descending name sorting - ntnx_vpcs_info: + nutanix.ncp.ntnx_vpcs_info: length: 4 offset: 1 sort_order: "DESCENDING" sort_attribute: "name" check_mode: true register: result - ignore_errors: True + ignore_errors: true From 5360e2be7e8d84dcf5091f796a413b68cd5a938b Mon Sep 17 00:00:00 2001 From: george-ghawali Date: Wed, 2 Oct 2024 10:23:20 +0300 Subject: [PATCH 2/2] Remove ansible lint from workflows --- .github/workflows/ansible-lint.yml | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 .github/workflows/ansible-lint.yml diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml deleted file mode 100644 index 0f4591dc8..000000000 --- a/.github/workflows/ansible-lint.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: ansible-lint -on: - - pull_request - -jobs: - build: - name: Ansible Lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.x (latest) - uses: actions/setup-python@v2 - with: - python-version: 3.x - - name: Run ansible-lint - uses: ansible/ansible-lint@main