Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ansible / infinidat / infinibox / playbooks / test_create_map_cluster.yml
Size: Mime:
---
- hosts: localhost
  gather_facts: False
  tasks:

  - name: NEGATIVE test -> Map volume {{ auto_prefix }}vol specifying both a cluster and a host
    infini_map:
      host: "{{ auto_prefix }}host1"
      cluster: "{{ auto_prefix }}cluster"
      volume: "{{ auto_prefix }}vol"
      state: present
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"
    register: result
    failed_when:
      - '"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:
      host: "{{ auto_prefix }}host1"
      cluster: "{{ auto_prefix }}cluster"
      volume: "{{ auto_prefix }}vol"
      state: absent
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"
    register: result
    failed_when:
      - '"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:
      host: "{{ auto_prefix }}host1"
      cluster: "{{ auto_prefix }}cluster"
      volume: "{{ auto_prefix }}vol"
      state: stat
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"
    register: result
    failed_when:
      - '"both to be provided" not in result.msg'
      - not result.failed

  - name: POSITIVE test -> Create pool {{ auto_prefix }}pool
    infini_pool:
      name: "{{ auto_prefix }}pool"
      size: 1TB
      vsize: 1TB
      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: "{{ auto_prefix }}vol"
      size: 1GB
      pool: "{{ auto_prefix }}pool"
      state: present
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"

  - name: POSITIVE test -> Create host {{ auto_prefix }}host1 for cluster mapping
    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: "{{ 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: "{{ 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: "{{ auto_prefix }}cluster"
      cluster_hosts:
        - host_name: "{{ auto_prefix }}host1"
          host_cluster_state: present
        - host_name: "{{ auto_prefix }}host2"
          host_cluster_state: present
      state: present
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"

  - name: POSITIVE test -> Map volume {{ auto_prefix }}vol to cluster {{ auto_prefix }}cluster
    infini_map:
      cluster: "{{ auto_prefix }}cluster"
      volume: "{{ auto_prefix }}vol"
      state: present
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"

  - name: IDEMPOTENT test -> Map volume {{ auto_prefix }}vol to cluster {{ auto_prefix }}cluster again
    infini_map:
      cluster: "{{ auto_prefix }}cluster"
      volume: "{{ auto_prefix }}vol"
      state: present
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"
    register: result
    failed_when:
      - '"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:
      cluster: "{{ auto_prefix }}cluster"
      volume: "{{ auto_prefix }}vol"
      state: stat
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"
    register: cluster_stat

  - name: POSITIVE test -> Show map stat
    debug:
      msg: "Map stat: {{ cluster_stat }}"

  - name: POSITIVE test -> Map volume {{ auto_prefix }}vol to host {{ auto_prefix }}host3
    infini_map:
      host: "{{ auto_prefix }}host3"
      volume: "{{ auto_prefix }}vol"
      state: present
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"

  - name: IDEMPOTENT test -> Map volume {{ auto_prefix }}vol to host {{ auto_prefix }}host3 again
    infini_map:
      host: "{{ auto_prefix }}host3"
      volume: "{{ auto_prefix }}vol"
      state: present
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"
    register: result
    failed_when:
      - '"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:
      host: "{{ auto_prefix }}host3"
      volume: "{{ auto_prefix }}vol"
      state: stat
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"
    register: host_stat

  - name: POSITIVE test -> Show map stat
    debug:
      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:
      host: "{{ auto_prefix }}host1"
      volume: "{{ auto_prefix }}vol"
      state: present
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"
    register: result
    failed_when:
      - '"already exists using" not in result.msg'
      - 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:
      host: "{{ auto_prefix }}host3"
      volume: "{{ auto_prefix }}vol"
      lun: 99
      state: present
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"
    register: new_lun_fail
    failed_when:
      - '"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:
      host: "{{ auto_prefix }}host3"
      volume: "{{ auto_prefix }}vol"
      state: absent
      user: "{{ user }}"
      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:
      host: "{{ auto_prefix }}host3"
      volume: "{{ auto_prefix }}vol"
      lun: 99
      state: present
      user: "{{ user }}"
      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:
      host: "{{ auto_prefix }}host3"
      volume: "{{ auto_prefix }}vol"
      state: stat
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"
    register: new_lun_success
    failed_when:
      - '"using lun 99" not in new_lun_success.msg'
      - new_lun_success.volume_lun != 99

  - name: POSITIVE test -> Show lun mapping message
    debug:
      msg: "Changed lun mapping message: {{ new_lun_success.msg }}"
### 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:
      cluster: "{{ auto_prefix }}cluster"
      volume: "{{ auto_prefix }}vol"
      lun: 98
      state: present
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"
    register: new_lun_fail
    failed_when:
      - '"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:
      cluster: "{{ auto_prefix }}cluster"
      volume: "{{ auto_prefix }}vol"
      state: absent
      user: "{{ user }}"
      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:
      cluster: "{{ auto_prefix }}cluster"
      volume: "{{ auto_prefix }}vol"
      lun: 98
      state: present
      user: "{{ user }}"
      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:
      cluster: "{{ auto_prefix }}cluster"
      volume: "{{ auto_prefix }}vol"
      state: stat
      user: "{{ user }}"
      password: "{{ password }}"
      system: "{{ system }}"
    register: new_lun_success
    failed_when:
      - '"using lun 98" not in new_lun_success.msg'
      - new_lun_success.volume_lun != 98

  - name: POSITIVE test -> Show lun mapping message
    debug:
      msg: "Changed lun mapping message: {{ new_lun_success.msg }}"
### End test mapping of volume to a cluster using specified lun.