# purestorage sdk missing

**URL:** <https://forum.ansible.com/t/purestorage-sdk-missing/30055>\
**Category:** Ansible Project\
**Created:** [April 4, 2019, 4:35am UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055 "2019-04-04T04:35:09Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucas\_Possamai](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lucas\_Possamai](https://forum.ansible.com/u/Lucas_Possamai)\
**Post date:** [April 4, 2019, 4:35am UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/1 "2019-04-04T04:35:09Z")

</div>

Hi guys.

When calling a playbook I get the following error:

FAILED! =\> {“changed”: false, “msg”: “purestorage sdk is required for this module in volume”}

Purestorage sdk is installed in my laptop (i’m running that locally):  
purestorage (1.16.0)

ansible 2.7.9  
config file = /etc/ansible/ansible.cfg  
configured module search path = [u’/home/lucas/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]  
ansible python module location = /home/lucas/.local/lib/python2.7/site-packages/ansible  
executable location = /usr/bin/ansible  
python version = 2.7.15+ (default, Oct 2 2018, 22:12:08) [GCC 8.2.0]

What could that error be for?  
Thanks!

---

<div class="post-metadata">

**Author:** ![Raghavendra\_Rao](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Raghavendra\_Rao](https://forum.ansible.com/u/Raghavendra_Rao)\
**Post date:** [April 4, 2019, 6:44am UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/2 "2019-04-04T06:44:50Z")

</div>

Make sure you have the respective purestorage python library.

Also, set `PUREFA_URL` and `PUREFA_API` environment variables if _url_ and _api\_token_ arguments are not passed to the module directly.

-R.Rao

---

<div class="post-metadata">

**Author:** ![Lucas\_Possamai](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lucas\_Possamai](https://forum.ansible.com/u/Lucas_Possamai)\
**Post date:** [April 4, 2019, 7:23am UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/3 "2019-04-04T07:23:56Z")

</div>

> Make sure you have the respective purestorage python library.

I already have it.

[lucas@thanos ~]$ pip list | grep ‘purestorage’  
purestorage (1.16.0)

> Also, set `PUREFA_URL` and `PUREFA_API` environment variables if _url_ and _api\_token_ arguments are not passed to the module directly.

url and api\_token are passed to the module:

---

<div class="post-metadata">

**Author:** ![David\_Baumann](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@David\_Baumann](https://forum.ansible.com/u/David_Baumann)\
**Post date:** [April 4, 2019, 5:15pm UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/4 "2019-04-04T17:15:03Z")

</div>

Maybe forgot a delegate\_to and you execure the module on remote host?

---

<div class="post-metadata">

**Author:** ![Lucas\_Possamai](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lucas\_Possamai](https://forum.ansible.com/u/Lucas_Possamai)\
**Post date:** [April 4, 2019, 10:06pm UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/5 "2019-04-04T22:06:15Z")

</div>

> Maybe forgot a delegate\_to and you execure the module on remote host?

I am not executing the module on remote host. It is locally.

This is the yaml file:

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [April 5, 2019, 7:57am UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/6 "2019-04-05T07:57:21Z")

</div>

This code doesn't prove that's running locally.

modules will only run on localhost if the playbook have "hosts: localhost" or "connection: local".  
If not, the module will run on remote host(s) unless you have "delegate\_to: localhost" on the task(s).

---

<div class="post-metadata">

**Author:** ![Lucas\_Possamai](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lucas\_Possamai](https://forum.ansible.com/u/Lucas_Possamai)\
**Post date:** [April 5, 2019, 10:04am UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/7 "2019-04-05T10:04:56Z")

</div>

OKay… so…  
As you can see in the task and in the link I’ve provided, I’m using the [Pure Storage ansible module](https://docs.ansible.com/ansible/latest/modules/purefa_snap_module.html?highlight=pure%20storage), which will connect to the SAN Storage array via a REST API and will execute the commands I want.  
So, I am running the Task locally and then it will connect to the Array and to its thing.

However, note that the task doesn’t even get connected to the array as it fails before that. I do not see connection attempts in the Array.

What I know so far:

1. I am running Ansible 2.7
2. I have Python 2.7 installed
3. I have pip 2.7 installed
4. I have the purestorage python module (purestorage==1.16.0) installed
5. I am running the task locally.  
Still trying to figure out why I’m getting the error: “msg”: “purestorage sdk is required for this module in volume”

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lozada\_De\_L](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@Jonathan\_Lozada\_De\_L](https://forum.ansible.com/u/Jonathan_Lozada_De_L)\
**Post date:** [April 5, 2019, 12:57pm UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/8 "2019-04-05T12:57:49Z")

</div>

how did you install the python library purestorage ?

---

<div class="post-metadata">

**Author:** ![Lucas\_Possamai](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lucas\_Possamai](https://forum.ansible.com/u/Lucas_Possamai)\
**Post date:** [April 5, 2019, 10:09pm UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/9 "2019-04-05T22:09:25Z")

</div>

pip install purestorage

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lozada\_De\_L](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@Jonathan\_Lozada\_De\_L](https://forum.ansible.com/u/Jonathan_Lozada_De_L)\
**Post date:** [April 5, 2019, 10:31pm UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/10 "2019-04-05T22:31:49Z")

</div>

did you use a virtualenv? did you u do it as root? did you do it as your user? did you do pip install --user ?

---

<div class="post-metadata">

**Author:** ![Lucas\_Possamai](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lucas\_Possamai](https://forum.ansible.com/u/Lucas_Possamai)\
**Post date:** [April 6, 2019, 3:16am UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/11 "2019-04-06T03:16:38Z")

</div>

No. All I did was to run, as my user (not root), pip install purestorage. Nothing else.

---

<div class="post-metadata">

**Author:** ![Lucas\_Possamai](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lucas\_Possamai](https://forum.ansible.com/u/Lucas_Possamai)\
**Post date:** [April 6, 2019, 5:03am UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/12 "2019-04-06T05:03:57Z")

</div>

> > did you use a virtualenv? did you u do it as root? did you do it as your user? did you do pip install --user ?
> 
> No. All I did was to run, as my user (not root), pip install purestorage. Nothing else.

So… doing some tests.

Playbook is as follow:

> * * *
> 
> - name: Oracle Database Snapshots
> 
> hosts: dbservers
> 
> remote\_user: oracle
> 
> sudo: true
> 
> sudo\_user: root
> 
> vars\_files:
> 
> - vars/arrays.yaml
> 
> - vars/database.yaml
> 
> tasks:
> 
> # Take Snapshot of database volumes
> 
> - include: tasks/take\_snapshot.yaml
> 
> run\_once: yes

tasks/take\_snapshot.yaml:

> * * *
> 
> # Perform PURE Flasharray Database snapshots
> 
> - name: perform PURE volume snapshot
> 
> purefa\_snap:
> 
> name: db2-prod-oracledb
> 
> suffix: snap
> 
> fa\_url: “{{ fa\_url }}”
> 
> api\_token: “{{ apiToken }}”

Now, if I replace “ **hosts: dbservers** ” for “ **hosts: localhost** ”, it works. So that means it was indeed trying to connect to “ **dbservers** ” and then running the commands.  
I did check the dbservers host and I can see purestorage sdk is also installed there.

> oracle[DR]@db2:~$pip freeze |grep purestorage
> 
> DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won’t be maintained after that date. A future version of pip will drop support for Python 2.7.
> 
> purestorage==1.16.0

How can I fix the missing purestorage sdk error? It is an RHEL 6.7.  
Thanks!

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [April 6, 2019, 10:30am UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/13 "2019-04-06T10:30:08Z")

</div>

> So.. doing some tests.
> 
> Playbook is as follow:
> 
> ---  
> - name: Oracle Database Snapshots  
> &nbsp;&nbsp;hosts: dbservers  
> &nbsp;&nbsp;remote\_user: oracle  
> &nbsp;&nbsp;sudo: true  
> &nbsp;&nbsp;sudo\_user: root  
> &nbsp;&nbsp;vars\_files:  
> &nbsp;&nbsp;&nbsp;&nbsp;- vars/arrays.yaml  
> &nbsp;&nbsp;&nbsp;&nbsp;- vars/database.yaml
> 
> &nbsp;&nbsp;tasks:
> 
> # Take Snapshot of database volumes  
> &nbsp;&nbsp;&nbsp;&nbsp;- include: tasks/take\_snapshot.yaml  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;run\_once: yes
> 
> tasks/take\_snapshot.yaml:
> 
> ---  
> # Perform PURE Flasharray Database snapshots  
> - name: perform PURE volume snapshot  
> &nbsp;&nbsp;purefa\_snap:  
> &nbsp;&nbsp;&nbsp;&nbsp;name: db2-prod-oracledb  
> &nbsp;&nbsp;&nbsp;&nbsp;suffix: snap  
> &nbsp;&nbsp;&nbsp;&nbsp;fa\_url: "{{ fa\_url }}"  
> &nbsp;&nbsp;&nbsp;&nbsp;api\_token: "{{ apiToken }}"
> 
> Now, if I replace "\*hosts: dbservers\*" for "\*hosts: localhost\*", it works.  
> So that means it was indeed trying to connect to "\*dbservers\*" and then  
> running the commands.

As I explained to you in a previous mail 🙂  
This is how must modules work, they run on remote host unless hosts: localhost, connection: local or delegate\_to: localhost is set somewhere.

> I did check the dbservers host and I can see purestorage sdk is also  
> installed there.
> 
> oracle[DR]@db2:~$pip freeze |grep purestorage  
> DEPRECATION: Python 2.7 will reach the end of its life on January 1st,  
> 2020. Please upgrade your Python as Python 2.7 won't be maintained after  
> that date. A future version of pip will drop support for Python 2.7.  
> purestorage==1.16.0
> 
> How can I fix the missing purestorage sdk error? It is an RHEL 6.7.

Or just keep "hosts: dbservers" and add "delegate\_to: localhost" on the purefa\_snap task.  
Then you don't have to deal the SDK on the remote machine since the module Python code is run on localhost.

---

<div class="post-metadata">

**Author:** ![Lucas\_Possamai](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lucas\_Possamai](https://forum.ansible.com/u/Lucas_Possamai)\
**Post date:** [April 6, 2019, 11:20am UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/14 "2019-04-06T11:20:27Z")

</div>

> Or just keep “hosts: dbservers” and add “delegate\_to: localhost” on the  
> purefa\_snap task.  
> Then you don’t have to deal the SDK on the remote machine since the  
> module Python code is run on localhost.

The thing is… I want the playbook to be executed on the host (not locally). Testing it locally was only really a test to see where the problem is. So I need to fix the missing SDK error.

Lucas

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [April 6, 2019, 12:32pm UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/15 "2019-04-06T12:32:23Z")

</div>

It's more a Python problem than Ansible.  
Ansible is running /usr/bin/python so your module need to be install in one of it's search path.

To check the path you can run  
/usr/bin/python -c 'import sys; print sys.path'

If the path listed is one of the paths that purestorage is this command should work.

To check if you can import purestorage  
/usr/bin/python -c 'import purestorage'

You should also check from you Ansible control machine to rule out environment variables not set by running  
ssh \<user\>@\<dbserver\> "/usr/bin/python -c 'import sys; print sys.path; import purestorage'"

---

<div class="post-metadata">

**Author:** ![Lucas\_Possamai](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lucas\_Possamai](https://forum.ansible.com/u/Lucas_Possamai)\
**Post date:** [April 7, 2019, 3:09am UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/16 "2019-04-07T03:09:38Z")

</div>

> > > Or just keep “hosts: dbservers” and add “delegate\_to: localhost” on  
> > > the  
> > > purefa\_snap task.  
> > > Then you don’t have to deal the SDK on the remote machine since the  
> > > module Python code is run on localhost.
> > 
> > The thing is… I want the playbook to be executed on the host (not  
> > locally). Testing it locally was only really a test to see where the  
> > problem is. So I need to fix the missing SDK error.
> 
> It’s more a Python problem than Ansible.  
> Ansible is running /usr/bin/python so your module need to be install in  
> one of it’s search path.
> 
> To check the path you can run  
> /usr/bin/python -c ‘import sys; print sys.path’
> 
> If the path listed is one of the paths that purestorage is this command  
> should work.
> 
> To check if you can import purestorage  
> /usr/bin/python -c ‘import purestorage’
> 
> You should also check from you Ansible control machine to rule out  
> environment variables not set by running  
> ssh @ “/usr/bin/python -c ‘import sys; print sys.path;  
> import purestorage’”

It is definitely a Python problem than Ansible.

> [root@db2 ~]# /usr/bin/python -c 'import sys; print sys.path;
> 
> > import purestorage’
> 
> [‘’, ‘/usr/lib64/python26.zip’, ‘/usr/lib64/python2.6’, ‘/usr/lib64/python2.6/plat-linux2’, ‘/usr/lib64/python2.6/lib-tk’, ‘/usr/lib64/python2.6/lib-old’, ‘/usr/lib64/python2.6/lib-dynload’, ‘/usr/lib64/python2.6/site-packages’, ‘/usr/lib64/python2.6/site-packages/gtk-2.0’, ‘/usr/lib/python2.6/site-packages’]
> 
> Traceback (most recent call last):
> 
> File “”, line 2, in
> 
> ImportError: No module named purestorage

Thanks for your help. Will try to get this python issue fixed.  
Thanks!

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [April 7, 2019, 5:21am UTC](https://forum.ansible.com/t/purestorage-sdk-missing/30055/17 "2019-04-07T05:21:20Z")

</div>

Looks like you have Python 2.6 and 2.7 installed and that /usr/bin/python is 2.6 but purestorage is installed in 2.7.  
To make Ansible use another Python than /usr/bin/python check out ansible\_python\_interpreter  
[https://docs.ansible.com/ansible/latest/reference\_appendices/faq.html#how-do-i-handle-python-not-having-a-python-interpreter-at-usr-bin-python-on-a-remote-machine](https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-handle-python-not-having-a-python-interpreter-at-usr-bin-python-on-a-remote-machine)
