- name: Perform pre-deployment validations
  hosts: localhost
  gather_facts: yes
  any_errors_fatal: true
  tasks:

      - name: "Install/Upgrade are mutually exclusive"
        fail:
            msg: "Options '--deploy' and '--upgrade' and '--ocupdate' are mutually exclusive"
        when:
            - ( install.deploy|default('') and install.upgrade|default('')) or
              ( install.deploy|default('') and install.ocupdate|default(False)) or
              ( install.upgrade|default('') and install.ocupdate|default(False))

      - name: validate storage nodes
        fail:
            msg: "To many storage nodes to discover storage backend. Provide --storage-backend cli option with the backend to use. "
        when:
            - install.deploy|default('')
            - not (install.storage|default({})).backend|default(False)
            - "'swift' in groups"
            - "'ceph' in groups"

      - block:
          - name: validate storage-config option is provided
            fail:
                msg: "The --storage-config cli option should be provided for external storage backend when --storage-external is used. "
            when:
                - install.storage.config == 'internal'

          - name: check if user provided external storage config
            stat:
                path: "{{ install.storage.config }}"
            register: install_storage_config_file

          - fail:
                msg: "The file for external storage config is not found. Expected path: {{ install.storage.config }}"
            when:
                - install_storage_config_file.stat.exists == False

        when:
            - install.deploy|default('')
            - install.storage.external

- name: Perform pre-deployment validations
  hosts: localhost
  gather_facts: yes
  any_errors_fatal: true
  tasks:

      - name: "Install/Upgrade are mutually exclusive"
        fail:
            msg: "Options '--deploy' and '--upgrade' and '--ocupdate' are mutually exclusive"
        when:
            - ( install.deploy|default('') and install.upgrade|default('')) or
              ( install.deploy|default('') and install.ocupdate|default(False)) or
              ( install.upgrade|default('') and install.ocupdate|default(False))

      - name: validate storage nodes
        fail:
            msg: "To many storage nodes to discover storage backend. Provide --storage-backend cli option with the backend to use. "
        when:
            - install.deploy|default('')
            - not (install.storage|default({})).backend|default(False)
            - "'swift' in groups"
            - "'ceph' in groups"

Revert "Netapp backend job should fail if no netapp backend is available"
Revert "Netapp backend job should fail if no netapp backend is available"

This reverts commit c347c76f0a09b673244b937d3e2fdf5070ef5408.

Change-Id: I05e769cfc71a6359586465507d87a05bb29f2dc9
