pythonansiblenetapp

ansible with solidfire for netapp


I have a sample netapp playbook

 ---
    - hosts: all
      gather_facts: False
      become: yes
      become_user: root
      become_method: sudo

      tasks:
        - name: Start restore
          na_elementsw_snapshot_restore:
            hostname: "{{ip_adr}}"
            username: "{{username}}"
            password: ""
            account_id: ansible-1
            src_snapshot_id: snapshot_20171021
            src_volume_id: volume-playarea
            dest_volume_name: dest-volume-area

and this inventory file

 snaptest ansible_host=192.168.1.10 ansible_connection=ssh ansible_user=centos ansible_ssh_private_key_file=/home/slenz/.ssh/id_vm_sync ansible_python_interpreter=/usr/bin/python2.7


[snap]
snaptest

when I run the playbook I get

 fatal: [snaptest]: FAILED! => {"changed": false, "msg": "the python SolidFire SDK module is required"}

However I did install solidfire via pip

 Requirement already satisfied: solidfire-sdk-python in /usr/lib/python2.7/site-packages (1.5.0.87)
 Requirement already satisfied: setuptools>=19.2 in /usr/lib/python2.7/site-packages (from solidfire-sdk-python) (41.0.1)
 Requirement already satisfied: future>=0.15.2 in /usr/lib/python2.7/site-packages (from solidfire-sdk-python) (0.17.1)
 Requirement already satisfied: enum34>=1.1.6 in /usr/lib/python2.7/site-packages (from solidfire-sdk-python) (1.1.6)
 Requirement already satisfied: requests>=2.9.1 in /usr/lib/python2.7/site-packages (from solidfire-sdk-python) (2.22.0)
 Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->solidfire-sdk-python) (3.0.4)
 Requirement already satisfied: idna<2.9,>=2.5 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->solidfire-sdk-python) (2.8)
 Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->solidfire-sdk-python) (1.25.3)
 Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->solidfire-sdk-python) (2019.3.9)

Now my question is why the ansible doesn't find the solidfire. I can open a python cli and do "import solidfire.common" and that works.

I am using ansible 2.8.0, centos7 and python 2.7.5

Thank you for any help.


Solution

  • There is only one module that returns the python SolidFire SDK module is required message.

    It's the ansible/module_utils/netapp.py module.

    The condition that returns this error message (if false) is:

    if HAS_SF_SDK and hostname and username and password:

    So if your password field is empty ("" is considered false by Python), you will get this error.