summaryrefslogtreecommitdiffstats
path: root/ansible_collections/infinidat/infinibox/playbooks
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/infinidat/infinibox/playbooks')
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/configure_array.yml388
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_runtest.yml35
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_setup.yml17
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_teardown.yml35
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/inventory14
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_config_sample.yml63
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_create_map_cluster.yml101
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_create_metadata.yml813
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_create_network_spaces.yml21
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_create_resources.yml399
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_create_snapshots.yml47
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_create_volumes.yml93
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_notification_rules_sample.yml111
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_remove_map_cluster.yml65
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_remove_metadata.yml80
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_remove_network_spaces.yml14
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_remove_resources.yml118
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_remove_snapshots.yml17
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_remove_users_repository.yml80
-rw-r--r--ansible_collections/infinidat/infinibox/playbooks/test_remove_volumes.yml34
20 files changed, 2186 insertions, 359 deletions
diff --git a/ansible_collections/infinidat/infinibox/playbooks/configure_array.yml b/ansible_collections/infinidat/infinibox/playbooks/configure_array.yml
new file mode 100644
index 000000000..bee0899d1
--- /dev/null
+++ b/ansible_collections/infinidat/infinibox/playbooks/configure_array.yml
@@ -0,0 +1,388 @@
+---
+# PSDEV-1108: Create playbook automating cluster configuration mobility.
+# Create three volumes: vol_nonwriteable, vol_explicitly_writable and vol_writable.
+- name: Configure an Infinibox Array
+ hosts: localhost
+ gather_facts: false
+ # vars:
+ # - dataset_default_provisioning: THIN
+ # - use_base2_units: true
+ # - table_export_limit: 3000
+ # - admin_user_name: admin
+ # - admin_user_password: 123456
+ # - admin_user_email: dev.mgmt@infinidat.com
+ # - pool_admin_user_name: Commvault
+ # - pool_admin_user_password: 123456
+ # - pool_admin_user_email: dohlemacher@infinidat.com
+ # - ldap_name: PSUS_ANSIBLE_ad
+ # - setup_alerting_emails: ["dohlemacher@infinidat.com"]
+ # - prod_alerting_emails: ["dohlemacher@infinidat.com"]
+ # - alerting_event_levels: ["INFO", "WARNING", "ERROR", "CRITICAL"]
+ # - alerting_includes: []
+ # - alerting_excludes: ["EVENT_FLOOD", "USER_LOGIN_SUCCESS", "USER_LOGGED_OUT"]
+ # - syslogs: # A list of syslog dictionaries
+ # - target_name: syslog1_target
+ # rule_name: syslog1
+ # protocol: SYSLOG
+ # host: 172.31.88.158
+ # port: 514
+ # facility: LOCAL7
+ # transport: UDP
+ # post_test: true # Not a real test if using UDP
+ # - target_name: syslog2_target
+ # rule_name: syslog2
+ # protocol: SYSLOG
+ # host: 172.31.88.158
+ # port: 515
+ # facility: LOCAL7
+ # transport: UDP
+ # post_test: true
+ # - target_name: graylog_target
+ # rule_name: graylog
+ # protocol: SYSLOG
+ # host: 172.31.77.214
+ # port: 1514
+ # facility: LOCAL7
+ # transport: UDP
+ # post_test: true
+ tasks:
+ - name: Configuration
+ ansible.builtin.debug:
+ msg:
+ - "user: {{ user }}"
+ # - "password: {{ password }}"
+ - "system: {{ system }}"
+
+ - name: Pause
+ ansible.builtin.pause:
+ seconds: 2
+
+ - name: Create temporary setup email notification rule setup_email for addresses {{ setup_alerting_emails }}
+ infinidat.infinibox.infini_notification_rule:
+ name: "setup_email"
+ event_level: "{{ alerting_event_levels }}"
+ include_events: "{{ alerting_includes }}"
+ exclude_events: "{{ alerting_excludes }}"
+ recipients: "{{ setup_alerting_emails }}"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Temporarily remove production email notification rule for {{ prod_alerting_emails }}
+ infinidat.infinibox.infini_notification_rule:
+ name: "production_email"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Configure Single Sign On (SSO)
+ infinidat.infinibox.infini_sso:
+ issuer: http://www.okta.com/exkra32oyyU6KCUCk2p7
+ name: OKTA
+ sign_on_url: https://infinidat.okta.com/app/infinidat_ibox2503_1/exkrwdi7dmXSKdC4l2p7/sso/saml
+ signed_assertion: false
+ signed_response: false
+ signing_certificate: "{{ sso_signing_certificate }}"
+ enabled: true
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Stat Single Sign On (SSO)
+ infinidat.infinibox.infini_sso:
+ name: OKTA
+ state: stat
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: sso_stat
+
+ - name: Show sso_stat
+ ansible.builtin.debug:
+ var: sso_stat
+
+ - name: Enable compression
+ infinidat.infinibox.infini_config:
+ config_group: "mgmt"
+ key: "pool.compression_enabled_default"
+ value: true
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Set capacity units
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "ui-dataset-base2-units"
+ value: "{{ use_base2_units }}"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Set dataset default provisioning to {{ dataset_default_provisioning }}
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "ui-dataset-default-provisioning"
+ value: "{{ dataset_default_provisioning }}"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Configure Infinibox - Set maximum export rows to {{ table_export_limit }}
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "ui-table-export-limit"
+ value: "{{ table_export_limit }}"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Configure Infinibox - Setup Active Directory
+ infinidat.infinibox.infini_users_repository:
+ name: "{{ ldap_name }}"
+ bind_password: "tuFrAxahuYe4"
+ bind_username: "conldap"
+ ad_domain_name: "infinidat.com"
+ repository_type: "ActiveDirectory"
+ schema_group_class: "group"
+ schema_group_memberof_attribute: "memberof"
+ schema_group_name_attribute: "cn"
+ schema_groups_basedn: ""
+ schema_user_class: "user"
+ schema_username_attribute: "sAMAccountName"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Test user login using Active Directory credentials
+ infinidat.infinibox.infini_user:
+ user_name: "admin" # Must be an AD account, not local
+ user_password: "123456"
+ state: "login"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Configure 'CO-ReadOnly' LDAP user group
+ infinidat.infinibox.infini_user:
+ user_ldap_group_name: "CO-ReadOnly"
+ user_ldap_group_dn: "CN=Infinidat,OU=Security Groups,OU=Groups,OU=Corp,DC=infinidat,DC=com"
+ user_ldap_group_ldap: "{{ ldap_name }}"
+ user_ldap_group_role: "read_only"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ # - name: Configure 'CO-StorageAdmin' LDAP user group
+ # infinidat.infinibox.infini_user:
+ # user_ldap_group_name: "CO-StorageAdmin"
+ # user_ldap_group_dn: "CN=Infinidat,OU=Security Groups,OU=Groups,OU=Corp,DC=infinidat,DC=com"
+ # user_ldap_group_ldap: "{{ ldap_name }}"
+ # user_ldap_group_role: "admin"
+ # state: "present"
+ # user: "{{ user }}"
+ # password: "{{ password }}"
+ # system: "{{ system }}"
+
+ # - name: Configure 'ETS-CommVault' LDAP user group
+ # infinidat.infinibox.infini_user:
+ # user_ldap_group_name: "ETS-CommVault"
+ # user_ldap_group_dn: "CN=Infinidat,OU=Security Groups,OU=Groups,OU=Corp,DC=infinidat,DC=com"
+ # user_ldap_group_ldap: "{{ ldap_name }}"
+ # user_ldap_group_role: "pool_admin"
+ # user_group_pools: [ "pool-a", "pool-b", "pool-c" ]
+ # state: "present"
+ # user: "{{ user }}"
+ # password: "{{ password }}"
+ # system: "{{ system }}"
+
+ - name: Set up an admin user
+ infinidat.infinibox.infini_user:
+ user_name: "{{ admin_user_name }}"
+ user_email: "{{ admin_user_email }}"
+ user_password: "{{ admin_user_password }}"
+ user_role: "admin"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Remove existing syslog notification rules
+ # Rule removal is required since targets cannot be modified if there rules that use them
+ infinidat.infinibox.infini_notification_rule:
+ name: "{{ item.rule_name }}"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ loop:
+ "{{ syslogs }}"
+
+ - name: Create syslog notification targets
+ infinidat.infinibox.infini_notification_target:
+ state: "present"
+ name: "{{ item.target_name }}"
+ protocol: "{{ item.protocol }}"
+ host: "{{ item.host }}"
+ port: "{{ item.port }}"
+ facility: "{{ item.facility }}"
+ transport: "{{ item.transport }}"
+ post_test: "{{ item.post_test }}" # Force a dummy event for notification to be posted
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ loop:
+ "{{ syslogs }}"
+
+ - name: Create syslog notification rules
+ infinidat.infinibox.infini_notification_rule:
+ name: "{{ item.rule_name }}"
+ target: "{{ item.target_name }}"
+ event_level: "{{ alerting_event_levels }}"
+ include_events: "{{ alerting_includes }}"
+ exclude_events: "{{ alerting_excludes }}"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ loop:
+ "{{ syslogs }}"
+
+ - name: Remove replication network space named Replication
+ infinidat.infinibox.infini_network_space:
+ name: Replication
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Create replication network space named Replication
+ infinidat.infinibox.infini_network_space:
+ name: Replication
+ state: present
+ interfaces:
+ - 80
+ - 81
+ - 82
+ service: RMR_SERVICE
+ netmask: 16
+ network: 172.20.0.0
+ default_gateway: 172.20.95.254
+ # rate_limit: 8
+ # mtu: 1500
+ # async_only: true
+ ips: # IPs borrowed from https://labs.infinidat.com/gdc/systems/psus-vbox-aws44-1/ip/
+ - 172.20.50.111
+ - 172.20.50.70
+ - 172.20.49.243
+ - 172.20.49.241
+ - 172.20.49.239
+ - 172.20.49.237
+ - 172.20.49.235
+ - 172.20.49.233
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ # - name: TODO by David - Configure Infinimetrics - Add Infinibox
+ # ansible.builtin.debug:
+ # msg: (9) Add Infinibox to Infinimetrics
+
+ - name: Create pools
+ infinidat.infinibox.infini_pool:
+ name: "{{ item }}"
+ size: "{{ pool_size }}"
+ vsize: "{{ pool_size }}"
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ loop:
+ - pool-a
+ - pool-b
+ - pool-c
+
+ - name: Set up pool admin user for pool
+ infinidat.infinibox.infini_user:
+ user_name: "{{ pool_admin_user_name }}"
+ user_email: "{{ pool_admin_user_email }}"
+ user_password: "{{ pool_admin_user_password }}"
+ user_role: "pool_admin"
+ user_pool: "pool-a"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Update a fibre channel switch label
+ infinidat.infinibox.infini_fibre_channel_switch:
+ switch_name: VSAN 100
+ new_switch_name: Switch1000
+ state: "rename"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: switch_label_result
+ failed_when: > # WARNING: This should be removed if the array has FC configured
+ ("Cannot find switch" not in switch_label_result.msg)
+
+ - name: Install SSL certificate
+ infinidat.infinibox.infini_certificate:
+ certificate_file_name: /home/stack/workspace/ansible-infinidat-collection/signed-certificate-with-pkey.pem
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Pause for a short period since the SSL certificate was updated
+ ansible.builtin.pause:
+ seconds: 30
+
+ - name: Stat SSL certificate
+ infinidat.infinibox.infini_certificate:
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: cert_out
+
+ - name: Show SSL stat
+ ansible.builtin.debug:
+ msg: "{{ cert_out }}"
+
+ - name: Create production email notification rule production_email for addresses {{ prod_alerting_emails }}
+ infinidat.infinibox.infini_notification_rule:
+ name: "production_email"
+ event_level: "{{ alerting_event_levels }}"
+ include_events: "{{ alerting_includes }}"
+ exclude_events: "{{ alerting_excludes }}"
+ recipients: "{{ prod_alerting_emails }}"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Configure Infinibox - Post event that Infinibox configuration is complete
+ infinidat.infinibox.infini_event:
+ description_template: Infinibox {{ system }} configuration is complete
+ level: INFO
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Remove temporary setup email notification rule for {{ setup_alerting_emails }}
+ infinidat.infinibox.infini_notification_rule:
+ name: "setup_email"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
diff --git a/ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_runtest.yml b/ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_runtest.yml
index 54978a53e..58f6e3194 100644
--- a/ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_runtest.yml
+++ b/ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_runtest.yml
@@ -1,9 +1,8 @@
---
### Localhost
-- hosts: forensics
+- name: Run Infinisafe Demo
+ hosts: forensics
gather_facts: false
- collections:
- - infinidat.infinibox
vars:
network_space: InfiniSafe-Fenced-Network # iSCSI
service: ISCSI_SERVICE
@@ -17,8 +16,8 @@
ibox_iqn: iqn.2009-11.com.infinidat:storage:infinibox-sn-1521
tasks:
- - name: Create {{ service }} network space named {{ network_space }}
- infini_network_space:
+ - name: Create network space
+ infinidat.infinibox.infini_network_space:
name: "{{ network_space }}"
state: present
service: "{{ service }}"
@@ -44,8 +43,8 @@
system: "{{ system }}"
delegate_to: localhost
- - name: Create forensic host {{ host }}
- infini_host:
+ - name: Create forensic host
+ infinidat.infinibox.infini_host:
name: "{{ host }}"
state: present
@@ -54,8 +53,8 @@
system: "{{ system }}"
delegate_to: localhost
- - name: Map snapshot {{ snap }} to host {{ host }}
- infini_map:
+ - name: Map snapshot to host
+ infinidat.infinibox.infini_map:
host: "{{ host }}"
volume: "{{ snap }}"
state: present
@@ -65,8 +64,8 @@
system: "{{ system }}"
delegate_to: localhost
- - name: Add port to host {{ host }}
- infini_port:
+ - name: Add port to host
+ infinidat.infinibox.infini_port:
host: "{{ host }}"
iqns: "{{ host_iqn }}"
state: present
@@ -77,7 +76,7 @@
delegate_to: localhost
### Forensics Host
- - name: Connect forensics host {{ host }} to Infinibox {{ ibox }}
+ - name: Connect forensics host to Infinibox
ansible.builtin.shell: |
iscsiadm --mode discoverydb --type sendtargets --portal {{ ibox_portal }} --discover
iscsiadm --mode node --targetname={{ ibox_iqn }} --op update --name=node.session.auth.username --value={{ user }}
@@ -87,28 +86,28 @@
changed_when: false
become: true
- # Run forensic tests on snapshot {{ snap }}
- - name: Forensically test snapshot {{ snap }} is clean using host {{ host }}
+ # Run forensic tests on snapshot
+ - name: Forensically test snapshot is clean using host
ansible.builtin.shell: |
true
changed_when: false
register: is_snapshot_clean
### Localhost
- - name: debug
+ - name: Debug
ansible.builtin.debug:
msg: Snapshot {{ snap }} PASSED testing
when: is_snapshot_clean.rc == 0
delegate_to: localhost
- - name: debug
+ - name: Debug
ansible.builtin.debug:
msg: Snapshot {{ snap }} FAILED testing. Do not use this snapshot.
when: is_snapshot_clean.rc != 0
delegate_to: localhost
- - name: Restoring volume {{ volume }} from known clean snapshot {{ snap }}
- infini_vol:
+ - name: Restoring volume from known clean snapshot
+ infinidat.infinibox.infini_vol:
name: "{{ snap }}"
state: present
parent_volume_name: "{{ volume }}"
diff --git a/ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_setup.yml b/ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_setup.yml
index 5d58b9741..ae82f1d22 100644
--- a/ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_setup.yml
+++ b/ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_setup.yml
@@ -1,8 +1,7 @@
---
-- hosts: localhost
+- name: Setup for Infinisafe demo
+ hosts: localhost
gather_facts: true # Required for ansible_date_time
- collections:
- - infinidat.infinibox
vars:
network_space: InfiniSafe-Fenced-Network # iSCSI
service: ISCSI_SERVICE
@@ -13,8 +12,8 @@
host_iqn: iqn.1993-08.org.debian:01:62ebda3b76cc # io-wt-35
tasks:
- - name: Create pool {{ pool }}
- infini_pool:
+ - name: Create pool
+ infinidat.infinibox.infini_pool:
name: "{{ pool }}"
size: 1TB
vsize: 1TB
@@ -24,8 +23,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: Create volume {{ volume }} under pool {{ pool }}
- infini_vol:
+ - name: Create volume in pool
+ infinidat.infinibox.infini_vol:
name: "{{ volume }}"
size: 1GB
pool: "{{ pool }}"
@@ -35,8 +34,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: Create and lock (1 minute) snapshot {{ snap }} from volume {{ volume }}
- infini_vol:
+ - name: Create and lock (1 minute) snapshot from volume
+ infinidat.infinibox.infini_vol:
name: "{{ snap }}"
state: present
volume_type: snapshot
diff --git a/ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_teardown.yml b/ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_teardown.yml
index 6213f6c08..374916ce5 100644
--- a/ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_teardown.yml
+++ b/ansible_collections/infinidat/infinibox/playbooks/infinisafe_demo_teardown.yml
@@ -1,9 +1,8 @@
---
### Localhost
-- hosts: forensics
+- name: Teardown Infinisafe demo
+ hosts: forensics
gather_facts: false
- collections:
- - infinidat.infinibox
vars:
network_space: InfiniSafe-Fenced-Network # iSCSI
service: ISCSI_SERVICE
@@ -18,8 +17,8 @@
ibox_portals: 172.31.32.148 172.31.32.146 172.31.32.149 172.31.32.145 172.31.32.150 172.31.32.147
tasks:
- - name: Unmap snapshot {{ snap }} from host {{ host }}
- infini_map:
+ - name: Unmap snapshot from host
+ infinidat.infinibox.infini_map:
host: "{{ host }}"
volume: "{{ snap }}"
state: absent
@@ -29,8 +28,8 @@
system: "{{ system }}"
delegate_to: localhost
- - name: Remove port from host {{ host }}
- infini_port:
+ - name: Remove port from host
+ infinidat.infinibox.infini_port:
host: "{{ host }}"
iqns: "{{ host_iqn }}"
state: absent
@@ -41,7 +40,7 @@
delegate_to: localhost
### Forensics Host
- - name: Disconnect forensics host {{ host }} from Infinibox {{ ibox }}
+ - name: Disconnect forensics host from Infinibox
ansible.builtin.shell: |
for i in {{ ibox_portals }}; do
iscsiadm --mode node --target {{ ibox_iqn }} -p $i --logout
@@ -53,8 +52,8 @@
become: true
### Localhost
- - name: Remove network space named {{ network_space }}
- infini_network_space:
+ - name: Remove network space
+ infinidat.infinibox.infini_network_space:
name: "{{ network_space }}"
state: absent
@@ -63,8 +62,8 @@
system: "{{ system }}"
delegate_to: localhost
- - name: Remove snapshot {{ snap }} created from volume {{ volume }}
- infini_vol:
+ - name: Remove snapshot created from volume
+ infinidat.infinibox.infini_vol:
name: "{{ snap }}"
state: absent
@@ -73,8 +72,8 @@
system: "{{ system }}"
delegate_to: localhost
- - name: Remove volume {{ volume }} under pool {{ pool }}
- infini_vol:
+ - name: Remove volume from pool
+ infinidat.infinibox.infini_vol:
name: "{{ volume }}"
pool: "{{ pool }}"
state: absent
@@ -84,8 +83,8 @@
system: "{{ system }}"
delegate_to: localhost
- - name: Remove pool {{ pool }}
- infini_pool:
+ - name: Remove pool
+ infinidat.infinibox.infini_pool:
name: "{{ pool }}"
state: absent
@@ -94,8 +93,8 @@
system: "{{ system }}"
delegate_to: localhost
- - name: Remove forensic host {{ host }}
- infini_host:
+ - name: Remove forensic host
+ infinidat.infinibox.infini_host:
name: "{{ host }}"
state: absent
diff --git a/ansible_collections/infinidat/infinibox/playbooks/inventory b/ansible_collections/infinidat/infinibox/playbooks/inventory
index 15954ef41..bdf610702 100644
--- a/ansible_collections/infinidat/infinibox/playbooks/inventory
+++ b/ansible_collections/infinidat/infinibox/playbooks/inventory
@@ -1,2 +1,16 @@
+#[all]
+#ansible_python_interpreter: "~/workspace/ansible-infinidat-collection/venv/bin/python"
+
[forensics]
io-wt-35.lab.wt.us.infinidat.com ansible_python_interpreter=python3.8
+
+[testers]
+# Defined in /etc/hosts
+exng-centos8 # 172.31.88.153
+exng-jammy # 172.31.88.177
+
+[tester_centos]
+exng-centos8 # 172.31.88.153
+
+[tester_jammy]
+exng-jammy # 172.31.88.177
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_config_sample.yml b/ansible_collections/infinidat/infinibox/playbooks/test_config_sample.yml
new file mode 100644
index 000000000..7159c61a3
--- /dev/null
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_config_sample.yml
@@ -0,0 +1,63 @@
+---
+# PSDEV-1108: Playbook for testing creation of metadata resources.
+- name: Test infini_config module
+ hosts: localhost
+ gather_facts: false # Required for ansible_date_time
+ tasks:
+
+ # Test any object_type
+
+ - name: Set compression setting to true
+ infinidat.infinibox.infini_config:
+ config_group: "mgmt"
+ key: "pool.compression_enabled_default"
+ value: false
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ - name: Debug
+ ansible.builtin.debug:
+ var: metadata_out
+
+ - name: Check current compression setting
+ infinidat.infinibox.infini_config:
+ config_group: "mgmt"
+ key: "pool.compression_enabled_default"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ - name: Debug
+ ansible.builtin.debug:
+ var: metadata_out
+
+
+ - name: Check 2 base
+ infinidat.infinibox.infini_config:
+ config_group: "mgmt"
+ key: "mgmt.is_decimal_capacity_converter" # True for Base 10, False for Base 2
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ - name: Debug
+ ansible.builtin.debug:
+ var: metadata_out
+
+ - name: Set Dataset capacity unit to Base 2
+ infinidat.infinibox.infini_config:
+ config_group: "mgmt"
+ key: "mgmt.is_decimal_capacity_converter" # True for Base 10, False for Base 2
+ value: false
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ - name: Debug
+ ansible.builtin.debug:
+ var: metadata_out
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_create_map_cluster.yml b/ansible_collections/infinidat/infinibox/playbooks/test_create_map_cluster.yml
index cf807fcbb..84c2fed4e 100644
--- a/ansible_collections/infinidat/infinibox/playbooks/test_create_map_cluster.yml
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_create_map_cluster.yml
@@ -1,12 +1,11 @@
---
-- hosts: localhost
+- name: Test infini_map module
+ hosts: localhost
gather_facts: false
- collections:
- - infinidat.infinibox
tasks:
- - name: NEGATIVE test -> Map volume {{ auto_prefix }}vol specifying both a cluster and a host
- infini_map:
+ - name: NEGATIVE test -> Map volume specifying both a cluster and a host
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host1"
cluster: "{{ auto_prefix }}cluster"
volume: "{{ auto_prefix }}vol"
@@ -19,8 +18,8 @@
- '"both to be provided" not in result.msg'
- not result.failed
- - name: NEGATIVE test -> Unmap volume {{ auto_prefix }}vol specifying both a cluster and a host
- infini_map:
+ - name: NEGATIVE test -> Unmap volume specifying both a cluster and a host
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host1"
cluster: "{{ auto_prefix }}cluster"
volume: "{{ auto_prefix }}vol"
@@ -33,8 +32,8 @@
- '"both to be provided" not in result.msg'
- not result.failed
- - name: NEGATIVE test -> Stat volume {{ auto_prefix }}vol specifying both a cluster and a host
- infini_map:
+ - name: NEGATIVE test -> Stat volume specifying both a cluster and a host
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host1"
cluster: "{{ auto_prefix }}cluster"
volume: "{{ auto_prefix }}vol"
@@ -47,8 +46,8 @@
- '"both to be provided" not in result.msg'
- not result.failed
- - name: POSITIVE test -> Create pool {{ auto_prefix }}pool
- infini_pool:
+ - name: POSITIVE test -> Create pool
+ infinidat.infinibox.infini_pool:
name: "{{ auto_prefix }}pool"
size: 1TB
vsize: 1TB
@@ -57,8 +56,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Create thin volume {{ auto_prefix }}vol under pool {{ auto_prefix }}pool
- infini_vol:
+ - name: POSITIVE test -> Create thin volume
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -67,32 +66,32 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Create host {{ auto_prefix }}host1 for cluster mapping
- infini_host:
+ - name: POSITIVE test -> Create host for cluster mapping
+ infinidat.infinibox.infini_host:
name: "{{ auto_prefix }}host1"
state: present
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Create host {{ auto_prefix }}host2 for cluster mapping
- infini_host:
+ - name: POSITIVE test -> Create host for cluster mapping
+ infinidat.infinibox.infini_host:
name: "{{ auto_prefix }}host2"
state: present
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Create host {{ auto_prefix }}host3 for host mapping
- infini_host:
+ - name: POSITIVE test -> Create host for host mapping
+ infinidat.infinibox.infini_host:
name: "{{ auto_prefix }}host3"
state: present
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Create cluster {{ auto_prefix }}cluster with hosts 1 and 2 for cluster mapping
- infini_cluster:
+ - name: POSITIVE test -> Create cluster with hosts for cluster mapping
+ infinidat.infinibox.infini_cluster:
name: "{{ auto_prefix }}cluster"
cluster_hosts:
- host_name: "{{ auto_prefix }}host1"
@@ -104,8 +103,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Map volume {{ auto_prefix }}vol to cluster {{ auto_prefix }}cluster
- infini_map:
+ - name: POSITIVE test -> Map volume to cluster
+ infinidat.infinibox.infini_map:
cluster: "{{ auto_prefix }}cluster"
volume: "{{ auto_prefix }}vol"
state: present
@@ -113,8 +112,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: IDEMPOTENT test -> Map volume {{ auto_prefix }}vol to cluster {{ auto_prefix }}cluster again
- infini_map:
+ - name: IDEMPOTENT test -> Map volume to cluster again
+ infinidat.infinibox.infini_map:
cluster: "{{ auto_prefix }}cluster"
volume: "{{ auto_prefix }}vol"
state: present
@@ -126,8 +125,8 @@
- '"already exists using" not in result.msg'
- result.changed
- - name: POSITIVE test -> Stat map of volume {{ auto_prefix }}vol to cluster {{ auto_prefix }}cluster
- infini_map:
+ - name: POSITIVE test -> Stat map of volume to cluster
+ infinidat.infinibox.infini_map:
cluster: "{{ auto_prefix }}cluster"
volume: "{{ auto_prefix }}vol"
state: stat
@@ -140,8 +139,8 @@
ansible.builtin.debug:
msg: "Map stat: {{ cluster_stat }}"
- - name: POSITIVE test -> Map volume {{ auto_prefix }}vol to host {{ auto_prefix }}host3
- infini_map:
+ - name: POSITIVE test -> Map volume to host
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host3"
volume: "{{ auto_prefix }}vol"
state: present
@@ -149,8 +148,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: IDEMPOTENT test -> Map volume {{ auto_prefix }}vol to host {{ auto_prefix }}host3 again
- infini_map:
+ - name: IDEMPOTENT test -> Map volume to host again
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host3"
volume: "{{ auto_prefix }}vol"
state: present
@@ -162,8 +161,8 @@
- '"already exists using" not in result.msg'
- result.changed
- - name: POSITIVE test -> Stat map of volume {{ auto_prefix }}vol to host {{ auto_prefix }}host3
- infini_map:
+ - name: POSITIVE test -> Stat map of volume to host
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host3"
volume: "{{ auto_prefix }}vol"
state: stat
@@ -177,8 +176,8 @@
msg: "Map stat: {{ host_stat }}"
# Since the host is in the cluster and the volume is already mapped to the cluster, mapping the volume to the host becomes a NOOP.
- - name: IDEMPOTENT test -> Map volume {{ auto_prefix }}vol to host {{ auto_prefix }}host1 which is also in {{ auto_prefix }}cluster
- infini_map:
+ - name: IDEMPOTENT test -> Map volume to host which is also in cluster
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host1"
volume: "{{ auto_prefix }}vol"
state: present
@@ -191,8 +190,8 @@
- result.changed
### Test mapping of volume to a host using specified lun.
- - name: NEGATIVE test -> Map volume {{ auto_prefix }}vol to host {{ auto_prefix }}host3 again using lun 99 when already mapped
- infini_map:
+ - name: NEGATIVE test -> Map volume to host again using lun 99 when already mapped
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host3"
volume: "{{ auto_prefix }}vol"
lun: 99
@@ -205,8 +204,8 @@
- '"Cannot change the lun" not in new_lun_fail.msg'
- result.changed
- - name: POSITIVE test -> Unmap volume {{ auto_prefix }}vol from host {{ auto_prefix }}host3
- infini_map:
+ - name: POSITIVE test -> Unmap volume from host
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host3"
volume: "{{ auto_prefix }}vol"
state: absent
@@ -214,8 +213,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Map volume {{ auto_prefix }}vol to host {{ auto_prefix }}host3 using lun 99 when not already mapped
- infini_map:
+ - name: POSITIVE test -> Map volume to host using lun 99 when not already mapped
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host3"
volume: "{{ auto_prefix }}vol"
lun: 99
@@ -224,8 +223,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Stat map of volume {{ auto_prefix }}vol to host {{ auto_prefix }}host3 to check lun 99 used
- infini_map:
+ - name: POSITIVE test -> Stat map of volume to host to check lun 99 used
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host3"
volume: "{{ auto_prefix }}vol"
state: stat
@@ -243,8 +242,8 @@
### End test mapping of volume to a host using specified lun.
### Test mapping of volume to a cluster using specified lun.
- - name: NEGATIVE test -> Map volume {{ auto_prefix }}vol to cluster {{ auto_prefix }}cluster again using lun 98 when already mapped
- infini_map:
+ - name: NEGATIVE test -> Map volume to cluster again using lun 98 when already mapped
+ infinidat.infinibox.infini_map:
cluster: "{{ auto_prefix }}cluster"
volume: "{{ auto_prefix }}vol"
lun: 98
@@ -257,8 +256,8 @@
- '"Cannot change the lun" not in new_lun_fail.msg'
- result.changed
- - name: POSITIVE test -> Unmap volume {{ auto_prefix }}vol from cluster {{ auto_prefix }}cluster
- infini_map:
+ - name: POSITIVE test -> Unmap volume from cluster
+ infinidat.infinibox.infini_map:
cluster: "{{ auto_prefix }}cluster"
volume: "{{ auto_prefix }}vol"
state: absent
@@ -266,8 +265,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Map volume {{ auto_prefix }}vol to cluster {{ auto_prefix }}cluster using lun 98 when not already mapped
- infini_map:
+ - name: POSITIVE test -> Map volume to cluster using lun 98 when not already mapped
+ infinidat.infinibox.infini_map:
cluster: "{{ auto_prefix }}cluster"
volume: "{{ auto_prefix }}vol"
lun: 98
@@ -276,8 +275,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Stat map of volume {{ auto_prefix }}vol to cluster {{ auto_prefix }}cluster to check lun 98 used
- infini_map:
+ - name: POSITIVE test -> Stat map of volume to cluster to check lun 98 used
+ infinidat.infinibox.infini_map:
cluster: "{{ auto_prefix }}cluster"
volume: "{{ auto_prefix }}vol"
state: stat
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_create_metadata.yml b/ansible_collections/infinidat/infinibox/playbooks/test_create_metadata.yml
new file mode 100644
index 000000000..3ba928321
--- /dev/null
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_create_metadata.yml
@@ -0,0 +1,813 @@
+---
+# PSDEV-1108: Playbook for testing creation of metadata resources.
+- name: Test infini_metadata module
+ hosts: localhost
+ gather_facts: false # Required for ansible_date_time
+ tasks:
+
+ # Test any object_type
+
+ - name: NEGATIVE test -> Attempt to create a volume metadata key without providing a value
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol"
+ object_name: "foo"
+ key: "foo"
+ # value: "bar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Cannot create a' not in metadata_out.msg"
+ - "'without providing a value' not in metadata_out.msg"
+
+ - name: NEGATIVE test -> Attempt to create a system metadata key while incorrectly providing an object_name
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ object_name: "foo" # Error
+ key: "foo"
+ value: "bar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'object_name for object_type system must not be provided' not in metadata_out.msg"
+
+ - name: NEGATIVE test -> Attempt to create a volume metadata key without providing a object_name
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol"
+ # object_name: "foo"
+ key: "foo"
+ value: "bar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'The name of the vol must be provided as object_name' not in metadata_out.msg"
+
+ # Test pool object_type
+
+ - name: SETUP test -> Delete pool to clear any metadata
+ infinidat.infinibox.infini_pool:
+ name: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: SETUP test -> Create pool
+ infinidat.infinibox.infini_pool:
+ name: "{{ auto_prefix }}pool"
+ size: "{{ pool_size }}"
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: NEGATIVE test -> Get pool's nonexistent metadata key named poolfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "pool"
+ object_name: "{{ auto_prefix }}pool"
+ key: "poolfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Cannot find pool metadata key' not in metadata_out.msg"
+
+ - name: POSITIVE test -> Create metadata for pool with key named poolfoo with value poolbar
+ infinidat.infinibox.infini_metadata:
+ object_type: "pool"
+ object_name: "{{ auto_prefix }}pool"
+ key: "poolfoo"
+ value: "poolbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: IDEMPOTENT test -> Create metadata for pool with key named poolfoo with value poolbar again
+ infinidat.infinibox.infini_metadata:
+ object_type: "pool"
+ object_name: "{{ auto_prefix }}pool"
+ key: "poolfoo"
+ value: "poolbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Stat metadata pool key named poolfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "pool"
+ object_name: "{{ auto_prefix }}pool"
+ key: "poolfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "metadata_out['value'] != 'poolbar' or metadata_out['changed'] != false"
+
+ - name: POSITIVE test -> Delete metadata pool key named poolfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "pool"
+ object_name: "{{ auto_prefix }}pool"
+ key: "poolfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: IDEMPOTENT test -> Delete metadata pool key named poolfoo again
+ infinidat.infinibox.infini_metadata:
+ object_type: "pool"
+ object_name: "{{ auto_prefix }}pool"
+ key: "poolfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: NEGATIVE test -> Stat nonexistent metadata pool key named poolfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "pool"
+ object_name: "{{ auto_prefix }}pool"
+ key: "poolfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Cannot find pool metadata key' not in metadata_out.msg"
+
+ # Test vol object_type
+
+ - name: SETUP test -> Delete volume in pool to clear any metadata
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}vol"
+ pool: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: SETUP test -> Create volume in pool
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}vol"
+ pool: "{{ auto_prefix }}pool"
+ size: 1 GB
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: NEGATIVE test -> Get volume's nonexistent metadata key named volfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol"
+ object_name: "{{ auto_prefix }}vol"
+ key: "volfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Cannot find vol metadata key' not in metadata_out.msg"
+
+ - name: POSITIVE test -> Create metadata for volume with key named volfoo with value volbar
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol"
+ object_name: "{{ auto_prefix }}vol"
+ key: "volfoo"
+ value: "volbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: IDEMPOTENT test -> Create metadata for volume with key named volfoo with value volbar again
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol"
+ object_name: "{{ auto_prefix }}vol"
+ key: "volfoo"
+ value: "volbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Stat metadata volume key named volfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol"
+ object_name: "{{ auto_prefix }}vol"
+ key: "volfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "metadata_out['value'] != 'volbar' or metadata_out['changed'] != false"
+
+ - name: POSITIVE test -> Delete metadata volume key named volfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol"
+ object_name: "{{ auto_prefix }}vol"
+ key: "volfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: IDEMPOTENT test -> Delete metadata volume key named volfoo again
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol"
+ object_name: "{{ auto_prefix }}vol"
+ key: "volfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: NEGATIVE test -> Stat nonexistent metadata volume key named volfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol"
+ object_name: "{{ auto_prefix }}vol"
+ key: "volfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Cannot find vol metadata key' not in metadata_out.msg"
+
+ # Test vol-snap object_type
+
+ - name: SETUP test -> Delete volume snapshot in pool to clear any metadata
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}volsnap"
+ pool: "{{ auto_prefix }}pool"
+ volume_type: "snapshot"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: NEGATIVE test -> Stat nonexistent metadata volume snapshot key named volsnapfoo when snapshot does not exist
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol-snap"
+ object_name: "{{ auto_prefix }}volsnap"
+ key: "volsnapfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Volume snapshot named' not in metadata_out.msg or 'not found' not in metadata_out.msg"
+
+ - name: SETUP test -> Create volume in pool
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}vol"
+ pool: "{{ auto_prefix }}pool"
+ size: 1 GB
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: SETUP test -> Create volume snapshot in pool
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}volsnap"
+ volume_type: "snapshot"
+ parent_volume_name: "{{ auto_prefix }}vol"
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: NEGATIVE test -> Get volume snapshot's nonexistent metadata key named volsnapfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol-snap"
+ object_name: "{{ auto_prefix }}volsnap"
+ key: "volsnapfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Cannot find vol-snap metadata key' not in metadata_out.msg"
+
+ - name: POSITIVE test -> Create metadata for volume snapshot with key named volsnapfoo with value volsnapbar
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol-snap"
+ object_name: "{{ auto_prefix }}volsnap"
+ key: "volsnapfoo"
+ value: "volsnapbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: IDEMPOTENT test -> Create metadata for volume snapshot with key named volsnapfoo with value volsnapbar again
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol-snap"
+ object_name: "{{ auto_prefix }}volsnap"
+ key: "volsnapfoo"
+ value: "volsnapbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Stat metadata volume snapshot key named volsnapfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol-snap"
+ object_name: "{{ auto_prefix }}volsnap"
+ key: "volsnapfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "metadata_out['value'] != 'volsnapbar' or metadata_out['changed'] != false"
+
+ - name: POSITIVE test -> Delete metadata volume snapshot key named volsnapfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol-snap"
+ object_name: "{{ auto_prefix }}volsnap"
+ key: "volsnapfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: IDEMPOTENT test -> Delete metadata volume snapshot key named volsnapfoo again
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol-snap"
+ object_name: "{{ auto_prefix }}volsnap"
+ key: "volsnapfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: NEGATIVE test -> Stat nonexistent metadata volume snapshot key named volsnapfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol-snap"
+ object_name: "{{ auto_prefix }}volsnap"
+ key: "volsnapfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Cannot find vol-snap metadata key' not in metadata_out.msg"
+
+ # Test system object_type
+
+ - name: NEGATIVE test -> Attempt to set system metadata key ui-dataset-base2-units to something other than an boolean
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "ui-dataset-base2-units"
+ value: "bar" # Should be a boolean
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Value must be able to be decoded as a boolean' not in metadata_out.msg"
+
+ - name: POSITIVE test -> Delete metadata system key named sysfoo to clear any metadata
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "sysfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: NEGATIVE test -> Get nonexistent system metadata key named sysfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "sysfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Metadata for system with key sysfoo not found' not in metadata_out.msg"
+
+ - name: POSITIVE test -> Create metadata system key named sysfoo with value sysbar
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "sysfoo"
+ value: "sysbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: IDEMPOTENT test -> Create metadata system key named sysfoo with value sysbar again
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "sysfoo"
+ value: "sysbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Stat metadata system key named sysfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "sysfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+
+ - name: POSITIVE test -> Delete metadata system key named sysfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "sysfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: IDEMPOTENT test -> Delete metadata system key named sysfoo again
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "sysfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Stat metadata system key named ui-dataset-default-provisioning
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "ui-dataset-default-provisioning"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Create metadata system key named ui-dataset-default-provisioning with value THICK
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "ui-dataset-default-provisioning"
+ value: "THICK"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Stat metadata system key named ui-dataset-default-provisioning
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "ui-dataset-default-provisioning"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'THICK' != metadata_out['value']"
+
+ - name: POSITIVE test -> Create metadata system key named ui-dataset-default-provisioning with value THIN
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "ui-dataset-default-provisioning"
+ value: "THIN"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Negative test -> Attempt to create metadata system key named ui-dataset-default-provisioning with value invalid_value
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "ui-dataset-default-provisioning"
+ value: "invalid_value"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Cannot create system metadata' not in metadata_out.msg"
+
+ - name: POSITIVE test -> Create metadata system key named ui-table-export-limit with value 2000
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "ui-table-export-limit"
+ value: 2000
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: NEGATIVE test -> Attempt to create metadata system key named ui-table-export-limit with value invalid_value
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "ui-table-export-limit"
+ value: "invalid_value"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Value must be of type integer' not in metadata_out.msg"
+
+
+ # Test fs object_type
+
+ - name: SETUP test -> Delete fs to clear any metadata
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fs"
+ pool: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: SETUP test -> Create fs
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fs"
+ pool: "{{ auto_prefix }}pool"
+ size: 1 GB
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: NEGATIVE test -> Get fs's nonexistent metadata key named fsfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "fs"
+ object_name: "{{ auto_prefix }}fs"
+ key: "fsfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Cannot find fs metadata key' not in metadata_out.msg"
+
+ - name: POSITIVE test -> Create fs's metadata key named fsfoo with value fsbar
+ infinidat.infinibox.infini_metadata:
+ object_type: "fs"
+ object_name: "{{ auto_prefix }}fs"
+ key: "fsfoo"
+ value: "fsbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: IDEMPOTENT test -> Create fs's metadata key named fsfoo again
+ infinidat.infinibox.infini_metadata:
+ object_type: "fs"
+ object_name: "{{ auto_prefix }}fs"
+ key: "fsfoo"
+ value: "fsbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ # Test fs-snap object_type
+
+ - name: SETUP test -> Delete fs snapshot to clear any metadata
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fssnap"
+ pool: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: NEGATIVE test -> Create fs snapshot but use default fs_type, master, with a parent_fs_name
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fssnap"
+ pool: "{{ auto_prefix }}pool"
+ parent_fs_name: "{{ auto_prefix }}fs"
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'parent_fs_name should not be specified if fs_type is' not in metadata_out.msg"
+
+ - name: SETUP test -> Create fs snapshot
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fssnap"
+ pool: "{{ auto_prefix }}pool"
+ fs_type: "snapshot"
+ parent_fs_name: "{{ auto_prefix }}fs"
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: NEGATIVE test -> Get fs snapshot's nonexistent metadata key named fssnapfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "fs-snap"
+ object_name: "{{ auto_prefix }}fssnap"
+ key: "fssnapfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Cannot find fs-snap metadata key' not in metadata_out.msg"
+
+ - name: POSITIVE test -> Create fs snapshot's metadata key named fssnapfoo with value fssnapbar
+ infinidat.infinibox.infini_metadata:
+ object_type: "fs-snap"
+ object_name: "{{ auto_prefix }}fssnap"
+ key: "fssnapfoo"
+ value: "fssnapbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: IDEMPOTENT test -> Create fs snapshot's metadata key named fssnapfoo with value fssnapbar again
+ infinidat.infinibox.infini_metadata:
+ object_type: "fs-snap"
+ object_name: "{{ auto_prefix }}fssnap"
+ key: "fssnapfoo"
+ value: "fssnapbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ # Test cluster object_type
+
+ - name: SETUP test -> Delete cluster to clear any metadata
+ infinidat.infinibox.infini_cluster:
+ name: "{{ auto_prefix }}cluster"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: SETUP test -> Create cluster
+ infinidat.infinibox.infini_cluster:
+ name: "{{ auto_prefix }}cluster"
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: NEGATIVE test -> Get cluster's nonexistent metadata key named clusterfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "cluster"
+ object_name: "{{ auto_prefix }}cluster"
+ key: "clusterfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Cannot find cluster metadata key' not in metadata_out.msg"
+
+ - name: POSITIVE test -> Create cluster's metadata key named clusterfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "cluster"
+ object_name: "{{ auto_prefix }}cluster"
+ key: "clusterfoo"
+ value: "clusterbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: IDEMPOTENT test -> Create cluster's metadata key named clusterfoo again
+ infinidat.infinibox.infini_metadata:
+ object_type: "cluster"
+ object_name: "{{ auto_prefix }}cluster"
+ key: "clusterfoo"
+ value: "clusterbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Delete cluster's metadata key named clusterfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "cluster"
+ object_name: "{{ auto_prefix }}cluster"
+ key: "clusterfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: IDEMPOTENT test -> Delete cluster's metadata key named clusterfoo again
+ infinidat.infinibox.infini_metadata:
+ object_type: "cluster"
+ object_name: "{{ auto_prefix }}cluster"
+ key: "clusterfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ # Test host object_type
+
+ - name: SETUP test -> Delete host to clear any metadata
+ infinidat.infinibox.infini_host:
+ name: "{{ auto_prefix }}host"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: SETUP test -> Create host
+ infinidat.infinibox.infini_host:
+ name: "{{ auto_prefix }}host"
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: NEGATIVE test -> Get host's nonexistent metadata key named hostfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "host"
+ object_name: "{{ auto_prefix }}host"
+ key: "hostfoo"
+ state: "stat"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+ failed_when:
+ - "'Cannot find host metadata key' not in metadata_out.msg"
+
+ - name: POSITIVE test -> Create host's metadata key named hostfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "host"
+ object_name: "{{ auto_prefix }}host"
+ key: "hostfoo"
+ value: "hostbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: IDEMPOTENT test -> Create host's metadata key named hostfoo again
+ infinidat.infinibox.infini_metadata:
+ object_type: "host"
+ object_name: "{{ auto_prefix }}host"
+ key: "hostfoo"
+ value: "hostbar"
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Delete host's metadata key named hostfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "host"
+ object_name: "{{ auto_prefix }}host"
+ key: "hostfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: IDEMPOTENT test -> Delete host's metadata key named hostfoo again
+ infinidat.infinibox.infini_metadata:
+ object_type: "host"
+ object_name: "{{ auto_prefix }}host"
+ key: "hostfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_create_network_spaces.yml b/ansible_collections/infinidat/infinibox/playbooks/test_create_network_spaces.yml
index b8bced550..16c880bfd 100644
--- a/ansible_collections/infinidat/infinibox/playbooks/test_create_network_spaces.yml
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_create_network_spaces.yml
@@ -1,16 +1,15 @@
---
-- hosts: localhost
+- name: Test infini_network_space module
+ hosts: localhost
gather_facts: false
- collections:
- - infinidat.infinibox
vars:
- name: iSCSI
+ service_name: iSCSI
service: ISCSI_SERVICE
tasks:
- - name: POSITIVE test -> Create {{ service }} network space named {{ name }}
- infini_network_space:
- name: "{{ name }}"
+ - name: POSITIVE test -> Create network space
+ infinidat.infinibox.infini_network_space:
+ name: "{{ service_name }}"
state: present
interfaces:
- 1680
@@ -34,13 +33,13 @@
system: "{{ system }}"
register: create_out
- - name: debug
+ - name: Debug
ansible.builtin.debug:
var: create_out
- - name: POSITIVE test -> Stat {{ service }} network space named {{ name }}
- infini_network_space:
- name: "{{ name }}"
+ - name: POSITIVE test -> Stat network space named
+ infinidat.infinibox.infini_network_space:
+ name: "{{ service_name }}"
state: stat
user: "{{ user }}"
password: "{{ password }}"
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_create_resources.yml b/ansible_collections/infinidat/infinibox/playbooks/test_create_resources.yml
index 3ca9b5542..715b83284 100644
--- a/ansible_collections/infinidat/infinibox/playbooks/test_create_resources.yml
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_create_resources.yml
@@ -1,12 +1,11 @@
---
-- hosts: localhost
+- name: Test Create Resources
+ hosts: localhost
gather_facts: true # Required for ansible_date_time
- collections:
- - infinidat.infinibox
tasks:
- - name: NEGATIVE test -> Create file system named {{ auto_prefix }}fs under a pool that does not exist
- infini_fs:
+ - name: NEGATIVE test -> Create file system under a pool that does not exist
+ infinidat.infinibox.infini_fs:
name: "{{ auto_prefix }}fs"
size: 1GB
pool: "{{ auto_prefix }}pool_missing"
@@ -18,27 +17,27 @@
failed_when: "'pool_missing' not in result.msg"
when: not ansible_check_mode
- - name: POSITIVE test -> Create pool {{ auto_prefix }}pool
- infini_pool:
+ - name: POSITIVE test -> Create pool
+ infinidat.infinibox.infini_pool:
name: "{{ auto_prefix }}pool"
- size: 1TB
- vsize: 1TB
+ size: "{{ pool_size }}"
+ vsize: "{{ pool_size }}"
state: present
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Stat pool {{ auto_prefix }}pool
- infini_pool:
+ - name: POSITIVE test -> Stat pool
+ infinidat.infinibox.infini_pool:
name: "{{ auto_prefix }}pool"
state: stat
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Create default THIN, file system named {{ auto_prefix }}fs_default under pool {{ auto_prefix }}pool
+ - name: POSITIVE test -> Create default THIN file system
# See IBox settings: Dataset default provisioning.
- infini_fs:
+ infinidat.infinibox.infini_fs:
name: "{{ auto_prefix }}fs_default"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -47,8 +46,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Stat file system named {{ auto_prefix }}fs_default under pool {{ auto_prefix }}pool
- infini_fs:
+ - name: POSITIVE test -> Stat file system
+ infinidat.infinibox.infini_fs:
name: "{{ auto_prefix }}fs_default"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -58,11 +57,12 @@
system: "{{ system }}"
register: def_stat
- - debug:
+ - name: DEBUG test -> Show file system stat
+ ansible.builtin.debug:
msg: stat - {{ def_stat }}
- - name: POSITIVE test -> Create THICK file system named {{ auto_prefix }}fs_thick under pool {{ auto_prefix }}pool
- infini_fs:
+ - name: POSITIVE test -> Create THICK file system
+ infinidat.infinibox.infini_fs:
name: "{{ auto_prefix }}fs_thick"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -72,8 +72,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Create THIN file system named {{ auto_prefix }}fs under pool {{ auto_prefix }}pool
- infini_fs:
+ - name: POSITIVE test -> Create THIN file system
+ infinidat.infinibox.infini_fs:
name: "{{ auto_prefix }}fs"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -83,8 +83,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Change THIN file system named {{ auto_prefix }}fs to THICK provisioning
- infini_fs:
+ - name: POSITIVE test -> Change THIN file system to THICK provisioning
+ infinidat.infinibox.infini_fs:
name: "{{ auto_prefix }}fs"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -94,8 +94,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Change THICK file system named {{ auto_prefix }}fs back to THIN provisioning
- infini_fs:
+ - name: POSITIVE test -> Change THICK file system back to THIN provisioning
+ infinidat.infinibox.infini_fs:
name: "{{ auto_prefix }}fs"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -105,17 +105,154 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Stat file system named {{ auto_prefix }}fs under pool {{ auto_prefix }}pool
- infini_fs:
+ - name: POSITIVE test -> Stat file system
+ infinidat.infinibox.infini_fs:
name: "{{ auto_prefix }}fs"
pool: "{{ auto_prefix }}pool"
state: stat
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
+ register: output
+
+ - name: DEBUG test -> Show file system stat
+ ansible.builtin.debug:
+ var: output
+
+ - name: POSITIVE test -> Stat file system that matches serial number
+ infinidat.infinibox.infini_fs:
+ serial: "{{ output.serial }}"
+ pool: "{{ auto_prefix }}pool"
+ state: stat
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: stat_out
+
+ - name: DEBUG test -> Show file system stat
+ ansible.builtin.debug:
+ var: stat_out
+
+ - name: POSITIVE test -> Create file system snapshot
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fs_snap"
+ pool: "{{ auto_prefix }}pool"
+ state: present
+ fs_type: snapshot
+ parent_fs_name: "{{ auto_prefix }}fs"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Restore parent file system from snapshot
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fs_snap"
+ pool: "{{ auto_prefix }}pool"
+ state: present
+ fs_type: snapshot
+ parent_fs_name: "{{ auto_prefix }}fs"
+ restore_fs_from_snapshot: true
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: DEBUG test -> Find the current date-time. Time marks when the playbook gathered facts
+ ansible.builtin.debug:
+ var: ansible_date_time.iso8601_micro
+
+ # Note: For collection filters, Ansible does not honor the
+ # collections list at the top of this file.
+ # One must use a FQCN for filters such as
+ # infinidat.infinibox.delta_time.
+ - name: POSITIVE test -> Create snapshot from file system. Lock for 2 minutes.
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fs_snap_locked"
+ pool: "{{ auto_prefix }}pool"
+ state: present
+ fs_type: snapshot
+ parent_fs_name: "{{ auto_prefix }}fs"
+ snapshot_lock_expires_at: "{{ ansible_date_time.iso8601_micro | to_datetime(fmt) | infinidat.infinibox.delta_time(minutes=2) }}"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ vars:
+ fmt: "%Y-%m-%dT%H:%M:%S.%fZ"
+
+ - name: POSITIVE test -> Extend lock to 3 minutes without refresh
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fs_snap_locked"
+ pool: "{{ auto_prefix }}pool"
+ state: present
+ fs_type: snapshot
+ parent_fs_name: "{{ auto_prefix }}fs"
+ snapshot_lock_expires_at: "{{ ansible_date_time.iso8601_micro | to_datetime(fmt) | infinidat.infinibox.delta_time(minutes=3) }}"
+ snapshot_lock_only: true
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ vars:
+ fmt: "%Y-%m-%dT%H:%M:%S.%fZ"
+
+ - name: NEGATIVE test -> Attempt to extend file system snapshot lock without refresh on a file system snapshot that does not exist.
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fs_snap_locked_missing"
+ pool: "{{ auto_prefix }}pool"
+ state: present
+ fs_type: snapshot
+ parent_fs_name: "{{ auto_prefix }}fs"
+ snapshot_lock_expires_at: "{{ ansible_date_time.iso8601_micro | to_datetime(fmt) | infinidat.infinibox.delta_time(minutes=3) }}"
+ snapshot_lock_only: true
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: result
+ failed_when: "not result.msg | regex_search('Snapshot does not exist. Cannot comply')"
+ vars:
+ fmt: "%Y-%m-%dT%H:%M:%S.%fZ"
+
+ - name: NEGATIVE test -> Attempt to create file system snapshot locked for 31 days. Exceeds 30 day maximum lock time enforced by infini_fs module (not API)
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fs_snap_locked_too_long"
+ pool: "{{ auto_prefix }}pool"
+ state: present
+ fs_type: snapshot
+ parent_fs_name: "{{ auto_prefix }}fs"
+ snapshot_lock_expires_at: "{{ ansible_date_time.iso8601_micro | to_datetime(fmt) | infinidat.infinibox.delta_time(days=31) }}"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: result
+ failed_when: "not result.msg | regex_search('snapshot_lock_expires_at exceeds.*days in the future')"
+ vars:
+ fmt: "%Y-%m-%dT%H:%M:%S.%fZ"
+
+ - name: NEGATIVE test -> Attempt to remove locked file system snapshot
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fs_snap_locked"
+ pool: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: result
+ failed_when: "'Cannot delete snapshot. Locked' not in result.msg"
- - name: POSITIVE test -> Export file system {{ auto_prefix }}fs
- infini_export:
+ - name: POSITIVE test -> Wait for lock on file system to expire
+ ansible.builtin.pause:
+ seconds: 181
+ prompt: Waiting for {{ auto_prefix }}fs_snap_locked to expire
+
+ - name: POSITIVE test -> Remove file system snapshot with expired lock
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fs_snap_locked"
+ pool: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Export file system
+ infinidat.infinibox.infini_export:
name: "/{{ auto_prefix }}export"
filesystem: "{{ auto_prefix }}fs"
client_list:
@@ -127,8 +264,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Stat file system export {{ auto_prefix }}export
- infini_export:
+ - name: POSITIVE test -> Stat file system export
+ infinidat.infinibox.infini_export:
name: "/{{ auto_prefix }}export"
filesystem: "{{ auto_prefix }}fs"
state: stat
@@ -136,8 +273,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: NEGATIVE test -> Export file system {{ auto_prefix }}fs that does not exist
- infini_export:
+ - name: NEGATIVE test -> Export file system that does not exist
+ infinidat.infinibox.infini_export:
name: "/{{ auto_prefix }}export_missing"
filesystem: "{{ auto_prefix }}fs_missing"
client_list:
@@ -152,8 +289,8 @@
failed_when: "not result.msg | regex_search('File system.*not found')"
when: not ansible_check_mode
- - name: POSITIVE test -> Create export client for export /{{ auto_prefix }}export
- infini_export_client:
+ - name: POSITIVE test -> Create export client for export
+ infinidat.infinibox.infini_export_client:
export: "/{{ auto_prefix }}export"
client: "20.20.20.20"
state: present
@@ -165,7 +302,7 @@
# TODO - stat export client
- name: NEGATIVE test -> Create export client for export that does not exist
- infini_export_client:
+ infinidat.infinibox.infini_export_client:
export: "/{{ auto_prefix }}export_missing"
client: 20.20.20.20
state: present
@@ -177,8 +314,8 @@
failed_when: "not result.msg | regex_search('Export.*not found')"
when: not ansible_check_mode
- - name: NEGATIVE test -> Create volume {{ auto_prefix }}vol_in_pool_missing under pool that does not exist
- infini_vol:
+ - name: NEGATIVE test -> Create volume under pool that does not exist
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_in_pool_missing"
size: 1GB
pool: "{{ auto_prefix }}pool_missing"
@@ -191,8 +328,8 @@
# failed_when: "'pool_missing' not in result.msg"
when: not ansible_check_mode
- - name: POSITIVE test -> Create thin volume {{ auto_prefix }}vol under pool {{ auto_prefix }}pool
- infini_vol:
+ - name: POSITIVE test -> Create thin volume in existing pool
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -201,8 +338,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Create thick volume {{ auto_prefix }}vol_thick under pool {{ auto_prefix }}pool
- infini_vol:
+ - name: POSITIVE test -> Create thick volume under pool
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_thick"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -213,26 +350,31 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Stat volume {{ auto_prefix }}vol under pool {{ auto_prefix }}pool
- register: output
- infini_vol:
+ - name: POSITIVE test -> Stat volume under pool
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol"
pool: "{{ auto_prefix }}pool"
state: stat
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
+ register: output
- name: POSITIVE test -> Stat vol serial number
- infini_vol:
+ infinidat.infinibox.infini_vol:
state: stat
serial: "{{ output.serial }}"
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
+ register: stat_out
+
+ - name: DEBUG test -> Show volume stat with serial number
+ ansible.builtin.debug:
+ var: stat_out
- - name: POSITIVE test -> Create snapshot {{ auto_prefix }}vol_snap from volume {{ auto_prefix }}vol
- infini_vol:
+ - name: POSITIVE test -> Create snapshot from volume
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_snap"
state: present
volume_type: snapshot
@@ -241,34 +383,34 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: DEBUG test -> Find the current date-time (WARNING - Time marks when the playbook gathered facts)
+ - name: DEBUG test -> Find the current date-time. Time marks when the playbook gathered facts.
ansible.builtin.debug:
- var=ansible_date_time.iso8601_micro
+ var: ansible_date_time.iso8601_micro
# Note: For collection filters, Ansible does not honor the
# collections list at the top of this file.
# One must use a FQCN for filters such as
# infinidat.infinibox.delta_time.
- - name: POSITIVE test -> Create and lock for 2 minutes snapshot {{ auto_prefix }}vol_snap_locked from volume {{ auto_prefix }}vol
- infini_vol:
+ - name: POSITIVE test -> Create and lock for 5 minutes snapshot from volume
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_snap_locked"
state: present
volume_type: snapshot
parent_volume_name: "{{ auto_prefix }}vol"
- snapshot_lock_expires_at: "{{ ansible_date_time.iso8601_micro | to_datetime(fmt) | infinidat.infinibox.delta_time(minutes=2) }}"
+ snapshot_lock_expires_at: "{{ ansible_date_time.iso8601_micro | to_datetime(fmt) | infinidat.infinibox.delta_time(minutes=5) }}"
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
vars:
fmt: "%Y-%m-%dT%H:%M:%S.%fZ"
- - name: POSITIVE test -> Extend lock to 3 minutes for {{ auto_prefix }}vol_snap_locked without refresh
- infini_vol:
+ - name: POSITIVE test -> Extend lock to 6 minutes for without refresh
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_snap_locked"
state: present
volume_type: snapshot
parent_volume_name: "{{ auto_prefix }}vol"
- snapshot_lock_expires_at: "{{ ansible_date_time.iso8601_micro | to_datetime(fmt) | infinidat.infinibox.delta_time(minutes=3) }}"
+ snapshot_lock_expires_at: "{{ ansible_date_time.iso8601_micro | to_datetime(fmt) | infinidat.infinibox.delta_time(minutes=6) }}"
snapshot_lock_only: true
user: "{{ user }}"
password: "{{ password }}"
@@ -277,12 +419,12 @@
fmt: "%Y-%m-%dT%H:%M:%S.%fZ"
- name: NEGATIVE test -> Attempt to extend lock without refresh on a snapshot that does not exist.
- infini_vol:
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_snap_locked_missing"
state: present
volume_type: snapshot
parent_volume_name: "{{ auto_prefix }}vol"
- snapshot_lock_expires_at: "{{ ansible_date_time.iso8601_micro | to_datetime(fmt) | infinidat.infinibox.delta_time(minutes=3) }}"
+ snapshot_lock_expires_at: "{{ ansible_date_time.iso8601_micro | to_datetime(fmt) | infinidat.infinibox.delta_time(minutes=6) }}"
snapshot_lock_only: true
user: "{{ user }}"
password: "{{ password }}"
@@ -292,8 +434,8 @@
vars:
fmt: "%Y-%m-%dT%H:%M:%S.%fZ"
- - name: NEGATIVE test -> Attempt to create snapshot locked for 31 days, 31 days exceeds 30 day maximum lock time enforced by infini_vol module (not api)
- infini_vol:
+ - name: NEGATIVE test -> Attempt to create snapshot locked for 31 days, 31 days exceeds 30 day maximum lock time enforced by infini_vol module (not API)
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_snap_locked_too_long"
state: present
volume_type: snapshot
@@ -307,8 +449,8 @@
vars:
fmt: "%Y-%m-%dT%H:%M:%S.%fZ"
- - name: NEGATIVE test -> Attempt to remove locked snapshot {{ auto_prefix }}vol_snap_locked
- infini_vol:
+ - name: NEGATIVE test -> Attempt to remove locked volume snapshot
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_snap_locked"
state: absent
user: "{{ user }}"
@@ -317,21 +459,21 @@
register: result
failed_when: "'Cannot delete snapshot. Locked' not in result.msg"
- - name: POSITIVE test -> Wait for lock on {{ auto_prefix }}vol_snap_locked to expire
+ - name: POSITIVE test -> Wait for lock on volume to expire
ansible.builtin.pause:
seconds: 181
prompt: Waiting for {{ auto_prefix }}vol_snap_locked to expire
- - name: POSITIVE test -> Remove snapshot {{ auto_prefix }}vol_snap_locked with expired lock
- infini_vol:
+ - name: POSITIVE test -> Remove snapshot with expired lock
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_snap_locked"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Create host {{ auto_prefix }}host
- infini_host:
+ - name: POSITIVE test -> Create host
+ infinidat.infinibox.infini_host:
name: "{{ auto_prefix }}host"
state: present
user: "{{ user }}"
@@ -339,24 +481,24 @@
system: "{{ system }}"
# Second host used for testing infini_cluster
- - name: POSITIVE test -> Create host {{ auto_prefix }}host2
- infini_host:
+ - name: POSITIVE test -> Create second host
+ infinidat.infinibox.infini_host:
name: "{{ auto_prefix }}host2"
state: present
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Stat host {{ auto_prefix }}host
- infini_host:
+ - name: POSITIVE test -> Stat host
+ infinidat.infinibox.infini_host:
name: "{{ auto_prefix }}host"
state: stat
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Add one wwns port to {{ auto_prefix }}host
- infini_port:
+ - name: POSITIVE test -> Add one wwns port to host
+ infinidat.infinibox.infini_port:
host: PSUS_ANSIBLE_host
state: present
wwns:
@@ -366,8 +508,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Add a second wwn port plus two iscsi ports to {{ auto_prefix }}host
- infini_port:
+ - name: POSITIVE test -> Add a second wwn port plus two iscsi ports to host
+ infinidat.infinibox.infini_port:
host: PSUS_ANSIBLE_host
state: present
wwns:
@@ -379,24 +521,24 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Stat ports on {{ auto_prefix }}host
- infini_port:
+ - name: POSITIVE test -> Stat ports on host
+ infinidat.infinibox.infini_port:
host: PSUS_ANSIBLE_host
state: stat
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Stat host {{ auto_prefix }}host after ports added
- infini_host:
+ - name: POSITIVE test -> Stat host after ports added
+ infinidat.infinibox.infini_host:
name: "{{ auto_prefix }}host"
state: stat
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: NEGATIVE test -> Map volume {{ auto_prefix }}vol to host that does not exist
- infini_map:
+ - name: NEGATIVE test -> Map volume to host that does not exist
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host_missing"
volume: "{{ auto_prefix }}vol"
state: present
@@ -407,8 +549,8 @@
failed_when: "not result.msg | regex_search('Neither host.*nor cluster.*found')"
when: not ansible_check_mode
- - name: POSITIVE test -> Map volume {{ auto_prefix }}vol to host {{ auto_prefix }}host
- infini_map:
+ - name: POSITIVE test -> Map volume to host
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host"
volume: "{{ auto_prefix }}vol"
state: present
@@ -417,14 +559,15 @@
system: "{{ system }}"
- name: POSITIVE test -> Rescan after mapping
- shell: |
+ ansible.builtin.shell: |
rescan-scsi-bus.sh
- become: True
+ become: true
register: rescan
failed_when: "rescan.rc != 0 and 'not found' not in rescan.stderr"
+ changed_when: true
- - name: POSITIVE test -> Stat map of volume {{ auto_prefix }}vol to host {{ auto_prefix }}host
- infini_map:
+ - name: POSITIVE test -> Stat map of volume to host
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host"
volume: "{{ auto_prefix }}vol"
state: stat
@@ -432,8 +575,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove mapping of volume {{ auto_prefix }}vol from host {{ auto_prefix }}host
- infini_map:
+ - name: POSITIVE test -> Remove mapping of volume from host
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host"
volume: "{{ auto_prefix }}vol"
state: absent
@@ -442,14 +585,15 @@
system: "{{ system }}"
- name: POSITIVE test -> Rescan with remove option after removing mapping
- shell: |
+ ansible.builtin.shell: |
rescan-scsi-bus.sh --remove
- become: True
+ become: true
register: rescan
failed_when: "rescan.rc != 0 and 'not found' not in rescan.stderr"
+ changed_when: true
- - name: POSITIVE test -> Map volume {{ auto_prefix }}vol to host {{ auto_prefix }}host using lun 0
- infini_map:
+ - name: POSITIVE test -> Map volume to host using lun 0
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host"
volume: "{{ auto_prefix }}vol"
lun: 0
@@ -459,14 +603,15 @@
system: "{{ system }}"
- name: POSITIVE test -> Rescan after mapping
- shell: |
+ ansible.builtin.shell: |
rescan-scsi-bus.sh
- become: True
+ become: true
register: rescan
failed_when: "rescan.rc != 0 and 'not found' not in rescan.stderr"
+ changed_when: true
- - name: POSITIVE test -> Stat map of volume {{ auto_prefix }}vol to host {{ auto_prefix }}host using lun 0
- infini_map:
+ - name: POSITIVE test -> Stat map of volume to host using lun 0
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host"
volume: "{{ auto_prefix }}vol"
state: stat
@@ -484,42 +629,42 @@
tags:
- dev
- - name: POSITIVE test -> Create user {{ auto_prefix }}pool_admin_user with pool_admin role managing pool {{ auto_prefix }}pool
- infini_user:
+ - name: POSITIVE test -> Create user with pool_admin role managing pool
+ infinidat.infinibox.infini_user:
user_name: "{{ auto_prefix }}pool_admin_user"
user_email: "{{ auto_prefix }}pool_admin_user@example.com"
user_password: "secret1"
user_role: "pool_admin"
- user_enabled: "true"
+ user_enabled: true
user_pool: "{{ auto_prefix }}pool"
state: present
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Disable user {{ auto_prefix }}pool_admin_user
- infini_user:
+ - name: POSITIVE test -> Disable user
+ infinidat.infinibox.infini_user:
user_name: "{{ auto_prefix }}pool_admin_user"
user_email: "{{ auto_prefix }}pool_admin_user@example.com"
user_password: "secret1"
user_role: "pool_admin"
- user_enabled: "false"
+ user_enabled: false
user_pool: "{{ auto_prefix }}pool"
state: present
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Stat user {{ auto_prefix }}pool_admin_user
- infini_user:
+ - name: POSITIVE test -> Stat disabled user
+ infinidat.infinibox.infini_user:
user_name: "{{ auto_prefix }}pool_admin_user"
state: stat
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Reset password for user {{ auto_prefix }}pool_admin_user
- infini_user:
+ - name: POSITIVE test -> Reset password for user
+ infinidat.infinibox.infini_user:
user_name: "{{ auto_prefix }}pool_admin_user"
user_password: "secret_new"
state: reset_password
@@ -527,8 +672,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Create user {{ auto_prefix }}admin_user with admin role
- infini_user:
+ - name: POSITIVE test -> Create user with admin role
+ infinidat.infinibox.infini_user:
user_name: "{{ auto_prefix }}admin_user"
user_email: "{{ auto_prefix }}admin_user@example.com"
user_password: "secret2"
@@ -539,8 +684,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Create user {{ auto_prefix }}read_only_user with read_only role
- infini_user:
+ - name: POSITIVE test -> Create user with read_only role
+ infinidat.infinibox.infini_user:
user_name: "{{ auto_prefix }}read_only_user"
user_email: "{{ auto_prefix }}read_only_user@example.com"
user_password: "secret3"
@@ -551,8 +696,16 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Create cluster {{ auto_prefix }}cluster with two hosts
- infini_cluster:
+ - name: POSITIVE test -> Create cluster with zero hosts
+ infinidat.infinibox.infini_cluster:
+ name: "{{ auto_prefix }}cluster_zero_hosts"
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Create cluster with two hosts
+ infinidat.infinibox.infini_cluster:
name: "{{ auto_prefix }}cluster"
cluster_hosts:
- host_name: "{{ auto_prefix }}host"
@@ -564,8 +717,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove {{ auto_prefix }}host from cluster {{ auto_prefix }}cluster. Leave {{ auto_prefix }}host2.
- infini_cluster:
+ - name: POSITIVE test -> Remove host from cluster. Leave second host in cluster.
+ infinidat.infinibox.infini_cluster:
name: "{{ auto_prefix }}cluster"
cluster_hosts:
- host_name: "{{ auto_prefix }}host"
@@ -577,8 +730,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Re-add {{ auto_prefix }}host to cluster {{ auto_prefix }}cluster. Remove {{ auto_prefix }}host2.
- infini_cluster:
+ - name: POSITIVE test -> Re-add host to cluster. Remove second host.
+ infinidat.infinibox.infini_cluster:
name: "{{ auto_prefix }}cluster"
cluster_hosts:
- host_name: "{{ auto_prefix }}host"
@@ -590,8 +743,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: IDEMPOTENT test -> Re-add {{ auto_prefix }}host to cluster {{ auto_prefix }}cluster again. Remove {{ auto_prefix }}host2 again.
- infini_cluster:
+ - name: IDEMPOTENT test -> Re-add host to cluster again. Remove second host again.
+ infinidat.infinibox.infini_cluster:
name: "{{ auto_prefix }}cluster"
cluster_hosts:
- host_name: "{{ auto_prefix }}host"
@@ -603,8 +756,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: NEGATIVE test -> Attempt to add {{ auto_prefix }}host to cluster {{ auto_prefix }}cluster with missing host_cluster_state key:value
- infini_cluster:
+ - name: NEGATIVE test -> Attempt to add host to cluster with missing host_cluster_state key and value
+ infinidat.infinibox.infini_cluster:
name: "{{ auto_prefix }}cluster"
cluster_hosts:
- host_name: "{{ auto_prefix }}host"
@@ -616,8 +769,8 @@
register: result
failed_when: "'require host_name and host_cluster_state' not in result.msg"
- - name: NEGATIVE test -> Attempt to add {{ auto_prefix }}host to cluster {{ auto_prefix }}cluster with an unsupported key:value
- infini_cluster:
+ - name: NEGATIVE test -> Attempt to add host to cluster with an unsupported key and value
+ infinidat.infinibox.infini_cluster:
name: "{{ auto_prefix }}cluster"
cluster_hosts:
- host_name: "{{ auto_prefix }}host"
@@ -628,4 +781,4 @@
password: "{{ password }}"
system: "{{ system }}"
register: result
- failed_when: "'require host_name and host_cluster_state' not in result.msg"
+ failed_when: "'require host_name and host_cluster_state' not in result.msg"
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_create_snapshots.yml b/ansible_collections/infinidat/infinibox/playbooks/test_create_snapshots.yml
index bb4db264e..32adf3c18 100644
--- a/ansible_collections/infinidat/infinibox/playbooks/test_create_snapshots.yml
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_create_snapshots.yml
@@ -1,22 +1,21 @@
---
-- hosts: localhost
+- name: Test creating snapshots using infini_vol module
+ hosts: localhost
gather_facts: true # Required for ansible_date_time
- collections:
- - infinidat.infinibox
tasks:
- - name: POSITIVE test -> Create pool {{ auto_prefix }}pool
- infini_pool:
+ - name: POSITIVE test -> Create pool
+ infinidat.infinibox.infini_pool:
name: "{{ auto_prefix }}pool"
- size: 1TB
- vsize: 1TB
+ size: "{{ pool_size }}"
+ vsize: "{{ pool_size }}"
state: present
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Create thin volume {{ auto_prefix }}vol under pool {{ auto_prefix }}pool
- infini_vol:
+ - name: POSITIVE test -> Create thin volume under pool
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -25,8 +24,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Create snapshot {{ auto_prefix }}vol_snap from volume {{ auto_prefix }}vol
- infini_vol:
+ - name: POSITIVE test -> Create snapshot from volume
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_snap"
state: present
volume_type: snapshot
@@ -35,16 +34,16 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: DEBUG test -> Find the current date-time (WARNING - Time marks when the playbook gathered facts)
+ - name: DEBUG test -> Find the current date-time. Time marks when the playbook gathered facts.
ansible.builtin.debug:
- var=ansible_date_time.iso8601_micro
+ var: ansible_date_time.iso8601_micro
# Note: For collection filters, Ansible does not honor the
# collections list at the top of this file.
# One must use a FQCN for filters such as
# infinidat.infinibox.delta_time.
- - name: POSITIVE test -> Create and lock for 2 minutes snapshot {{ auto_prefix }}vol_snap_locked from volume {{ auto_prefix }}vol
- infini_vol:
+ - name: POSITIVE test -> Create and lock for 2 minutes snapshot from volume
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_snap_locked"
state: present
volume_type: snapshot
@@ -56,8 +55,8 @@
vars:
fmt: "%Y-%m-%dT%H:%M:%S.%fZ"
- - name: POSITIVE test -> Extend lock to 3 minutes for {{ auto_prefix }}vol_snap_locked without refresh
- infini_vol:
+ - name: POSITIVE test -> Extend lock to 3 minutes for snapshot without refresh
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_snap_locked"
state: present
volume_type: snapshot
@@ -70,8 +69,8 @@
vars:
fmt: "%Y-%m-%dT%H:%M:%S.%fZ"
- - name: NEGATIVE test -> Attempt to create snapshot locked for 31 days, 31 days exceeds 30 day maximum lock time enforced by infini_vol module (not API)
- infini_vol:
+ - name: NEGATIVE test -> Attempt to create snapshot locked for 31 days. Exceeds 30 day maximum lock time enforced by infini_vol module (not API)
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_snap_locked_too_long"
state: present
volume_type: snapshot
@@ -85,8 +84,8 @@
vars:
fmt: "%Y-%m-%dT%H:%M:%S.%fZ"
- - name: NEGATIVE test -> Attempt to remove locked snapshot {{ auto_prefix }}vol_snap_locked
- infini_vol:
+ - name: NEGATIVE test -> Attempt to remove locked snapshot
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_snap_locked"
state: absent
user: "{{ user }}"
@@ -95,13 +94,13 @@
register: result
failed_when: "'Cannot delete snapshot. Locked' not in result.msg"
- - name: POSITIVE test -> Wait for lock on {{ auto_prefix }}vol_snap_locked to expire
+ - name: POSITIVE test -> Wait for lock on snapshot to expire
ansible.builtin.pause:
seconds: 181
prompt: Waiting for {{ auto_prefix }}vol_snap_locked to expire
- - name: POSITIVE test -> Lock expired. Remove snapshot {{ auto_prefix }}vol_snap_locked.
- infini_vol:
+ - name: POSITIVE test -> Lock expired. Remove snapshot.
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_snap_locked"
state: absent
user: "{{ user }}"
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_create_volumes.yml b/ansible_collections/infinidat/infinibox/playbooks/test_create_volumes.yml
new file mode 100644
index 000000000..ccd2dd400
--- /dev/null
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_create_volumes.yml
@@ -0,0 +1,93 @@
+---
+# See PSDEV-1000: Fix infini_vols handling of write_protected parameter
+# Create three volumes: vol_nonwriteable, vol_explicitly_writable and vol_writable.
+- name: Test infini_vol module
+ hosts: localhost
+ gather_facts: true # Required for ansible_date_time
+ tasks:
+
+ - name: POSITIVE test -> Create pool
+ infinidat.infinibox.infini_pool:
+ name: "{{ auto_prefix }}pool"
+ size: "{{ pool_size }}"
+ vsize: "{{ pool_size }}"
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Create write protected volume
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}vol_nonwriteable"
+ size: 1GB
+ write_protected: true
+ pool: "{{ auto_prefix }}pool"
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Create explicitly writable volume
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}vol_explicitly_writable"
+ size: 1GB
+ write_protected: false
+ pool: "{{ auto_prefix }}pool"
+ thin_provision: false
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Create implicitly writable volume
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}vol_writable"
+ size: 1GB
+ pool: "{{ auto_prefix }}pool"
+ thin_provision: false
+ state: present
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Stat nonwritable volume
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}vol_nonwriteable"
+ pool: "{{ auto_prefix }}pool"
+ state: stat
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: stat_nonwritable
+
+ - name: DEBUG test -> Stat non writable volume
+ ansible.builtin.debug:
+ msg: stat - {{ stat_nonwritable }}
+
+ - name: POSITIVE test -> Stat explicitely writable volume
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}vol_explicitly_writable"
+ pool: "{{ auto_prefix }}pool"
+ state: stat
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: stat_explicitely_writable
+
+ - name: DEBUG test -> Stat explicitly writable volume
+ ansible.builtin.debug:
+ msg: stat - {{ stat_explicitely_writable }}
+
+ - name: POSITIVE test -> Stat implicitely writable volume
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}vol_writable"
+ pool: "{{ auto_prefix }}pool"
+ state: stat
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: stat_writable
+
+ - name: DEBUG test -> Stat implicitely writable volume
+ ansible.builtin.debug:
+ msg: stat - {{ stat_writable }}
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_notification_rules_sample.yml b/ansible_collections/infinidat/infinibox/playbooks/test_notification_rules_sample.yml
new file mode 100644
index 000000000..0633e7bee
--- /dev/null
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_notification_rules_sample.yml
@@ -0,0 +1,111 @@
+---
+# PSDEV-1108: Playbook for testing creation of metadata resources.
+- name: Test infini_notification_rule module
+ hosts: localhost
+ gather_facts: false # Required for ansible_date_time
+ tasks:
+
+ - name: Delete a notification rule
+ infinidat.infinibox.infini_notification_rule:
+ name: "test-rule-to-target" # this need to be uniq
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+
+ - name: Debug
+ ansible.builtin.debug:
+ var: metadata_out
+
+ - name: Delete notification targets
+ infinidat.infinibox.infini_notification_target:
+ state: absent
+ name: testgraylog1
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: targets_out
+
+ - name: Debug
+ ansible.builtin.debug:
+ var: targets_out
+
+ - name: Create notification targets
+ infinidat.infinibox.infini_notification_target:
+ state: present
+ name: testgraylog1
+ protocol: SYSLOG
+ host: 172.31.77.214
+ port: 8067
+ facility: LOCAL7
+ transport: TCP
+ visibility: CUSTOMER
+ post_test: true
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: targets_out
+
+ - name: Debug
+ ansible.builtin.debug:
+ var: targets_out
+
+ - name: Create a new notification rule to a target
+ infinidat.infinibox.infini_notification_rule:
+ name: "test-rule-to-target" # this need to be uniq
+ event_level:
+ - ERROR
+ - CRITICAL
+ include_events:
+ - ACTIVATION_PAUSED
+ exclude_events:
+ - ACTIVE_DIRECTORY_ALL_DOMAIN_CONTROLLERS_DOWN
+ - ACTIVE_DIRECTORY_LEFT
+ target: testgraylog1
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+
+ - name: Debug
+ ansible.builtin.debug:
+ var: metadata_out
+
+ - name: Create a new notification rule with emails
+ infinidat.infinibox.infini_notification_rule:
+ name: "test-rule-with-emails" # this need to be uniq
+ event_level:
+ - ERROR
+ - CRITICAL
+ include_events:
+ - ACTIVATION_PAUSED
+ exclude_events:
+ - ACTIVE_DIRECTORY_ALL_DOMAIN_CONTROLLERS_DOWN
+ - ACTIVE_DIRECTORY_LEFT
+ recipients:
+ - wwang@infinidat.com
+ - wei.w.wang@gmail.com
+ state: "present"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+
+ - name: Debug
+ ansible.builtin.debug:
+ var: metadata_out
+
+ # # Test any object_type
+ # - name: Delete a rule
+ # infinidat.infinibox.infini_notification_rule:
+ # name: "testw2" # this need to be uniq
+ # state: "absent"
+ # user: "{{ user }}"
+ # password: "{{ password }}"
+ # system: "{{ system }}"
+ # register: metadata_out
+ #
+ # - name: Debug
+ # ansible.builtin.debug:
+ # var: metadata_out
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_remove_map_cluster.yml b/ansible_collections/infinidat/infinibox/playbooks/test_remove_map_cluster.yml
index 8aaa765fb..b2ffaa94d 100644
--- a/ansible_collections/infinidat/infinibox/playbooks/test_remove_map_cluster.yml
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_remove_map_cluster.yml
@@ -1,12 +1,11 @@
---
-- hosts: localhost
+- name: Clean up after test of infini_map
+ hosts: localhost
gather_facts: false
- collections:
- - infinidat.infinibox
tasks:
- - name: POSITIVE test -> Stat mapping of volume {{ auto_prefix }}vol to host {{ auto_prefix }}host1
- infini_map:
+ - name: POSITIVE test -> Stat mapping of volume to host
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host1"
volume: "{{ auto_prefix }}vol"
state: stat
@@ -23,8 +22,8 @@
ansible.builtin.debug:
msg: "Map stat: {{ host_stat }}"
- - name: POSITIVE test -> Stat mapping of volume {{ auto_prefix }}vol to cluster {{ auto_prefix }}cluster
- infini_map:
+ - name: POSITIVE test -> Stat mapping of volume to cluster
+ infinidat.infinibox.infini_map:
cluster: "{{ auto_prefix }}cluster"
volume: "{{ auto_prefix }}vol"
state: stat
@@ -42,8 +41,8 @@
# WARNING: Assume we have a vol mapped to a cluster with hosts host1 and host2.
# Then we unmap the vol from "host1" as shown below.
- - name: POSITIVE test -> Remove mapping of volume {{ auto_prefix }}vol from host {{ auto_prefix }}host1
- infini_map:
+ - name: POSITIVE test -> Remove mapping of volume from host
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host1"
volume: "{{ auto_prefix }}vol"
state: absent
@@ -52,8 +51,8 @@
system: "{{ system }}"
# This will UNMAP the vol from the entire CLUSTER!
- - name: NEGATIVE test -> Stat removed mapping of volume {{ auto_prefix }}vol from host {{ auto_prefix }}host1
- infini_map:
+ - name: NEGATIVE test -> Stat removed mapping of volume from host
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host1"
volume: "{{ auto_prefix }}vol"
state: stat
@@ -69,8 +68,8 @@
ansible.builtin.debug:
msg: "Map stat: {{ host_stat }}"
- - name: NEGATIVE test -> Stat removed mapping of volume {{ auto_prefix }}vol from cluster {{ auto_prefix }}cluster
- infini_map:
+ - name: NEGATIVE test -> Stat removed mapping of volume from cluster
+ infinidat.infinibox.infini_map:
cluster: "{{ auto_prefix }}cluster"
volume: "{{ auto_prefix }}vol"
state: stat
@@ -86,8 +85,8 @@
ansible.builtin.debug:
msg: "Map stat: {{ cluster_stat }}"
- - name: POSITIVE test -> Remove mapping of volume {{ auto_prefix }}vol from host {{ auto_prefix }}host3
- infini_map:
+ - name: POSITIVE test -> Remove mapping of volume from host
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host3"
volume: "{{ auto_prefix }}vol"
state: absent
@@ -95,8 +94,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: IDEMPOTENT test -> Remove mapping of volume {{ auto_prefix }}vol from host {{ auto_prefix }}host3 again
- infini_map:
+ - name: IDEMPOTENT test -> Remove mapping of volume from host again
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host3"
volume: "{{ auto_prefix }}vol"
state: absent
@@ -112,8 +111,8 @@
ansible.builtin.debug:
msg: "result: {{ result.msg }}"
- - name: POSITIVE test -> Remove mapping of volume {{ auto_prefix }}vol from cluster {{ auto_prefix }}cluster
- infini_map:
+ - name: POSITIVE test -> Remove mapping of volume from cluster
+ infinidat.infinibox.infini_map:
cluster: "{{ auto_prefix }}cluster"
volume: "{{ auto_prefix }}vol"
state: absent
@@ -121,8 +120,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: IDEMPOTENT test -> Remove mapping of volume {{ auto_prefix }}vol from cluster {{ auto_prefix }}cluster
- infini_map:
+ - name: IDEMPOTENT test -> Remove mapping of volume from cluster
+ infinidat.infinibox.infini_map:
cluster: "{{ auto_prefix }}cluster"
volume: "{{ auto_prefix }}vol"
state: absent
@@ -133,40 +132,40 @@
- '"was not mapped" not in result.msg'
- result.changed
- - name: POSITIVE test -> Remove cluster {{ auto_prefix }}cluster
- infini_cluster:
+ - name: POSITIVE test -> Remove cluster
+ infinidat.infinibox.infini_cluster:
name: "{{ auto_prefix }}cluster"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove host {{ auto_prefix }}host1
- infini_host:
+ - name: POSITIVE test -> Remove host
+ infinidat.infinibox.infini_host:
name: "{{ auto_prefix }}host1"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove host {{ auto_prefix }}host2
- infini_host:
+ - name: POSITIVE test -> Remove second host
+ infinidat.infinibox.infini_host:
name: "{{ auto_prefix }}host2"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove host {{ auto_prefix }}host3
- infini_host:
+ - name: POSITIVE test -> Remove third host
+ infinidat.infinibox.infini_host:
name: "{{ auto_prefix }}host3"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove thin volume {{ auto_prefix }}vol under pool {{ auto_prefix }}pool
- infini_vol:
+ - name: POSITIVE test -> Remove thin volume
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol"
pool: "{{ auto_prefix }}pool"
state: absent
@@ -174,8 +173,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove pool {{ auto_prefix }}pool
- infini_pool:
+ - name: POSITIVE test -> Remove pool
+ infinidat.infinibox.infini_pool:
name: "{{ auto_prefix }}pool"
state: absent
user: "{{ user }}"
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_remove_metadata.yml b/ansible_collections/infinidat/infinibox/playbooks/test_remove_metadata.yml
new file mode 100644
index 000000000..a17df38f7
--- /dev/null
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_remove_metadata.yml
@@ -0,0 +1,80 @@
+---
+# PSDEV-1108: Playbook for testing cleanup of metadata resources.
+- name: Clean up test of infini_metadata
+ hosts: localhost
+ gather_facts: false # Required for ansible_date_time
+
+ tasks:
+ - name: Remove system metadata key named sysfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "sysfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Remove volume named foo metadata key named volfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol"
+ object_name: "{{ auto_prefix }}vol"
+ key: "volfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+
+ - name: Delete volume snapshot
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}volsnap"
+ pool: "{{ auto_prefix }}pool"
+ volume_type: "snapshot"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Delete volume
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}vol"
+ pool: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ # TODO Delete fs snap. See psdev-1121.
+
+ - name: Delete file system
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fs"
+ pool: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Delete host
+ infinidat.infinibox.infini_host:
+ name: "{{ auto_prefix }}host"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Delete cluster
+ infinidat.infinibox.infini_cluster:
+ name: "{{ auto_prefix }}cluster"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Delete pool
+ infinidat.infinibox.infini_pool:
+ name: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_remove_network_spaces.yml b/ansible_collections/infinidat/infinibox/playbooks/test_remove_network_spaces.yml
index 3532008e9..b6bc00443 100644
--- a/ansible_collections/infinidat/infinibox/playbooks/test_remove_network_spaces.yml
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_remove_network_spaces.yml
@@ -1,18 +1,16 @@
---
-- hosts: localhost
+- name: Cleanup test of infini_network_space module
+ hosts: localhost
gather_facts: false
- collections:
- - infinidat.infinibox
vars:
- name: iSCSI
+ service_name: iSCSI
service: iSCSI
tasks:
- - name: POSITIVE test -> Remove network space named {{ name }}
- infini_network_space:
- name: "{{ name }}"
+ - name: POSITIVE test -> Remove network space
+ infinidat.infinibox.infini_network_space:
+ name: "{{ service_name }}"
state: absent
-
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_remove_resources.yml b/ansible_collections/infinidat/infinibox/playbooks/test_remove_resources.yml
index c7cb121df..dd596d7f0 100644
--- a/ansible_collections/infinidat/infinibox/playbooks/test_remove_resources.yml
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_remove_resources.yml
@@ -1,28 +1,35 @@
---
-- hosts: localhost
+- name: Test remove resources
+ hosts: localhost
gather_facts: false
- collections:
- - infinidat.infinibox
tasks:
- - name: POSITIVE test -> Remove cluster {{ auto_prefix }}cluster
- infini_cluster:
+ - name: POSITIVE test -> Remove cluster
+ infinidat.infinibox.infini_cluster:
+ name: "{{ auto_prefix }}cluster_zero_hosts"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Remove cluster second cluster
+ infinidat.infinibox.infini_cluster:
name: "{{ auto_prefix }}cluster"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: IDEMPOTENT test -> Remove cluster {{ auto_prefix }}cluster again
- infini_cluster:
+ - name: IDEMPOTENT test -> Remove cluster second cluster again
+ infinidat.infinibox.infini_cluster:
name: "{{ auto_prefix }}cluster"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove mapping of volume {{ auto_prefix }}vol from host {{ auto_prefix }}host
- infini_map:
+ - name: POSITIVE test -> Remove mapping of volume from host
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host"
volume: "{{ auto_prefix }}vol"
state: absent
@@ -31,14 +38,15 @@
system: "{{ system }}"
- name: POSITIVE test -> Rescan with remove option after removing mapping
- shell: |
+ ansible.builtin.shell: |
rescan-scsi-bus.sh --remove
- become: True
+ become: true
register: rescan
failed_when: "rescan.rc != 0 and 'not found' not in rescan.stderr"
+ changed_when: true
- - name: IDEMPOTENT test -> Remove mapping of volume {{ auto_prefix }}vol from host {{ auto_prefix }}host again
- infini_map:
+ - name: IDEMPOTENT test -> Remove mapping of volume from host again
+ infinidat.infinibox.infini_map:
host: "{{ auto_prefix }}host"
volume: "{{ auto_prefix }}vol"
state: absent
@@ -46,32 +54,32 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove host {{ auto_prefix }}host
- infini_host:
+ - name: POSITIVE test -> Remove host
+ infinidat.infinibox.infini_host:
name: "{{ auto_prefix }}host"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove host {{ auto_prefix }}host2
- infini_host:
+ - name: POSITIVE test -> Remove second host
+ infinidat.infinibox.infini_host:
name: "{{ auto_prefix }}host2"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: IDEMPOTENT test -> Remove host {{ auto_prefix }}host again
- infini_host:
+ - name: IDEMPOTENT test -> Remove host again
+ infinidat.infinibox.infini_host:
name: "{{ auto_prefix }}host"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove export client for export /{{ auto_prefix }}export
- infini_export_client:
+ - name: POSITIVE test -> Remove export client for export
+ infinidat.infinibox.infini_export_client:
client: 20.20.20.20
state: absent
access_mode: "RO"
@@ -80,8 +88,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: IDEMPOTENT test -> Remove export client for export /{{ auto_prefix }}export again
- infini_export_client:
+ - name: IDEMPOTENT test -> Remove export client for export again
+ infinidat.infinibox.infini_export_client:
client: 20.20.20.20
state: absent
access_mode: "RO"
@@ -90,8 +98,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove export {{ auto_prefix }}export of file system {{ auto_prefix }}fs
- infini_export:
+ - name: POSITIVE test -> Remove export of file system
+ infinidat.infinibox.infini_export:
name: "/{{ auto_prefix }}export"
filesystem: "{{ auto_prefix }}fs"
state: absent
@@ -99,8 +107,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: IDEMPOTENT test -> Remove export {{ auto_prefix }}export of file system {{ auto_prefix }}fs again
- infini_export:
+ - name: IDEMPOTENT test -> Remove export of file system again
+ infinidat.infinibox.infini_export:
name: "/{{ auto_prefix }}export"
filesystem: "{{ auto_prefix }}fs"
state: absent
@@ -108,8 +116,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove file system named {{ auto_prefix }}fs_default under pool {{ auto_prefix }}pool
- infini_fs:
+ - name: POSITIVE test -> Remove file system
+ infinidat.infinibox.infini_fs:
name: "{{ auto_prefix }}fs_default"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -118,8 +126,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove file system named {{ auto_prefix }}fs_thick under pool {{ auto_prefix }}pool
- infini_fs:
+ - name: POSITIVE test -> Remove thick file system
+ infinidat.infinibox.infini_fs:
name: "{{ auto_prefix }}fs_thick"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -128,8 +136,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove file system named {{ auto_prefix }}fs under pool {{ auto_prefix }}pool
- infini_fs:
+ - name: POSITIVE test -> Remove thin file system
+ infinidat.infinibox.infini_fs:
name: "{{ auto_prefix }}fs"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -138,8 +146,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: IDEMPOTENT test -> Remove file system named {{ auto_prefix }}fs under pool {{ auto_prefix }}pool again
- infini_fs:
+ - name: IDEMPOTENT test -> Remove file system again
+ infinidat.infinibox.infini_fs:
name: "{{ auto_prefix }}fs"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -148,8 +156,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove thin volume {{ auto_prefix }}vol under pool {{ auto_prefix }}pool
- infini_vol:
+ - name: POSITIVE test -> Remove thin volume
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol"
pool: "{{ auto_prefix }}pool"
state: absent
@@ -157,8 +165,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove thick volume {{ auto_prefix }}vol_thick under pool {{ auto_prefix }}pool
- infini_vol:
+ - name: POSITIVE test -> Remove thick volume
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_thick"
pool: "{{ auto_prefix }}pool"
state: absent
@@ -166,8 +174,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: IDEMPOTENT test -> Remove volume {{ auto_prefix }}vol under pool {{ auto_prefix }}pool again
- infini_vol:
+ - name: IDEMPOTENT test -> Remove volume again
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol"
pool: "{{ auto_prefix }}pool"
state: absent
@@ -175,24 +183,24 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove pool {{ auto_prefix }}pool
- infini_pool:
+ - name: POSITIVE test -> Remove pool
+ infinidat.infinibox.infini_pool:
name: "{{ auto_prefix }}pool"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove snapshot {{ auto_prefix }}vol_snap
- infini_vol:
+ - name: POSITIVE test -> Remove snapshot
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol_snap"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: IDEMPOTENT test -> Remove file system named {{ auto_prefix }}fs again from now missing pool {{ auto_prefix }}pool
- infini_fs:
+ - name: IDEMPOTENT test -> Remove file system again from now missing pool
+ infinidat.infinibox.infini_fs:
name: "{{ auto_prefix }}fs"
size: 1GB
pool: "{{ auto_prefix }}pool"
@@ -201,32 +209,32 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove user {{ auto_prefix }}read_only_user
- infini_user:
+ - name: POSITIVE test -> Remove read only user
+ infinidat.infinibox.infini_user:
user_name: "{{ auto_prefix }}read_only_user"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove user {{ auto_prefix }}admin_user
- infini_user:
+ - name: POSITIVE test -> Remove admin user
+ infinidat.infinibox.infini_user:
user_name: "{{ auto_prefix }}admin_user"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove user {{ auto_prefix }}pool_admin_user
- infini_user:
+ - name: POSITIVE test -> Remove pool admin user
+ infinidat.infinibox.infini_user:
user_name: "{{ auto_prefix }}pool_admin_user"
state: absent
user: "{{ user }}"
password: "{{ password }}"
system: "{{ system }}"
- - name: IDEMPOTENT test -> Remove user {{ auto_prefix }}pool_admin_user again
- infini_user:
+ - name: IDEMPOTENT test -> Remove pool admin user again
+ infinidat.infinibox.infini_user:
user_name: "{{ auto_prefix }}pool_admin_user"
state: absent
user: "{{ user }}"
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_remove_snapshots.yml b/ansible_collections/infinidat/infinibox/playbooks/test_remove_snapshots.yml
index 0320d8bd4..e119e9e8a 100644
--- a/ansible_collections/infinidat/infinibox/playbooks/test_remove_snapshots.yml
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_remove_snapshots.yml
@@ -1,12 +1,11 @@
---
-- hosts: localhost
+- name: Test remove resources
+ hosts: localhost
gather_facts: false
- collections:
- - infinidat.infinibox
tasks:
- - name: POSITIVE test -> Remove thin volume {{ auto_prefix }}vol under pool {{ auto_prefix }}pool
- infini_vol:
+ - name: POSITIVE test -> Remove thin volume
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol"
pool: "{{ auto_prefix }}pool"
state: absent
@@ -14,8 +13,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: IDEMPOTENT test -> Remove volume {{ auto_prefix }}vol under pool {{ auto_prefix }}pool again
- infini_vol:
+ - name: IDEMPOTENT test -> Remove volume again
+ infinidat.infinibox.infini_vol:
name: "{{ auto_prefix }}vol"
pool: "{{ auto_prefix }}pool"
state: absent
@@ -23,8 +22,8 @@
password: "{{ password }}"
system: "{{ system }}"
- - name: POSITIVE test -> Remove pool {{ auto_prefix }}pool
- infini_pool:
+ - name: POSITIVE test -> Remove pool
+ infinidat.infinibox.infini_pool:
name: "{{ auto_prefix }}pool"
state: absent
user: "{{ user }}"
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_remove_users_repository.yml b/ansible_collections/infinidat/infinibox/playbooks/test_remove_users_repository.yml
new file mode 100644
index 000000000..11106b4b3
--- /dev/null
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_remove_users_repository.yml
@@ -0,0 +1,80 @@
+---
+# PSDEV-1108: Playbook for testing cleanup of metadata resources.
+- name: Test remove users repository
+ hosts: localhost
+ gather_facts: false # Required for ansible_date_time
+
+ tasks:
+ - name: Remove system metadata key named sysfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "system"
+ key: "sysfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Remove volume named foo metadata key named volfoo
+ infinidat.infinibox.infini_metadata:
+ object_type: "vol"
+ object_name: "{{ auto_prefix }}vol"
+ key: "volfoo"
+ state: "absent"
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+ register: metadata_out
+
+ - name: Delete volume snapshot
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}volsnap"
+ pool: "{{ auto_prefix }}pool"
+ volume_type: "snapshot"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Delete volume
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}vol"
+ pool: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ # TODO Delete fs snap. See psdev-1121.
+
+ - name: Delete file system
+ infinidat.infinibox.infini_fs:
+ name: "{{ auto_prefix }}fs"
+ pool: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Delete host
+ infinidat.infinibox.infini_host:
+ name: "{{ auto_prefix }}host"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Delete cluster
+ infinidat.infinibox.infini_cluster:
+ name: "{{ auto_prefix }}cluster"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: Delete pool
+ infinidat.infinibox.infini_pool:
+ name: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
diff --git a/ansible_collections/infinidat/infinibox/playbooks/test_remove_volumes.yml b/ansible_collections/infinidat/infinibox/playbooks/test_remove_volumes.yml
new file mode 100644
index 000000000..728e45eb9
--- /dev/null
+++ b/ansible_collections/infinidat/infinibox/playbooks/test_remove_volumes.yml
@@ -0,0 +1,34 @@
+---
+# See PSDEV-1000: Fix infini_vols handling of write_protected parameter
+# Remove three volumes: vol_nonwriteable, vol_explicitly_writable and vol_writable.
+- name: Test remove volumes
+ hosts: localhost
+ gather_facts: false
+ tasks:
+
+ - name: POSITIVE test -> Remove write protected volume
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}vol_nonwriteable"
+ pool: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Remove explicitly writable volume
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}vol_explicitly_writable"
+ pool: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"
+
+ - name: POSITIVE test -> Remove implicitly writable volume
+ infinidat.infinibox.infini_vol:
+ name: "{{ auto_prefix }}vol_writable"
+ pool: "{{ auto_prefix }}pool"
+ state: absent
+ user: "{{ user }}"
+ password: "{{ password }}"
+ system: "{{ system }}"