From 76443a33e31d4f7ee12ae5e59171fee6fb2d9e12 Mon Sep 17 00:00:00 2001 From: george-ghawali Date: Tue, 8 Oct 2024 10:52:52 +0300 Subject: [PATCH] Resolving conflicts --- examples/acp.yml | 10 +- examples/fc/fc.yml | 177 +++++---- .../node_discovery_network_info.yml | 18 +- examples/images.yml | 26 +- examples/karbon/create_registries.yml | 53 ++- examples/karbon/registries_info.yml | 16 +- examples/ndb/db_server_vms.yml | 348 +++++++++--------- examples/roles_crud.yml | 18 +- examples/vm.yml | 25 +- 9 files changed, 338 insertions(+), 353 deletions(-) diff --git a/examples/acp.yml b/examples/acp.yml index 297bc00d..1d316820 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,9 +10,9 @@ validate_certs: false tasks: - - name: Create ACP with all specifications - ntnx_acps: - validate_certs: False + - name: Create ACP with all specfactions + nutanix.ncp.ntnx_acps: + validate_certs: false state: present nutanix_host: "{{ IP }}" nutanix_username: "{{ username }}" @@ -40,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/fc/fc.yml b/examples/fc/fc.yml index 1053195d..0489d25d 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/foundation/node_discovery_network_info.yml b/examples/foundation/node_discovery_network_info.yml index 27a3a550..526d7733 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" - # resume line 12 to include configured(nodes part of cluster) nodes in the output - # include_configured: true + 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 # 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" + 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: + - name: Print node network info + ansible.builtin.debug: msg: "{{ result }}" diff --git a/examples/images.yml b/examples/images.yml index 5d2db66d..5624ac95 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: detach 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/karbon/create_registries.yml b/examples/karbon/create_registries.yml index d843ace0..5992fbee 100644 --- a/examples/karbon/create_registries.yml +++ b/examples/karbon/create_registries.yml @@ -1,9 +1,7 @@ --- -- name: create registries +- 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 526cabd6..935658ee 100644 --- a/examples/karbon/registries_info.yml +++ b/examples/karbon/registries_info.yml @@ -1,9 +1,7 @@ --- -- name: get registries 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/db_server_vms.yml b/examples/ndb/db_server_vms.yml index 131b4945..faa0f288 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,43 +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: @@ -59,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: @@ -88,226 +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_cluster_1" - - uuid: "test_cluster_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 maintenance window task for vm - ntnx_ndb_maintenance_tasks: + - name: Add maitenance window task for vm + 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: generate 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 registration 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/roles_crud.yml b/examples/roles_crud.yml index b443afcc..d364c804 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 referencing permissions - ntnx_roles: + - name: Create a role with 2 permissions. Here we will be using name or uuid for referenceing permissions + 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/vm.yml b/examples/vm.yml index 079409f6..e6c83b47 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: @@ -12,7 +10,7 @@ validate_certs: false tasks: - name: Setting Variables - set_fact: + ansible.builtin.set_fact: cluster_name: "" script_path: "" subnet_name: "" @@ -21,7 +19,8 @@ fqdn: "" - name: Create Cloud-init Script file - copy: + ansible.builtin.copy: + mode: "0644" dest: "cloud_init.yml" content: | #cloud-config @@ -31,8 +30,8 @@ expire: False fqdn: "{{ fqdn }}" - - name: create Vm - ntnx_vms: + - name: Create Vm + nutanix.ncp.ntnx_vms: state: present name: "ansible_automation_demo" desc: "ansible_vm_description" @@ -42,10 +41,10 @@ cluster: name: "{{cluster_name}}" networks: - - is_connected: True + - is_connected: true subnet: name: "{{ subnet_name }}" - # mention cluster only when there are multiple subnets with same name across clusters + # mention cluster only when there are multiple subnets with same name accross clusters # and subnet name is set above cluster: name: "{{cluster_name}}" @@ -61,14 +60,14 @@ guest_customization: type: "cloud_init" script_path: "./cloud_init.yml" - is_overridable: True + is_overridable: true register: output - - name: output of vm created - debug: + - name: Output of vm created + ansible.builtin.debug: msg: "{{ output }}" - - name: delete VM - ntnx_vms: + - name: Delete VM + nutanix.ncp.ntnx_vms: state: absent vm_uuid: "{{output.vm_uuid}}"