From 7fec0b69a082aaeec72fee0612766aa42f6b1b4d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 18 Apr 2024 07:52:35 +0200 Subject: Merging upstream version 9.4.0+dfsg. Signed-off-by: Daniel Baumann --- .../dellemc/unity/playbooks/modules/cifsserver.yml | 151 ++++++ .../unity/playbooks/modules/consistencygroup.yml | 259 ++++++++++ .../dellemc/unity/playbooks/modules/filesystem.yml | 294 +++++++++++ .../playbooks/modules/filesystem_snapshot.yml | 111 +++++ .../dellemc/unity/playbooks/modules/host.yml | 180 +++++++ .../dellemc/unity/playbooks/modules/info.yml | 220 ++++++++ .../dellemc/unity/playbooks/modules/interface.yml | 91 ++++ .../dellemc/unity/playbooks/modules/nasserver.yml | 173 +++++++ .../dellemc/unity/playbooks/modules/nfs.yml | 551 +++++++++++++++++++++ .../dellemc/unity/playbooks/modules/nfsserver.yml | 104 ++++ .../playbooks/modules/replication_session.yml | 133 +++++ .../dellemc/unity/playbooks/modules/smbshare.yml | 229 +++++++++ .../dellemc/unity/playbooks/modules/snapshot.yml | 194 ++++++++ .../unity/playbooks/modules/snapshotschedule.yml | 203 ++++++++ .../unity/playbooks/modules/storagepool.yml | 185 +++++++ .../dellemc/unity/playbooks/modules/tree_quota.yml | 138 ++++++ .../dellemc/unity/playbooks/modules/user_quota.yml | 255 ++++++++++ .../dellemc/unity/playbooks/modules/volume.yml | 241 +++++++++ 18 files changed, 3712 insertions(+) create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/cifsserver.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/consistencygroup.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/filesystem.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/filesystem_snapshot.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/host.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/info.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/interface.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/nasserver.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/nfs.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/nfsserver.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/replication_session.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/smbshare.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/snapshot.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/snapshotschedule.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/storagepool.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/tree_quota.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/user_quota.yml create mode 100644 ansible_collections/dellemc/unity/playbooks/modules/volume.yml (limited to 'ansible_collections/dellemc/unity/playbooks') diff --git a/ansible_collections/dellemc/unity/playbooks/modules/cifsserver.yml b/ansible_collections/dellemc/unity/playbooks/modules/cifsserver.yml new file mode 100644 index 000000000..ee2f980f8 --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/cifsserver.yml @@ -0,0 +1,151 @@ +--- +- name: CIFS Server Operations + hosts: localhost + connection: local + gather_facts: false + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'user' + password: '***' + domain_username: 'domain_user' + domain_password: '**' + + tasks: + - name: Create standalone CIFS server with check mode + dellemc.unity.cifsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + netbios_name: "ansible_cifs" + workgroup: "ansible" + local_password: "**" + nas_server_name: "Ansible_server_1" + state: "present" + check_mode: true + + - name: Create standalone CIFS server + register: result + dellemc.unity.cifsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + netbios_name: "ansible_cifs" + workgroup: "ansible" + local_password: "**" + nas_server_name: "Ansible_server_1" + state: "present" + + - name: Create standalone CIFS server - Idempotency + register: result + dellemc.unity.cifsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + netbios_name: "ansible_cifs" + workgroup: "ansible" + local_password: "**" + nas_server_name: "Ansible_server_1" + state: "present" + + - name: Get CIFS server details + dellemc.unity.cifsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cifs_server_id: "{{ result.cifs_server_details.id }}" + state: "present" + + - name: Get CIFS server details using NAS server name + dellemc.unity.cifsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "Ansible_server_1" + state: "present" + + - name: Get CIFS server details using NAS server ID + dellemc.unity.cifsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_id: "{{ result.cifs_server_details.nas_server.UnityNasServer.id }}" + state: "present" + + - name: Delete CIFS server + dellemc.unity.cifsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cifs_server_id: "{{ result.cifs_server_details.id }}" + state: "absent" + + - name: Create CIFS server belonging to Active Directory + dellemc.unity.cifsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_id: "nas_52" + cifs_server_name: "test_cifs_server" + domain: "test.lab.domain.com" + domain_username: "{{ domain_username }}" + domain_password: "{{ domain_password }}" + state: "present" + + - name: Create CIFS server belonging to Active Directory - Idempotency + dellemc.unity.cifsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_id: "nas_52" + cifs_server_name: "test_cifs_server" + domain: "test.lab.domain.com" + domain_username: "{{ domain_username }}" + domain_password: "{{ domain_password }}" + state: "present" + + - name: Delete CIFS server with check mode + dellemc.unity.cifsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cifs_server_name: "test_cifs_server" + unjoin_cifs_server_account: true + domain_username: "{{ domain_username }}" + domain_password: "{{ domain_password }}" + state: "absent" + check_mode: true + + - name: Delete CIFS server + dellemc.unity.cifsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cifs_server_name: "test_cifs_server" + unjoin_cifs_server_account: true + domain_username: "{{ domain_username }}" + domain_password: "{{ domain_password }}" + state: "absent" + + - name: Delete CIFS server - Idempotency + dellemc.unity.cifsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cifs_server_name: "test_cifs_server" + unjoin_cifs_server_account: true + domain_username: "{{ domain_username }}" + domain_password: "{{ domain_password }}" + state: "absent" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/consistencygroup.yml b/ansible_collections/dellemc/unity/playbooks/modules/consistencygroup.yml new file mode 100644 index 000000000..f183304ba --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/consistencygroup.yml @@ -0,0 +1,259 @@ +--- +- name: Consistency Group Operations + hosts: localhost + connection: local + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'user' + password: '***' + cg_name: 'Ansible_CG_Testing' + new_cg_name: 'Ansible_CG_Rename_Testing' + description: "Ansible demo" + snap_schedule1: "Ansible_Test" + snap_schedule2: "CG_test_schedule" + tiering_policy1: "LOWEST" + state_present: "present" + state_absent: "absent" + vol_state_present: "present-in-group" + vol_state_absent: "absent-in-group" + mapping_state_present: "mapped" + mapping_state_absent: "unmapped" + + tasks: + - name: Create consistency group with volume and host access + register: result_cg + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + cg_name: "{{ cg_name }}" + description: "{{ description }}" + snap_schedule: "{{ snap_schedule1 }}" + volumes: + - vol_name: "Test_cg_vol-1" + vol_state: "{{ vol_state_present }}" + hosts: + - host_name: "10.*.*.*" + - host_id: "Host_511" + mapping_state: "{{ mapping_state_present }}" + state: "{{ state_present }}" + + - name: Set cg_id + ansible.builtin.set_fact: + cg_id: "{{ result_cg.consistency_group_details.id }}" + + - name: Get details of consistency group using id + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }} " + cg_id: "{{ cg_id }}" + state: "{{ state_present }}" + + - name: Add volumes to consistency group + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_id: "{{ cg_id }}" + volumes: + - vol_name: "Test_cg_vol-2" + - vol_id: "sv_8984" + vol_state: "{{ vol_state_present }}" + state: "{{ state_present }}" + + - name: Add volumes to consistency group - Idempotency + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_id: "{{ cg_id }}" + volumes: + - vol_name: "Test_cg_vol-2" + - vol_id: "sv_8984" + vol_state: "{{ vol_state_present }}" + state: "{{ state_present }}" + + - name: Rename consistency group + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "{{ cg_name }}" + new_cg_name: "{{ new_cg_name }}" + state: "{{ state_present }}" + + - name: Rename consistency group - Idempotency + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "{{ new_cg_name }}" + new_cg_name: "{{ new_cg_name }}" + state: "{{ state_present }}" + + - name: Modify consistency group details + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "{{ new_cg_name }}" + snap_schedule: "{{ snap_schedule2 }}" + tiering_policy: "{{ tiering_policy1 }}" + state: "{{ state_present }}" + + - name: Modify consistency group details - Idempotency + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "{{ new_cg_name }}" + snap_schedule: "{{ snap_schedule2 }}" + tiering_policy: "{{ tiering_policy1 }}" + state: "{{ state_present }}" + + - name: Map host to consistency group + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "{{ new_cg_name }}" + hosts: + - host_name: "10.*.*.*" + mapping_state: "{{ mapping_state_present }}" + state: "{{ state_present }}" + + - name: Map host to consistency group -- Idempotency + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "{{ new_cg_name }}" + hosts: + - host_name: "10.*.*.*" + mapping_state: "{{ mapping_state_present }}" + state: "{{ state_present }}" + + - name: Unmap host to consistency group + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "{{ new_cg_name }}" + hosts: + - host_name: "10.*.*.*" + - host_id: "Host_511" + mapping_state: "{{ mapping_state_absent }}" + state: "{{ state_present }}" + + - name: Unmap host to consistency group -- Idempotency + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "{{ new_cg_name }}" + hosts: + - host_name: "10.*.*.*" + - host_id: "Host_511" + mapping_state: "{{ mapping_state_absent }}" + state: "{{ state_present }}" + + - name: Remove volumes from consistency group + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "{{ new_cg_name }}" + volumes: + - vol_name: "Test_cg_vol-1" + - vol_name: "Test_cg_vol-2" + - vol_id: "sv_8984" + vol_state: "{{ vol_state_absent }}" + state: "{{ state_present }}" + + - name: Remove volumes from consistency group - Idempotency + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "{{ new_cg_name }}" + volumes: + - vol_name: "Test_cg_vol-1" + - vol_name: "Test_cg_vol-2" + - vol_id: "sv_8984" + vol_state: "{{ vol_state_absent }}" + state: "{{ state_present }}" + + - name: Delete consistency group + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "{{ new_cg_name }}" + state: "{{ state_absent }}" + + - name: Delete consistency group Idempotency + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "{{ new_cg_name }}" + state: "{{ state_absent }}" + + - name: Enable replication for consistency group + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "dis_repl_ans_source" + replication_params: + destination_cg_name: "destination_dis_repl_ans_source" + replication_mode: "asynchronous" + rpo: 60 + replication_type: "remote" + remote_system: + remote_system_host: '10.*.*.*' + remote_system_verifycert: false + remote_system_username: 'user' + remote_system_password: '**' + destination_pool_name: "Extreme_Perf_tier" + replication_state: "enable" + state: "present" + + - name: Disable replication for consistency group + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "dis_repl_ans_source" + replication_state: "disable" + state: "present" + + - name: Disable replication for consistency group Idempotency + dellemc.unity.consistencygroup: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + cg_name: "dis_repl_ans_source" + replication_state: "disable" + state: "present" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/filesystem.yml b/ansible_collections/dellemc/unity/playbooks/modules/filesystem.yml new file mode 100644 index 000000000..36757103f --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/filesystem.yml @@ -0,0 +1,294 @@ +--- +- name: FileSystem Operations + hosts: localhost + connection: local + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'user' + password: '**' + filesystem_name: "FS_Ansible" + nas_server_name: "lgla**" + size: 10 + pool_name: "Ansible_Unity_SP_2" + cap_gb: "GB" + description: "Ansible demo" + snap_schedule_name_1: "SS9_empty_DesRet_SS" + snap_schedule_name_2: "Ansible_vol_snap_schedule1" + pool_id: "pool_2" + tiering_policy: "LOWEST" + is_thin: true + data_reduction: true + state_present: "present" + state_absent: "absent" + state_mapped: "mapped" + state_unmapped: "unmapped" + + tasks: + - name: Create FileSystem + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + pool_name: "{{ pool_name }}" + size: "{{ size }}" + description: "{{ description }}" + snap_schedule_name: "{{ snap_schedule_name_2 }}" + state: "{{ state_present }}" + register: fs_result + + - name: Create FileSystem - idempotency + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + pool_name: "{{ pool_name }}" + size: "{{ size }}" + description: "{{ description }}" + snap_schedule_name: "{{ snap_schedule_name_2 }}" + state: "{{ state_present }}" + + - name: Set filesystem_id + ansible.builtin.set_fact: + filesystem_id: "{{ fs_result.filesystem_details.id }}" + + - name: Create FileSystem with quota configuration + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "SP_FS_test_quota_config_1" + nas_server_name: "{{ nas_server_name }}" + pool_id: "{{ pool_id }}" + size: "{{ size }}" + description: "{{ description }}" + quota_config: + default_hard_limit: 10 + grace_period_unit: "minutes" + is_user_quota_enabled: true + grace_period: 100 + state: "{{ state_present }}" + + - name: Create FileSystem with quota configuration -- Idempotency + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "SP_FS_test_quota_config_1" + nas_server_name: "{{ nas_server_name }}" + pool_id: "{{ pool_id }}" + size: "{{ size }}" + description: "{{ description }}" + quota_config: + default_hard_limit: 10 + grace_period_unit: "minutes" + is_user_quota_enabled: true + grace_period: 100 + state: "{{ state_present }}" + + - name: Expand FileSystem Size + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + size: 15 + state: "present" + + - name: Expand FileSystem Size - Idempotency + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + size: 15 + state: "present" + + - name: Modify FileSystem smb_properties + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + smb_properties: + is_smb_op_locks_enabled: true + smb_notify_on_change_dir_depth: 5 + is_smb_notify_on_access_enabled: true + state: "present" + + - name: Modify FileSystem smb_properties - Idempotency + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + smb_properties: + is_smb_op_locks_enabled: true + smb_notify_on_change_dir_depth: 5 + is_smb_notify_on_access_enabled: true + state: "present" + + - name: Modify FileSystem smb_properties - Idempotency + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + smb_properties: + is_smb_op_locks_enabled: true + smb_notify_on_change_dir_depth: 5 + is_smb_notify_on_access_enabled: true + state: "present" + + - name: Modify FileSystem snap schedule + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + snap_schedule_name: "{{ snap_schedule_name_1 }}" + state: "{{ state_present }}" + + - name: Modify FileSystem snap schedule - Idempotency + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + snap_schedule_name: "{{ snap_schedule_name_1 }}" + state: "{{ state_present }}" + + - name: Remove snap-schedule from filesystem + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + snap_schedule_name: "" + state: "{{ state_present }}" + + - name: Get details of FileSystem using id + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + state: "present" + + - name: Delete a FileSystem using id + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + state: "absent" + + - name: Delete a FileSystem using id -Idempotency + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + state: "absent" + + - name: Enable replication for filesystem + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "test_fs_rrepl_repl" + nas_server_name: "test_nas1" + replication_params: + replication_name: "local_repl_new" + replication_mode: "asynchronous" + replication_type: "remote" + rpo: 20 + remote_system: + remote_system_host: '10.*.*.*' + remote_system_verifycert: false + remote_system_username: 'user' + remote_system_password: '**' + destination_pool_name: "test_pool" + replication_state: "enable" + state: "present" + + - name: Enable replication for filesystem - Idempotency + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "test_fs_rrepl_repl" + nas_server_name: "test_nas1" + replication_params: + replication_name: "local_repl_new" + replication_mode: "asynchronous" + replication_type: "remote" + rpo: 20 + remote_system: + remote_system_host: '10.*.*.*' + remote_system_verifycert: false + remote_system_username: 'user' + remote_system_password: '**' + destination_pool_name: "test_pool" + replication_state: "enable" + state: "present" + + - name: Modify replication for filesystem + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "test_fs_rrepl_repl" + nas_server_name: "test_nas1" + replication_params: + replication_name: "local_repl_new" + new_replication_name: "local_repl_234" + replication_mode: "asynchronous" + replication_state: "enable" + state: "present" + + - name: Disable replication for filesystem + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "test_fs_rrepl_repl" + nas_server_name: "test_nas1" + replication_params: + replication_name: "local_repl_234" + replication_state: "disable" + state: "present" + + - name: Disable replication for filesystem - Idempotency + dellemc.unity.filesystem: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "test_fs_rrepl_repl" + nas_server_name: "test_nas1" + replication_state: "disable" + state: "present" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/filesystem_snapshot.yml b/ansible_collections/dellemc/unity/playbooks/modules/filesystem_snapshot.yml new file mode 100644 index 000000000..16ce88db2 --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/filesystem_snapshot.yml @@ -0,0 +1,111 @@ +--- +- name: Filesystem Snapshot Module Operations in Unity + hosts: localhost + connection: local + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'user' + password: '**' + snapshot_name: "11_ansible_test_FS_snap" + snapshot_name_1: "11_ansible_test_FS_snap_1" + filesystem_name_1: "11_ansible_test_FS" + nas_server_name_1: "lgla**" + nas_server_name_2: "lgla**" + description: "Created using playbook" + new_description: "Description updated using playbook" + expiry_time: "04/15/2021 2:30" + new_expiry_time: "04/15/2021 5:30" + fs_access_type_1: "Checkpoint" + fs_access_type_2: "Protocol" + + tasks: + - name: Create Filesystem Snapshot + dellemc.unity.filesystem_snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_name: "{{ snapshot_name_1 }}" + filesystem_name: "{{ filesystem_name_1 }}" + nas_server_name: "{{ nas_server_name_1 }}" + description: "{{ description }}" + auto_delete: true + fs_access_type: "{{ fs_access_type_1 }}" + state: "present" + register: result + + - name: Set snapshot_id + ansible.builtin.set_fact: + snapshot_id: "{{ result.dellemc.unity.filesystem_snapshot_details.id }}" + + - name: Create Filesystem Snapshot - Idempotency + dellemc.unity.filesystem_snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_name: "{{ snapshot_name_1 }}" + filesystem_name: "{{ filesystem_name_1 }}" + nas_server_name: "{{ nas_server_name_1 }}" + description: "{{ description }}" + auto_delete: true + fs_access_type: "{{ fs_access_type_1 }}" + state: "present" + + - name: Get Filesystem Snapshot Details using Name + dellemc.unity.filesystem_snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_name: "{{ snapshot_name_1 }}" + state: "present" + + - name: Get Filesystem Snapshot Details using ID + dellemc.unity.filesystem_snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_id: "{{ snapshot_id }}" + state: "present" + + - name: Update Filesystem Snapshot attributes + dellemc.unity.filesystem_snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_name: "{{ snapshot_name_1 }}" + description: "{{ new_description }}" + auto_delete: false + expiry_time: "{{ new_expiry_time }}" + state: "present" + + - name: Get Filesystem Snapshot Details + dellemc.unity.filesystem_snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_name: "{{ snapshot_name_1 }}" + state: "present" + + - name: Delete Filesystem Snapshot using Name + dellemc.unity.filesystem_snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_name: "{{ snapshot_name_1 }}" + state: "absent" + + - name: Delete Filesystem Snapshot using ID- Idempotency + dellemc.unity.filesystem_snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_id: "{{ snapshot_id }}" + state: "absent" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/host.yml b/ansible_collections/dellemc/unity/playbooks/modules/host.yml new file mode 100644 index 000000000..04b28c8e5 --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/host.yml @@ -0,0 +1,180 @@ +--- +- name: Host Module Operations on Unity + hosts: localhost + connection: local + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'user' + password: '**' + host_name_1: "ansible-test-host-1" + host_name_2: "ansible-test-host-2" + host_name_3: "ansible-test-host" + new_host_name_1: "ansible-test-host-3" + new_host_name_2: "ansible-test-host-4" + + tasks: + - name: Create empty Host "{{ host_name_1 }}" + register: result + dellemc.unity.host: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + host_name: "{{ host_name_1 }}" + host_os: "Linux" + description: "ansible-test-host-1" + state: "present" + + - name: Set host_id + ansible.builtin.set_fact: + host_id_1: "{{ result.host_details.id }}" + + - name: Create empty Host "{{ host_name_3 }}" + dellemc.unity.host: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + host_name: "{{ host_name_3 }}" + host_os: "Linux" + description: "ansible-test-host" + state: "present" + + - name: Create Host with Initiators "{{ host_name_2 }}" + register: result + dellemc.unity.host: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + host_name: "{{ host_name_2 }}" + host_os: "Linux" + description: "ansible-test-host-2" + initiators: + - "20:00:00:90:FA:13:82:34:10:00:00:90:FA:13:82:34" + - "20:00:00:90:FA:13:81:8C:10:00:00:90:FA:13:81:8C" + initiator_state: "present-in-host" + state: "present" + + - name: Set host_id + ansible.builtin.set_fact: + host_id_2: "{{ result.host_details.id }}" + + - name: Get Host details using host_name. + dellemc.unity.host: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + host_name: "{{ host_name_2 }}" + state: "present" + + - name: Get Host details using host_id. + dellemc.unity.host: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + host_id: "{{ host_id_2 }}" + state: "present" + + - name: Modify Host using host_name + dellemc.unity.host: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + host_name: "{{ host_name_1 }}" + host_os: "Mac OS" + description: "ansible-test-host-1" + state: "present" + + - name: Modify Host using host_id + dellemc.unity.host: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + host_id: "{{ host_id_2 }}" + new_host_name: "{{ new_host_name_1 }}" + host_os: "Mac OS" + description: "ansible-test-host-3" + state: "present" + + - name: Add Initiators to Host. + dellemc.unity.host: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + host_name: "{{ host_name_1 }}" + initiators: + - "20:00:00:90:FA:13:82:35:10:00:00:90:FA:13:82:35" + - "iqn.11-05.com.test:f14a6cef331b" + initiator_state: "present-in-host" + state: "present" + + - name: Modify multiple attributes of Host. + dellemc.unity.host: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + host_name: "{{ host_name_1 }}" + new_host_name: "{{ new_host_name_2 }}" + host_os: "Linux" + description: "ansible-test-host-4" + initiators: + - "iqn.11-05.com.test:24514718452e" + initiator_state: "present-in-host" + state: "present" + + - name: Delete Host. {{ new_host_name_2 }} + dellemc.unity.host: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + host_name: "{{ new_host_name_2 }}" + state: "absent" + + - name: Delete Host. {{ host_name_3 }} + dellemc.unity.host: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + host_name: "{{ host_name_3 }}" + state: "absent" + + - name: Delete Host. {{ new_host_name_1 }} + dellemc.unity.host: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + host_name: "{{ new_host_name_1 }}" + state: "absent" + + - name: Add network address to Host. + dellemc.unity.host: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + host_name: "{{ host_name }}" + network_address: "192.*.*.*" + network_address_state: "present-in-host" + state: "present" + + - name: Delete network address from Host. + dellemc.unity.host: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + host_name: "{{ host_name }}" + network_address: "192.*.*.*" + network_address_state: "absent-in-host" + state: "present" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/info.yml b/ansible_collections/dellemc/unity/playbooks/modules/info.yml new file mode 100644 index 000000000..e2c9b3162 --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/info.yml @@ -0,0 +1,220 @@ +--- +- name: Info Module Operations on Unity + hosts: localhost + connection: local + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'user' + password: '**' + + tasks: + - name: Get detailed list of Unity entities. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - host + - fc_initiator + - iscsi_initiator + - cg + - storage_pool + - vol + - snapshot_schedule + - nas_server + - file_system + - snapshot + - nfs_export + - smb_share + - user_quota + - tree_quota + - disk_group + + - name: Get information of Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + + - name: Get list of Unity hosts. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - host + + - name: Get list of FC initiators on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - fc_initiator + + - name: Get list of ISCSI initiators on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - iscsi_initiator + + - name: Get list of consistency groups on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - cg + + - name: Get list of storage pools on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - storage_pool + + - name: Get list of volumes on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - vol + + - name: Get list of snapshot schedules on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - snapshot_schedule + + - name: Get list of NAS Servers on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - nas_server + + - name: Get list of File Systems on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - file_system + + - name: Get list of Snapshots on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - snapshot + + - name: Get list of NFS exports on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - nfs_export + + - name: Get list of SMB shares on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - smb_share + + - name: Get list of user quota on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - user_quota + + - name: Get list of quota tree on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - tree_quota + + - name: Get details of Disk Group. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - disk_group + + - name: Get list of NFS Servers on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - nfs_server + + - name: Get list of CIFS Servers on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - cifs_server + + - name: Get list of ethernet ports on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - ethernet_port + + - name: Get list of file interfaces on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - file_interface + + - name: Get list of replication sessions on Unity array. + dellemc.unity.info: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - replication_session diff --git a/ansible_collections/dellemc/unity/playbooks/modules/interface.yml b/ansible_collections/dellemc/unity/playbooks/modules/interface.yml new file mode 100644 index 000000000..3095a3edc --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/interface.yml @@ -0,0 +1,91 @@ +--- +- name: Interface Operations + hosts: localhost + connection: local + gather_facts: false + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'user' + password: '**' + + tasks: + - name: Add Interface as Backup to NAS Server + dellemc.unity.interface: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + ethernet_port_name: "SP A 4-Port Card Ethernet Port 0" + role: "BACKUP" + interface_ip: "xx.xx.xx.xx" + netmask: "xx.xx.xx.xx" + gateway: "xx.xx.xx.xx" + vlan_id: 324 + state: "present" + + - name: Add Interface as Backup to NAS Server - Idempotency + dellemc.unity.interface: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + ethernet_port_name: "SP A 4-Port Card Ethernet Port 0" + role: "BACKUP" + interface_ip: "xx.xx.xx.xx" + netmask: "xx.xx.xx.xx" + gateway: "xx.xx.xx.xx" + vlan_id: 324 + state: "present" + + - name: Get Interface details + dellemc.unity.interface: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + interface_ip: "xx.xx.xx.xx" + state: "present" + + - name: Add Interface as Production to NAS Server + dellemc.unity.interface: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + ethernet_port_name: "SP A 4-Port Card Ethernet Port 0" + role: "PRODUCTION" + interface_ip: "xx.xx.xx.xx" + netmask: "xx.xx.xx.xx" + gateway: "xx.xx.xx.xx" + vlan_id: 324 + state: "present" + + - name: Add Interface as Production to NAS Server - Idempotency + dellemc.unity.interface: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + ethernet_port_name: "SP A 4-Port Card Ethernet Port 0" + role: "PRODUCTION" + interface_ip: "xx.xx.xx.xx" + netmask: "xx.xx.xx.xx" + gateway: "xx.xx.xx.xx" + vlan_id: 324 + state: "present" + + - name: Delete Interface + dellemc.unity.interface: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + interface_ip: "xx.xx.xx.xx" + state: "absent" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/nasserver.yml b/ansible_collections/dellemc/unity/playbooks/modules/nasserver.yml new file mode 100644 index 000000000..72f9b7daf --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/nasserver.yml @@ -0,0 +1,173 @@ +--- +- name: NAS Server Module Operations in Unity + hosts: localhost + connection: local + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'user' + password: '**' + nas_server_name: "lglad073" + nas_server_new_name: "new_lglad073" + tasks: + - name: Get NAS Server Details using Name + dellemc.unity.nasserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "{{ nas_server_name }}" + state: "present" + + - name: Rename NAS Server to new Name + dellemc.unity.nasserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "{{ nas_server_name }}" + nas_server_new_name: "{{ nas_server_new_name }}" + state: "present" + + - name: Rename NAS Server to Old Name + dellemc.unity.nasserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "{{ nas_server_new_name }}" + nas_server_new_name: "{{ nas_server_name }}" + state: "present" + + - name: Modify Details of NAS Server + dellemc.unity.nasserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "{{ nas_server_name }}" + current_unix_directory_service: "NONE" + is_packet_reflect_enabled: true + state: "present" + + - name: Enable replication for NAS Server on Local System + dellemc.unity.nasserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_id: "nas_10" + replication_reuse_resource: false + replication_params: + replication_name: "test_replication" + destination_nas_server_name: "destination_nas" + replication_mode: "asynchronous" + rpo: 60 + replication_type: "local" + destination_pool_name: "Pool_Ansible_Neo_DND" + destination_sp: "SPA" + is_backup: true + replication_state: "enable" + state: "present" + + - name: Enable replication for NAS Server on Remote System + dellemc.unity.nasserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + replication_reuse_resource: false + replication_params: + replication_name: "test_replication" + destination_nas_server_name: "destination_nas" + replication_mode: "asynchronous" + rpo: 60 + replication_type: "remote" + remote_system: + remote_system_host: '10.*.*.*' + remote_system_verifycert: false + remote_system_username: 'test1' + remote_system_password: 'test1!' + destination_pool_name: "fastVP_pool" + destination_sp: "SPA" + is_backup: true + replication_state: "enable" + state: "present" + + - name: Enable replication for NAS Server on Remote System in existing NAS Server + dellemc.unity.nasserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + replication_reuse_resource: true + replication_params: + destination_nas_server_name: "destination_nas" + replication_mode: "asynchronous" + rpo: 60 + replication_type: "remote" + replication_name: "test_replication" + remote_system: + remote_system_host: '10.*.*.*' + remote_system_verifycert: false + remote_system_username: 'test1' + remote_system_password: 'test1!' + destination_pool_name: "fastVP_pool" + replication_state: "enable" + state: "present" + + - name: Modify replication for NAS Server + dellemc.unity.nasserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + replication_params: + replication_name: "test_repl_rename" + new_replication_name: "test_replication" + rpo: 20 + replication_mode: "asynchronous" + replication_state: "enable" + state: "present" + + - name: Modify replication for NAS Server - Idempotency + dellemc.unity.nasserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + replication_params: + replication_name: "test_replication" + new_replication_name: "test_repl_rename" + rpo: 20 + replication_mode: "asynchronous" + replication_state: "enable" + state: "present" + + - name: Disable replication for NAS Server + dellemc.unity.nasserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + replication_params: + replication_name: "test_replication" + replication_state: "disable" + state: "present" + + - name: Disable replication for NAS Server - Idempotency + dellemc.unity.nasserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + replication_params: + replication_name: "test_replication" + replication_state: "disable" + state: "present" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/nfs.yml b/ansible_collections/dellemc/unity/playbooks/modules/nfs.yml new file mode 100644 index 000000000..f0bb48b11 --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/nfs.yml @@ -0,0 +1,551 @@ +--- +- name: NFS Share Module Operations on Unity + hosts: localhost + connection: local + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'user' + password: '**' + nfs_export_name_from_fs: 'ansible_nfs' + nfs_export_name_from_snap: 'ansible_snap_nfs' + filesystem_id: 'fs_377' + filesystem_name: 'ansible_fs' + nas_server_id: 'nas_3' + nas_server_name: 'lglad071' + snapshot_id: '171798692329' + snapshot_name: 'ansible_fs_snap' + description: 'Ansible Unity Module' + anonymous_gid: 4294967290 + anonymous_uid: 4294967290 + host_id1: 'Host_12' + host_id2: 'Host_14' + host_id3: 'Host_31' + host_id4: 'Host_63' + host_name1: 'testlgl3' + host_name2: 'testlgl2' + host_name3: 'testlgl1' + host_name4: 'test.lss.com' + ip_address1: '10.*.*.*/24' + ip_address2: 'fdfe:9042:c53d:0:250:56ff:fea2:5143' + + tasks: + - name: Create nfs share from filesystem + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_fs }}" + path: '/' + filesystem_id: "{{ filesystem_id }}" + description: "{{ description }}" + min_security: "SYS" + default_access: "READ_ONLY" + state: "present" + register: result + + - name: Set nfs share ID created from filesystem + ansible.builtin.set_fact: + nfs_export_id_from_fs: "{{ result['nfs_share_details']['id'] }}" + + - name: Create nfs share from filesystem - idempotency + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_fs }}" + path: '/' + filesystem_name: "{{ filesystem_name }}" + nas_server_id: "{{ nas_server_id }}" + state: "present" + register: result + + - name: Modify nfs share(fs) + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_fs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_id: "{{ nas_server_id }}" + description: "" + default_access: "READ_ONLY_ROOT" + anonymous_gid: "{{ anonymous_gid }}" + anonymous_uid: "{{ anonymous_uid }}" + state: "present" + register: result + + - name: Modify nfs share(fs) - idempotency + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_fs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_id: "{{ nas_server_id }}" + description: "" + default_access: "READ_ONLY_ROOT" + anonymous_gid: "{{ anonymous_gid }}" + anonymous_uid: "{{ anonymous_uid }}" + state: "present" + register: result + + - name: Create nfs share from snapshot + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_snap }}" + path: '/' + snapshot_name: "{{ snapshot_name }}" + description: "{{ description }}" + min_security: "SYS" + default_access: "READ_ONLY" + state: "present" + register: result + + - name: Set nfs share ID created from snapshot + ansible.builtin.set_fact: + nfs_export_id_from_snap: "{{ result['nfs_share_details']['id'] }}" + + - name: Create nfs share from snapshot - idempotency + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_snap }}" + path: '/' + snapshot_id: "{{ snapshot_id }}" + state: "present" + register: result + + - name: Modify nfs share(snapshot) + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_snap }}" + snapshot_id: "{{ snapshot_id }}" + description: '' + default_access: "READ_ONLY_ROOT" + anonymous_gid: "{{ anonymous_gid }}" + anonymous_uid: "{{ anonymous_uid }}" + state: "present" + register: result + + - name: Modify nfs share(snapshot) - idempotency + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_snap }}" + snapshot_id: "{{ snapshot_id }}" + description: '' + default_access: "READ_ONLY_ROOT" + anonymous_gid: "{{ anonymous_gid }}" + anonymous_uid: "{{ anonymous_uid }}" + state: "present" + register: result + + - name: Add host in nfs share(fs) + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_fs }}" + filesystem_id: "{{ filesystem_id }}" + adv_host_mgmt_enabled: true + no_access_hosts: + - host_id: "{{ host_id1 }}" + read_only_hosts: + - host_id: "{{ host_id2 }}" + read_only_root_hosts: + - host_name: "{{ host_name1 }}" + read_write_hosts: + - host_name: "{{ host_name1 }}" + read_write_root_hosts: + - ip_address: "{{ ip_address1 }}" + host_state: "present-in-export" + state: "present" + register: result + + - name: Add host in nfs share(fs) - idempotency + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_fs }}" + filesystem_id: "{{ filesystem_id }}" + adv_host_mgmt_enabled: true + no_access_hosts: + - host_id: "{{ host_id1 }}" + read_only_hosts: + - host_id: "{{ host_id2 }}" + read_only_root_hosts: + - host_name: "{{ host_name1 }}" + read_write_hosts: + - host_name: "{{ host_name1 }}" + read_write_root_hosts: + - ip_address: "{{ ip_address1 }}" + host_state: "present-in-export" + state: "present" + register: result + + - name: Add more host in nfs share(fs) + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_fs }}" + filesystem_id: "{{ filesystem_id }}" + adv_host_mgmt_enabled: true + no_access_hosts: + - host_id: "{{ host_id1 }}" + - host_name: "{{ host_name1 }}" + read_only_hosts: + - host_id: "{{ host_id2 }}" + - host_id: "{{ host_id3 }}" + read_only_root_hosts: + - host_name: "{{ host_name2 }}" + - host_name: "{{ host_name3 }}" + read_write_hosts: + - host_name: "{{ host_name4 }}" + - host_id: "{{ host_id4 }}" + read_write_root_hosts: + - ip_address: "{{ ip_address1 }}" + - ip_address: "{{ ip_address2 }}" + host_state: "present-in-export" + state: "present" + register: result + + - name: Remove host in nfs share(fs) + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_fs }}" + filesystem_id: "{{ filesystem_id }}" + adv_host_mgmt_enabled: true + no_access_hosts: + - host_id: "{{ host_id1 }}" + - host_name: "{{ host_name1 }}" + read_only_hosts: + - host_id: "{{ host_id2 }}" + - host_id: "{{ host_id3 }}" + read_only_root_hosts: + - host_name: "{{ host_name2 }}" + - host_name: "{{ host_name3 }}" + read_write_hosts: + - host_name: "{{ host_name4 }}" + - host_id: "{{ host_id4 }}" + read_write_root_hosts: + - ip_address: "{{ ip_address1 }}" + - ip_address: "{{ ip_address2 }}" + host_state: "absent-in-export" + state: "present" + register: result + + - name: Remove host in nfs share(fs) - idempotency + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_fs }}" + filesystem_id: "{{ filesystem_id }}" + adv_host_mgmt_enabled: true + no_access_hosts: + - host_id: "{{ host_id1 }}" + - host_name: "{{ host_name1 }}" + read_only_hosts: + - host_id: "{{ host_id2 }}" + - host_id: "{{ host_id3 }}" + read_only_root_hosts: + - host_name: "{{ host_name2 }}" + - host_name: "{{ host_name3 }}" + read_write_hosts: + - host_name: "{{ host_name4 }}" + - host_id: "{{ host_id4 }}" + read_write_root_hosts: + - ip_address: "{{ ip_address1 }}" + - ip_address: "{{ ip_address2 }}" + host_state: "absent-in-export" + state: "present" + register: result + + - name: Add host in nfs share(snapshot) + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_snap }}" + snapshot_name: "{{ snapshot_name }}" + adv_host_mgmt_enabled: true + no_access_hosts: + - host_id: "{{ host_id1 }}" + read_only_hosts: + - host_id: "{{ host_id2 }}" + read_only_root_hosts: + - host_name: "{{ host_name1 }}" + read_write_hosts: + - host_name: "{{ host_name2 }}" + read_write_root_hosts: + - ip_address: "{{ ip_address1 }}" + host_state: "present-in-export" + state: "present" + register: result + + - name: Add host in nfs share(snapshot) - idempotency + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_snap }}" + snapshot_name: "{{ snapshot_name }}" + adv_host_mgmt_enabled: true + no_access_hosts: + - host_id: "{{ host_id1 }}" + read_only_hosts: + - host_id: "{{ host_id2 }}" + read_only_root_hosts: + - host_name: "{{ host_name1 }}" + read_write_hosts: + - host_name: "{{ host_name2 }}" + read_write_root_hosts: + - ip_address: "{{ ip_address1 }}" + host_state: "present-in-export" + state: "present" + register: result + + - name: Add more host in nfs share(snapshot) + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_snap }}" + snapshot_name: "{{ snapshot_name }}" + adv_host_mgmt_enabled: true + no_access_hosts: + - host_id: "{{ host_id1 }}" + - host_name: "{{ host_name1 }}" + read_only_hosts: + - host_id: "{{ host_id2 }}" + - host_id: "{{ host_id3 }}" + read_only_root_hosts: + - host_name: "{{ host_name2 }}" + - host_name: "{{ host_name3 }}" + read_write_hosts: + - host_name: "{{ host_name4 }}" + - host_id: "{{ host_id4 }}" + read_write_root_hosts: + - ip_address: "{{ ip_address1 }}" + - ip_address: "{{ ip_address2 }}" + host_state: "present-in-export" + state: "present" + register: result + + - name: Remove host in nfs share(snapshot) + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_snap }}" + snapshot_name: "{{ snapshot_name }}" + adv_host_mgmt_enabled: true + no_access_hosts: + - host_id: "{{ host_id1 }}" + - host_name: "{{ host_name1 }}" + read_only_hosts: + - host_id: "{{ host_id2 }}" + - host_id: "{{ host_id3 }}" + read_only_root_hosts: + - host_name: "{{ host_name2 }}" + - host_name: "{{ host_name3 }}" + read_write_hosts: + - host_name: "{{ host_name4 }}" + - host_id: "{{ host_id4 }}" + read_write_root_hosts: + - ip_address: "{{ ip_address1 }}" + - ip_address: "{{ ip_address2 }}" + host_state: "absent-in-export" + state: "present" + register: result + + - name: Remove host in nfs share(snapshot) - idempotency + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_snap }}" + snapshot_name: "{{ snapshot_name }}" + adv_host_mgmt_enabled: true + no_access_hosts: + - host_id: "{{ host_id1 }}" + - host_name: "{{ host_name1 }}" + read_only_hosts: + - host_id: "{{ host_id2 }}" + - host_id: "{{ host_id3 }}" + read_only_root_hosts: + - host_name: "{{ host_name2 }}" + - host_name: "{{ host_name3 }}" + read_write_hosts: + - host_name: "{{ host_name4 }}" + - host_id: "{{ host_id4 }}" + read_write_root_hosts: + - ip_address: "{{ ip_address1 }}" + - ip_address: "{{ ip_address2 }}" + host_state: "absent-in-export" + state: "present" + register: result + + - name: Get nfs details by nfs ID + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_id: "{{ nfs_export_id_from_fs }}" + state: "present" + register: result + + - name: Get nfs details by nfs name and filesystem ID + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_fs }}" + filesystem_id: "{{ filesystem_id }}" + state: "present" + register: result + + - name: Get nfs details by nfs name, filesystem name & nas server ID + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_fs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_id: "{{ nas_server_id }}" + state: "present" + register: result + + - name: Get nfs details by nfs name, filesystem name & nas server name + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_fs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + state: "present" + register: result + + - name: Get nfs details by snapshot name + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_snap }}" + snapshot_name: "{{ snapshot_name }}" + state: "present" + register: result + + - name: Get nfs details by snapshot ID + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_snap }}" + snapshot_id: "{{ snapshot_id }}" + state: "present" + register: result + + - name: Delete nfs share by nfs ID + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_id: "{{ nfs_export_id_from_snap }}" + state: "absent" + register: result + + - name: Delete nfs share by nfs name + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "{{ nfs_export_name_from_fs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + state: "absent" + register: result + + - name: Add host in nfs share(fs) with adv_host_mgmt_enabled as false + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "csishare-csivol-346b60e518" + filesystem_id: "fs_14267" + adv_host_mgmt_enabled: false + no_access_hosts: + - domain: "google.com" + read_only_hosts: + - netgroup: "netgroup_admin" + read_only_root_hosts: + - host_name: "host5" + read_write_hosts: + - subnet: "10.*.*.*/255.255.255.0" + read_write_root_hosts: + - ip_address: "10.*.*.8" + host_state: "present-in-export" + state: "present" + register: result + + - name: Remove host in nfs share(fs) with adv_host_mgmt_enabled as false + dellemc.unity.nfs: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nfs_export_name: "csishare-csivol-346b60e518" + filesystem_id: "fs_14267" + adv_host_mgmt_enabled: false + no_access_hosts: + - domain: "google.com" + read_only_hosts: + - netgroup: "netgroup_admin" + read_only_root_hosts: + - host_name: "host5" + read_write_hosts: + - subnet: "10.*.*.*/255.255.255.0" + read_write_root_hosts: + - ip_address: "10.*.*.*" + host_state: "absent-in-export" + state: "present" + register: result diff --git a/ansible_collections/dellemc/unity/playbooks/modules/nfsserver.yml b/ansible_collections/dellemc/unity/playbooks/modules/nfsserver.yml new file mode 100644 index 000000000..83d0d7b32 --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/nfsserver.yml @@ -0,0 +1,104 @@ +--- +- name: NFS Server Operations + hosts: localhost + connection: local + gather_facts: false + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'user' + password: '**' + + tasks: + - name: Create NFS server with kdctype as Windows + dellemc.unity.nfsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + host_name: "dummy_nas23" + is_secure_enabled: true + kerberos_domain_controller_type: "WINDOWS" + kerberos_domain_controller_username: "user" + kerberos_domain_controller_password: "**" + is_extended_credentials_enabled: true + nfs_v4_enabled: true + state: "present" + + - name: Create NFS server with kdctype as Windows - Idempotency + dellemc.unity.nfsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + host_name: "dummy_nas23" + is_secure_enabled: true + kerberos_domain_controller_type: "WINDOWS" + kerberos_domain_controller_username: "user" + kerberos_domain_controller_password: "**" + is_extended_credentials_enabled: true + nfs_v4_enabled: true + state: "present" + + - name: Get NFS server details + dellemc.unity.nfsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + state: "present" + + - name: Delete NFS server + dellemc.unity.nfsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + kerberos_domain_controller_username: "user" + kerberos_domain_controller_password: "**" + remove_spn_from_kerberos: true + state: "absent" + + - name: Create NFS server with kdctype as Unix + dellemc.unity.nfsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + host_name: "dummy_nas23" + is_secure_enabled: true + kerberos_domain_controller_type: "UNIX" + is_extended_credentials_enabled: true + nfs_v4_enabled: true + state: "present" + + - name: Create NFS server with kdctype as Unix - Idempotency + dellemc.unity.nfsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + host_name: "dummy_nas23" + is_secure_enabled: true + kerberos_domain_controller_type: "UNIX" + is_extended_credentials_enabled: true + nfs_v4_enabled: true + state: "present" + + - name: Delete NFS server + dellemc.unity.nfsserver: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + nas_server_name: "dummy_nas" + kerberos_domain_controller_username: "user" + kerberos_domain_controller_password: "**" + remove_spn_from_kerberos: true + state: "absent" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/replication_session.yml b/ansible_collections/dellemc/unity/playbooks/modules/replication_session.yml new file mode 100644 index 000000000..484e29a90 --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/replication_session.yml @@ -0,0 +1,133 @@ +--- +- name: Replication Session Operations + hosts: localhost + connection: local + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'admin' + password: '**' + session_id: "103079215195_APM00213404195_0000_103079215215_APM00213404195_0000" + session_name: "test-session" + + tasks: + - name: Get replication session details + dellemc.unity.replication_session: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + session_name: "{{ session_name }}" + + - name: Get replication session details + dellemc.unity.replication_session: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + session_id: "{{ session_id }}" + + - name: Pause replication session + dellemc.unity.replication_session: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + session_name: "{{ session_name }}" + pause: true + + - name: Pause replication session -- Idempotency + dellemc.unity.replication_session: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + session_name: "{{ session_name }}" + pause: true + + - name: Resume replication session + dellemc.unity.replication_session: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + session_name: "{{ session_name }}" + force_full_copy: true + pause: false + + - name: Resume replication session -- Idempotency + dellemc.unity.replication_session: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + session_name: "{{ session_name }}" + force_full_copy: true + pause: false + + - name: Sync replication session + dellemc.unity.replication_session: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + session_id: "{{ session_id }}" + sync: true + + - name: Failover replication session + dellemc.unity.replication_session: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + session_name: "{{ session_name }}" + failover_with_sync: true + force: true + + - name: Failover replication session -- Idempotency + dellemc.unity.replication_session: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + session_name: "{{ session_name }}" + failover_with_sync: true + force: true + + - name: Failback replication session + dellemc.unity.replication_session: + unispherehost: "{{ dest_unispherhost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + session_name: "{{ session_name }}" + failback: true + force_full_copy: true + + - name: Failback replication session -- Idempotency + dellemc.unity.replication_session: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + session_name: "{{ session_name }}" + failback: true + force_full_copy: true + + - name: Delete replication session + dellemc.unity.replication_session: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + session_name: "test123" + state: "absent" + + - name: Delete replication session -- Idempotency + dellemc.unity.replication_session: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + session_name: "test123" + state: "absent" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/smbshare.yml b/ansible_collections/dellemc/unity/playbooks/modules/smbshare.yml new file mode 100644 index 000000000..91de71d0c --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/smbshare.yml @@ -0,0 +1,229 @@ +--- +- name: SMB Share Module Operations in Unity + hosts: localhost + connection: local + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'user' + password: '**' + filesystem_name: "ansible_smb_share_fs" + snapshot_name: "ansible_smb_share_snap" + nas_server_name: "lglad071" + description: "Share is created using playbook" + new_description: "modified the description of share using playbook" + fs_share_name: "ansible_share_2" + snap_share_name: "ansible_share_21" + tasks: + - name: Create a SMB Share for Filesystem + register: smb_result + dellemc.unity.smbshare: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + share_name: "{{ fs_share_name }}" + path: "/" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + umask: "000" + description: "Added description of filesystem SMB share during creation" + offline_availability: "PROGRAMS" + is_abe_enabled: true + is_branch_cache_enabled: true + is_continuous_availability_enabled: true + is_encryption_enabled: true + state: "present" + + - name: Set Snapshot SMB Share ID + ansible.builtin.set_fact: + fs_share_id: "{{ smb_result.smb_share_details.id }}" + + - name: Create a SMB Share for Filesystem Idempotency + dellemc.unity.smbshare: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + share_name: "{{ fs_share_name }}" + path: "/" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + umask: "000" + description: "Added description of filesystem SMB share during creation" + offline_availability: "PROGRAMS" + is_abe_enabled: true + is_branch_cache_enabled: true + is_continuous_availability_enabled: true + is_encryption_enabled: true + state: "present" + + - name: Get SMB Share Details using Name + dellemc.unity.smbshare: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + share_name: "{{ fs_share_name }}" + filesystem_id: "fs_65" + state: "present" + + - name: Update the details of the SMB share + dellemc.unity.smbshare: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + share_name: "{{ fs_share_name }}" + filesystem_id: "fs_65" + umask: "777" + description: "updated description of filesystem SMB share" + offline_availability: "DOCUMENTS" + is_abe_enabled: false + is_branch_cache_enabled: false + is_continuous_availability_enabled: false + is_encryption_enabled: false + state: "present" + + - name: Update the details of the SMB share Idempotency + dellemc.unity.smbshare: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + share_name: "{{ fs_share_name }}" + filesystem_id: "fs_65" + umask: "777" + description: "updated description of filesystem SMB share" + offline_availability: "DOCUMENTS" + is_abe_enabled: false + is_branch_cache_enabled: false + is_continuous_availability_enabled: false + is_encryption_enabled: false + state: "present" + + - name: Delete SMB share for Filesystem + dellemc.unity.smbshare: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + share_name: "{{ fs_share_name }}" + filesystem_id: "fs_65" + state: "absent" + + - name: Delete SMB share for Filesystem Idempotency + dellemc.unity.smbshare: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + share_name: "{{ fs_share_name }}" + filesystem_id: "fs_65" + state: "absent" + + # Snapshot Name and ID both are unique across Unity Array. + # Hence, NAS Server is not required for Unique Identification of Snapshot. + - name: Create a SMB Share for Snapshot + register: smb_result + dellemc.unity.smbshare: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + share_name: "{{ snap_share_name }}" + path: "/" + snapshot_name: "{{ snapshot_name }}" + umask: "000" + description: "Added description of Snapshot SMB share during creation" + offline_availability: "PROGRAMS" + is_abe_enabled: true + is_branch_cache_enabled: true + is_continuous_availability_enabled: true + is_encryption_enabled: true + state: "present" + + - name: Set Snapshot SMB Share ID + ansible.builtin.set_fact: + snap_share_id: "{{ smb_result.smb_share_details.id }}" + + - name: Create a SMB Share for Snapshot Idempotency + dellemc.unity.smbshare: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + share_name: "{{ snap_share_name }}" + path: "/" + snapshot_name: "{{ snapshot_name }}" + umask: "000" + description: "Added description of Snapshot SMB share during creation" + offline_availability: "PROGRAMS" + is_abe_enabled: true + is_branch_cache_enabled: true + is_continuous_availability_enabled: true + is_encryption_enabled: true + state: "present" + + - name: Get SMB Share Details using Name + dellemc.unity.smbshare: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + share_name: "{{ snap_share_name }}" + snapshot_name: "{{ snapshot_name }}" + state: "present" + + - name: Update the details of the SMB share + dellemc.unity.smbshare: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + share_name: "{{ snap_share_name }}" + snapshot_name: "{{ snapshot_name }}" + umask: "777" + description: "updated description of snapshot's SMB share" + offline_availability: "DOCUMENTS" + is_abe_enabled: false + is_branch_cache_enabled: false + is_continuous_availability_enabled: false + is_encryption_enabled: false + state: "present" + + - name: Update the details of the SMB share Idempotency + dellemc.unity.smbshare: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + share_name: "{{ snap_share_name }}" + snapshot_name: "{{ snapshot_name }}" + umask: "777" + description: "updated description of snapshot's SMB share" + offline_availability: "DOCUMENTS" + is_abe_enabled: false + is_branch_cache_enabled: false + is_continuous_availability_enabled: false + is_encryption_enabled: false + state: "present" + + - name: Delete SMB share for Filesystem Snapshot + dellemc.unity.smbshare: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + share_id: "{{ snap_share_id }}" + state: "absent" + + - name: Delete SMB share for Filesystem Snapshot Idempotency + dellemc.unity.smbshare: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + share_name: "{{ snap_share_name }}" + snapshot_name: "{{ snapshot_name }}" + state: "absent" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/snapshot.yml b/ansible_collections/dellemc/unity/playbooks/modules/snapshot.yml new file mode 100644 index 000000000..164106f7f --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/snapshot.yml @@ -0,0 +1,194 @@ +--- +- name: Snapshot Module Operations in Unity + hosts: localhost + connection: local + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'admin' + password: 'Password123!' + cg_snapshot_name: "ansible_snap_cg_1_1" + vol_snapshot_name: "ansible_snap_lun_4_2" + vol_name: "ansible_snap_lun_4" + cg_name: "ansible_snap_cg_1" + description: "Created using playbook" + new_description: "modified description using playbook" + host_name: "ansible_snap_host" + expiry_time: "04/15/2021 2:30" + new_expiry_time: "04/10/2021 2:30" + new_snapshot_name: "new_ansible_snap_lun_4_2" + + tasks: + - name: Create a Snapshot for a CG + register: result + dellemc.unity.snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + port: "{{ port }}" + cg_name: "{{ cg_name }}" + snapshot_name: "{{ cg_snapshot_name }}" + description: "{{ description }}" + auto_delete: false + state: "present" + + - name: Set snapshot id + ansible.builtin.set_fact: + cg_snapshot_id: "{{ result.snapshot_details.id }}" + + - name: Create a Snapshot for a CG Idempotency + dellemc.unity.snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + port: "{{ port }}" + cg_name: "{{ cg_name }}" + snapshot_name: "{{ cg_snapshot_name }}" + description: "{{ description }}" + auto_delete: false + state: "present" + + - name: Create a Snapshot for a LUN with Host attached. + register: result + dellemc.unity.snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + port: "{{ port }}" + vol_name: "{{ vol_name }}" + snapshot_name: "{{ vol_snapshot_name }}" + expiry_time: "{{ expiry_time }}" + description: "{{ description }}" + host_name: "{{ host_name }}" + host_state: "mapped" + state: "present" + + - name: Set snapshot id + ansible.builtin.set_fact: + vol_snapshot_id: "{{ result.snapshot_details.id }}" + + - name: Create a Snapshot for a LUN with Host attached Idempotency. + dellemc.unity.snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + port: "{{ port }}" + vol_name: "{{ vol_name }}" + snapshot_name: "{{ vol_snapshot_name }}" + expiry_time: "{{ expiry_time }}" + description: "{{ description }}" + host_name: "{{ host_name }}" + host_state: "mapped" + state: "present" + + - name: Unmap a host for a Snapshot using Id + dellemc.unity.snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + port: "{{ port }}" + snapshot_id: "{{ vol_snapshot_id }}" + host_name: "{{ host_name }}" + host_state: "unmapped" + state: "present" + + - name: Unmap a host for a Snapshot Idempotency case + dellemc.unity.snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + port: "{{ port }}" + snapshot_name: "{{ vol_snapshot_name }}" + host_name: "{{ host_name }}" + host_state: "unmapped" + state: "present" + + - name: Map snapshot to a host using Id + dellemc.unity.snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + port: "{{ port }}" + snapshot_id: "{{ vol_snapshot_id }}" + host_name: "{{ host_name }}" + host_state: "mapped" + state: "present" + + - name: Get Snapshot Details using Id + dellemc.unity.snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_id: "{{ cg_snapshot_id }}" + state: "present" + + - name: Update attributes of a Snapshot for a LUN using Id + dellemc.unity.snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_id: "{{ vol_snapshot_id }}" + new_snapshot_name: "{{ new_snapshot_name }}" + expiry_time: "{{ new_expiry_time }}" + description: "{{ new_description }}" + host_name: "{{ host_name }}" + host_state: "unmapped" + state: "present" + + - name: Update attributes of a Snapshot for a LUN Idempotency case + dellemc.unity.snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_name: "{{ new_snapshot_name }}" + expiry_time: "{{ new_expiry_time }}" + description: "{{ new_description }}" + host_name: "{{ host_name }}" + host_state: "unmapped" + state: "present" + + - name: Delete Snapshot of CG. + dellemc.unity.snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_name: "{{ cg_snapshot_name }}" + state: "absent" + + - name: Delete Snapshot of CG using Id Idempotency case. + dellemc.unity.snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_id: "{{ cg_snapshot_id }}" + state: "absent" + + - name: Delete Snapshot of volume. + dellemc.unity.snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_name: "{{ new_snapshot_name }}" + state: "absent" + + - name: Delete Snapshot of volume Idempotency. + dellemc.unity.snapshot: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + snapshot_name: "{{ new_snapshot_name }}" + state: "absent" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/snapshotschedule.yml b/ansible_collections/dellemc/unity/playbooks/modules/snapshotschedule.yml new file mode 100644 index 000000000..f2859a06a --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/snapshotschedule.yml @@ -0,0 +1,203 @@ +--- +- name: Snapshot schedule operations on Unity + hosts: localhost + connection: local + gather_facts: false + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'admin' + password: 'Password123!' + state_present: 'present' + state_absent: 'absent' + + tasks: + - name: Create snapshot schedule (Rule Type - every_n_hours) + register: result + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + name: "Ansible_Every_N_Hours_Testing" + type: "every_n_hours" + interval: 6 + desired_retention: 24 + state: "{{ state_present }}" + + - name: Set id + ansible.builtin.set_fact: + id: "{{ result.snapshot_schedule_details.id }}" + + - name: Create snapshot schedule (Rule Type - every_n_hours) - Idempotency + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + name: "Ansible_Every_N_Hours_Testing" + type: "every_n_hours" + interval: 6 + desired_retention: 24 + state: "{{ state_present }}" + + - name: Create snapshot schedule (Rule Type - every_day) + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + name: "Ansible_Every_Day_Testing" + type: "every_day" + hours_of_day: + - 8 + - 14 + auto_delete: true + state: "{{ state_present }}" + + - name: Create snapshot schedule (Rule Type - every_n_days) + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + name: "Ansible_Every_N_Day_Testing" + type: "every_n_days" + day_interval: 2 + desired_retention: 16 + retention_unit: "days" + state: "{{ state_present }}" + + - name: Create snapshot schedule (Rule Type - every_week) + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + name: "Ansible_Every_Week_Testing" + type: "every_week" + days_of_week: + - MONDAY + - FRIDAY + hour: 12 + minute: 30 + desired_retention: 200 + state: "{{ state_present }}" + + - name: Create snapshot schedule (Rule Type - every_month) + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + name: "Ansible_Every_Month_Testing" + type: "every_month" + day_of_month: 17 + auto_delete: true + state: "{{ state_present }}" + + - name: Get snapshot schedule details using name + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + name: "Ansible_Every_N_Hours_Testing" + state: "{{ state_present }}" + + - name: Get snapshot schedule details using id + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + id: "{{ id }}" + state: "{{ state_present }}" + + - name: Modify snapshot schedule details id + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + id: "{{ id }}" + type: "every_n_hours" + interval: 8 + state: "{{ state_present }}" + + - name: Modify snapshot schedule details id - Idempotency + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + id: "{{ id }}" + type: "every_n_hours" + interval: 8 + state: "{{ state_present }}" + + - name: Modify snapshot schedule using name + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + name: "Ansible_Every_Day_Testing" + type: "every_day" + desired_retention: 200 + auto_delete: false + state: "{{ state_present }}" + + - name: Delete snapshot schedule using id + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + id: "{{ id }}" + state: "{{ state_absent }}" + + - name: Delete snapshot schedule using name + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + name: "Ansible_Every_Day_Testing" + state: "{{ state_absent }}" + + - name: Delete snapshot schedule using name + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + name: "Ansible_Every_N_Day_Testing" + state: "{{ state_absent }}" + + - name: Delete snapshot schedule using name + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + name: "Ansible_Every_Week_Testing" + state: "{{ state_absent }}" + + - name: Delete snapshot schedule using name + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + name: "Ansible_Every_Month_Testing" + state: "{{ state_absent }}" + + - name: Delete snapshot schedule using name - Idempotency + dellemc.unity.snapshotschedule: + unispherehost: "{{ unispherehost }}" + validate_certs: "{{ validate_certs }}" + username: "{{ username }}" + password: "{{ password }}" + name: "Ansible_Every_Month_Testing" + state: "{{ state_absent }}" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/storagepool.yml b/ansible_collections/dellemc/unity/playbooks/modules/storagepool.yml new file mode 100644 index 000000000..a53328edc --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/storagepool.yml @@ -0,0 +1,185 @@ +--- +- name: Storage pool Module Operations on Unity + hosts: localhost + connection: local + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'user' + password: '**' + pool_name: "test_DND" + new_pool_name: "new_pool2" + fast_vp_enabled: "enabled" + fast_cache_enabled: "enabled" + pool_description: "updated" + disk_group_id: "dg_16" + disk_num: 2 + raid_type: "RAID10" + stripe_width: "BEST_FIT" + alert_threshold: 50 + is_harvest_enabled: true + pool_harvest_high_threshold: 59 + pool_harvest_low_threshold: 40 + is_snap_harvest_enabled: true + snap_harvest_high_threshold: 80 + snap_harvest_low_threshold: 60 + pool_type: "DYNAMIC" + + tasks: + - name: Get the details of Storage pool by name + dellemc.unity.storagepool: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + pool_name: "Test_Pool" + pool_description: "test pool" + raid_groups: + disk_group_id: "dg_36" + disk_num: 3 + raid_type: "RAID10" + stripe_width: "BEST_FIT" + alert_threshold: 50 + is_harvest_enabled: true + pool_harvest_high_threshold: 60 + pool_harvest_low_threshold: 40 + is_snap_harvest_enabled: true + snap_harvest_high_threshold: 70 + snap_harvest_low_threshold: 50 + fast_vp: "enabled" + fast_cache: "enabled" + pool_type: "DYNAMIC" + state: "present" + + - name: Get the details of Storage pool by name + register: result + dellemc.unity.storagepool: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + pool_name: "{{ pool_name }}" + state: "present" + + - name: Set storage pool id + ansible.builtin.set_fact: + pool_id: "{{ result.storage_pool_details.id }}" + + - name: Get the details of Storage pool by pool id + dellemc.unity.storagepool: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + pool_id: "{{ pool_id }}" + state: "present" + + - name: Rename Storage pool by name + dellemc.unity.storagepool: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + pool_name: "{{ pool_name }}" + new_pool_name: "{{ new_pool_name }}" + state: "present" + + - name: Update Storage pool description + dellemc.unity.storagepool: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + pool_name: "{{ new_pool_name }}" + pool_description: "{{ pool_description }}" + state: "present" + + - name: Update Storage pool description- Idempotent + dellemc.unity.storagepool: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + pool_name: "{{ new_pool_name }}" + pool_description: "{{ pool_description }}" + state: "present" + + - name: Update fast_vp by pool name + dellemc.unity.storagepool: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + pool_name: "{{ new_pool_name }}" + fast_vp: "{{ fast_vp_enabled }}" + state: "present" + + - name: Update fast_cache by pool name + dellemc.unity.storagepool: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + pool_name: "{{ new_pool_name }}" + fast_cache: "{{ fast_cache_enabled }}" + state: "present" + + - name: Rename Storage pool by name + dellemc.unity.storagepool: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + pool_name: "{{ new_pool_name }}" + new_pool_name: "{{ pool_name }}" + state: "present" + + - name: Create a Storage pool + dellemc.unity.storagepool: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + pool_name: "test_pool" + pool_description: "Unity test pool." + raid_groups: + disk_group_id: "{{ disk_group_id }}" + disk_num: "{{ disk_num }}" + raid_type: "{{ raid_type }}" + stripe_width: "{{ stripe_width }}" + alert_threshold: "{{ alert_threshold }}" + is_harvest_enabled: "{{ is_harvest_enabled }}" + pool_harvest_high_threshold: "{{ pool_harvest_high_threshold }}" + pool_harvest_low_threshold: "{{ pool_harvest_low_threshold }}" + is_snap_harvest_enabled: "{{ is_snap_harvest_enabled }}" + snap_harvest_high_threshold: "{{ snap_harvest_high_threshold }}" + snap_harvest_low_threshold: "{{ snap_harvest_low_threshold }}" + fast_vp: "{{ fast_vp_enabled }}" + fast_cache: "{{ fast_cache_enabled }}" + pool_type: "DYNAMIC" + state: "present" + + - name: Create a StoragePool - idempotency + dellemc.unity.storagepool: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + pool_name: "test_pool" + pool_description: "Unity test pool." + raid_groups: + disk_group_id: "{{ disk_group_id }}" + disk_num: "{{ disk_num }}" + raid_type: "{{ raid_type }}" + stripe_width: "{{ stripe_width }}" + alert_threshold: "{{ alert_threshold }}" + is_harvest_enabled: "{{ is_harvest_enabled }}" + pool_harvest_high_threshold: "{{ pool_harvest_high_threshold }}" + pool_harvest_low_threshold: "{{ pool_harvest_low_threshold }}" + is_snap_harvest_enabled: "{{ is_snap_harvest_enabled }}" + snap_harvest_high_threshold: "{{ snap_harvest_high_threshold }}" + snap_harvest_low_threshold: "{{ snap_harvest_low_threshold }}" + fast_vp: "{{ fast_vp_enabled }}" + fast_cache: "{{ fast_cache_enabled }}" + pool_type: "DYNAMIC" + state: "present" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/tree_quota.yml b/ansible_collections/dellemc/unity/playbooks/modules/tree_quota.yml new file mode 100644 index 000000000..1665ea118 --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/tree_quota.yml @@ -0,0 +1,138 @@ +--- +- name: Tree Quota Operations + hosts: localhost + connection: local + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'user' + password: '**' + filesystem_name: "SP_Filesystem_test" + filesystem_id: "fs_2279" + nas_server_name: "lglad068" + path: "/sample_quota" + soft_limit: 2 + state_present: "present" + state_absent: "absent" + + tasks: + - name: Create quota tree of filesystem + register: result + dellemc.unity.tree_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + path: "{{ path }}" + hard_limit: 2 + cap_unit: "TB" + description: "Sample quota tree" + state: "{{ state_present }}" + + - name: Set tree_quota_id + ansible.builtin.set_fact: + tree_quota_id: "{{ result.get_tree_quota_details.id }}" + + - name: Create quota tree of filesystem -- Idempotency + dellemc.unity.tree_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + path: "{{ path }}" + hard_limit: 2 + cap_unit: "TB" + description: "Sample quota tree" + state: "{{ state_present }}" + + - name: Get quota tree details by quota tree path + dellemc.unity.tree_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + path: "{{ path }}" + state: "{{ state_present }}" + + - name: Get quota tree details by quota tree id + dellemc.unity.tree_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + tree_quota_id: "{{ tree_quota_id }}" + state: "{{ state_present }}" + + - name: Modify quota tree of filesystem by quota tree path + dellemc.unity.tree_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + path: "{{ path }}" + soft_limit: "{{ soft_limit }}" + cap_unit: "TB" + description: "Sample quota tree modified" + state: "{{ state_present }}" + + - name: Modify quota tree of filesystem -- Idempotency + dellemc.unity.tree_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + path: "{{ path }}" + soft_limit: "{{ soft_limit }}" + cap_unit: "TB" + description: "Sample quota tree modified" + state: "{{ state_present }}" + + - name: Modify quota tree of filesystem by quota tree id + dellemc.unity.tree_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + tree_quota_id: "{{ tree_quota_id }}" + soft_limit: "{{ soft_limit }}" + cap_unit: "TB" + description: "Sample quota tree modified" + state: "{{ state_present }}" + + - name: Delete quota tree of filesystem by quota tree path + dellemc.unity.tree_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + path: "{{ path }}" + state: "{{ state_absent }}" + + - name: Delete quota tree of filesystem -- Idempotency + dellemc.unity.tree_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + path: "{{ path }}" + state: "{{ state_absent }}" + + - name: Delete quota tree of filesystem by quota tree id + dellemc.unity.tree_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + tree_quota_id: "treequota_171798700679_1" + state: "{{ state_absent }}" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/user_quota.yml b/ansible_collections/dellemc/unity/playbooks/modules/user_quota.yml new file mode 100644 index 000000000..350cf4f62 --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/user_quota.yml @@ -0,0 +1,255 @@ +--- +- name: User Quota Operations + hosts: localhost + connection: local + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'admin' + password: 'Password123!' + filesystem_name: "SP_Filesystem_test" + filesystem_id: "fs_2279" + nas_server_name: "lglad068" + user_name: "test2" + uid: "2" + tree_quota_id: "treequota_171798701972_1" + path: "/sample" + state_present: "present" + state_absent: "absent" + + tasks: + - name: Create user quota for a filesystem + register: result_user_quota + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + user_type: "Unix" + user_name: "{{ user_name }}" + soft_limit: "1" + cap_unit: "TB" + hard_limit: "2" + state: "{{ state_present }}" + + - name: Set user_quota_id + ansible.builtin.set_fact: + user_quota_id: "{{ result_user_quota.get_user_quota_details.id }}" + + - name: Create user quota for a filesystem -- Idempotency + register: result_user_quota + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + user_type: "Unix" + user_name: "{{ user_name }}" + soft_limit: "1" + cap_unit: "TB" + hard_limit: "2" + state: "{{ state_present }}" + + + - name: Get user quota details from user_name + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + user_name: "{{ user_name }}" + state: "{{ state_present }}" + + - name: Modify user quota through user_quota_id + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + soft_limit: "900" + hard_limit: "1000" + user_quota_id: "{{ user_quota_id }}" + state: "{{ state_present }}" + + + - name: Modify user quota through user_quota_id -- Idempotency + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + soft_limit: "900" + hard_limit: "1000" + user_quota_id: "{{ user_quota_id }}" + state: "{{ state_present }}" + + - name: Modify user quota details from uid + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + uid: "{{ uid }}" + soft_limit: "1" + cap_unit: "TB" + state: "{{ state_present }}" + + - name: Modify user quota details from uid -- Idempotency + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + uid: "{{ uid }}" + soft_limit: "1" + cap_unit: "TB" + state: "{{ state_present }}" + + - name: Delete user quota + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + user_name: "{{ user_name }}" + state: "{{ state_absent }}" + + - name: Delete user quota -- Idempotency + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_id: "{{ filesystem_id }}" + user_name: "{{ user_name }}" + state: "{{ state_absent }}" + + - name: Create user quota for a quota tree + register: result_user_quota + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + path: "{{ path }}" + user_type: "Unix" + user_name: "{{ user_name }}" + soft_limit: "1" + cap_unit: "TB" + hard_limit: "2" + state: "{{ state_present }}" + + - name: Set user_quota_id + ansible.builtin.set_fact: + user_quota_id: "{{ result_user_quota.get_user_quota_details.id }}" + + - name: Create user quota for a quota tree -- Idempotency + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + path: "{{ path }}" + user_type: "Unix" + user_name: "{{ user_name }}" + soft_limit: "1" + cap_unit: "TB" + hard_limit: "2" + state: "{{ state_present }}" + + - name: Modify user quota for a quota tree by path + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + path: "{{ path }}" + user_type: "Unix" + user_name: "{{ user_name }}" + soft_limit: "2" + cap_unit: "TB" + hard_limit: "2" + state: "{{ state_present }}" + + - name: Modify user quota for a quota tree by quota tree id + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + tree_quota_id: "{{ tree_quota_id }}" + user_type: "Unix" + user_name: "{{ user_name }}" + soft_limit: "800" + hard_limit: "900" + state: "{{ state_present }}" + + - name: Modify user quota for a quota tree by quota tree id -- Idempotency + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + tree_quota_id: "{{ tree_quota_id }}" + user_type: "Unix" + user_name: "{{ user_name }}" + soft_limit: "800" + hard_limit: "900" + state: "{{ state_present }}" + + - name: Delete user quota for a quota tree by quota tree id + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + tree_quota_id: "{{ tree_quota_id }}" + user_type: "Unix" + user_name: "{{ user_name }}" + state: "{{ state_absent }}" + + - name: Delete user quota for a quota tree by path + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + path: "{{ path }}" + user_type: "Unix" + user_name: "{{ user_name }}" + state: "{{ state_absent }}" + + - name: Delete user quota for a quota tree by path -- Idempotency + dellemc.unity.user_quota: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + filesystem_name: "{{ filesystem_name }}" + nas_server_name: "{{ nas_server_name }}" + path: "{{ path }}" + user_type: "Unix" + user_name: "{{ user_name }}" + state: "{{ state_absent }}" diff --git a/ansible_collections/dellemc/unity/playbooks/modules/volume.yml b/ansible_collections/dellemc/unity/playbooks/modules/volume.yml new file mode 100644 index 000000000..45f62c01f --- /dev/null +++ b/ansible_collections/dellemc/unity/playbooks/modules/volume.yml @@ -0,0 +1,241 @@ +--- +- name: Volume Operations + hosts: localhost + connection: local + vars: + unispherehost: '10.*.*.*' + validate_certs: false + username: 'user' + password: '**' + vol_name: "Ansible_vol1_test" + new_vol_name: "New_Ansible_vol1_test" + size: 2 + pool_name: "Ansible_Unity_SP_2" + cap_gb: "GB" + description: "Ansible demo" + snap_schedule: "Ansible_vol_snap_schedule1" + io_limit_policy: "Ansible_IO_limit1" + tiering_policy: "LOWEST" + is_thin: true + compression: true + sp: "SPA" + host_name: "10.*.*.*" + host_id: "Host_929" + vol_hosts: + - host_name: "10.*.*.*" + hlu: 1 + - host_id: "Host_929" + hlu: 3 + hlu: 2 + state_present: "present" + state_absent: "absent" + state_mapped: "mapped" + state_unmapped: "unmapped" + + tasks: + - name: Create Volume + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_name: "{{ vol_name }}" + description: "{{ description }}" + pool_name: "{{ pool_name }}" + size: "{{ size }}" + cap_unit: "{{ cap_gb }}" + tiering_policy: "{{ tiering_policy }}" + is_thin: true + compression: true + advanced_dedup: true + state: "{{ state_present }}" + register: vol_result + + - name: Create Volume - Idempotency + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_name: "{{ vol_name }}" + description: "{{ description }}" + pool_name: "{{ pool_name }}" + size: "{{ size }}" + cap_unit: "{{ cap_gb }}" + tiering_policy: "{{ tiering_policy }}" + is_thin: true + compression: true + advanced_dedup: true + state: "{{ state_present }}" + + - name: Set vol_id + ansible.builtin.set_fact: + vol_id: "{{ vol_result.volume_details.id }}" + + - name: Expand Volume by volume id + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_id: "{{ vol_id }}" + size: 5 + cap_unit: "{{ cap_gb }}" + state: "{{ state_present }}" + + - name: Modify Volume attributes + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_name: "{{ vol_name }}" + tiering_policy: "AUTOTIER" + snap_schedule: "{{ snap_schedule }}" + io_limit_policy: "{{ io_limit_policy }}" + is_thin: true + compression: true + advanced_dedup: true + state: "{{ state_present }}" + + - name: Modify Volume attributes - Idempotency + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_name: "{{ vol_name }}" + tiering_policy: "AUTOTIER" + snap_schedule: "{{ snap_schedule }}" + io_limit_policy: "{{ io_limit_policy }}" + is_thin: true + compression: true + advanced_dedup: true + state: "{{ state_present }}" + + - name: Remove snap_schedule from a Volume + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_name: "{{ vol_name }}" + snap_schedule: "" + state: "{{ state_present }}" + + - name: Map Host by host_name to Volume + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_id: "{{ vol_id }}" + host_name: "{{ host_name }}" + hlu: "{{ hlu }}" + mapping_state: "{{ state_mapped }}" + state: "{{ state_present }}" + + - name: Map Host by host_name to Volume- Idempotency + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_id: "{{ vol_id }}" + host_name: "{{ host_name }}" + hlu: 2 + mapping_state: "{{ state_mapped }}" + state: "{{ state_present }}" + + - name: Unmap Host by host_name from Volume + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_id: "{{ vol_id }}" + host_name: "{{ host_name }}" + mapping_state: "{{ state_unmapped }}" + state: "{{ state_present }}" + + - name: Unmap Host by host_name from Volume -Idempotency + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_id: "{{ vol_id }}" + host_name: "{{ host_name }}" + mapping_state: "{{ state_unmapped }}" + state: "{{ state_present }}" + + - name: Map Multiple Hosts to a Volume + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_id: "{{ vol_id }}" + hosts: "{{ vol_hosts }}" + mapping_state: "{{ state_mapped }}" + state: "{{ state_present }}" + + - name: Map Multiple Hosts to a Volume - Idempotency + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_id: "{{ vol_id }}" + hosts: "{{ vol_hosts }}" + mapping_state: "{{ state_mapped }}" + state: "{{ state_present }}" + + - name: Unmap Hosts from Volume + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_id: "{{ vol_id }}" + hosts: "{{ vol_hosts }}" + mapping_state: "{{ state_unmapped }}" + state: "{{ state_present }}" + + - name: Unmap Hosts from Volume - Idempotency + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_id: "{{ vol_id }}" + hosts: "{{ vol_hosts }}" + mapping_state: "{{ state_unmapped }}" + state: "{{ state_present }}" + + - name: Get details of volume using id + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_id: "{{ vol_id }}" + state: "present" + + - name: Delete a volume using id + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_id: "{{ vol_id }}" + state: "absent" + + - name: Delete a volume using id -Idempotency + dellemc.unity.volume: + unispherehost: "{{ unispherehost }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_id: "{{ vol_id }}" + state: "absent" -- cgit v1.2.3