purestorage sdk missing

226 views
Skip to first unread message

Lucas Possamai

unread,
Apr 4, 2019, 12:35:55 AM4/4/19
to ansible...@googlegroups.com
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!

Raghavendra Rao

unread,
Apr 4, 2019, 2:45:15 AM4/4/19
to ansible...@googlegroups.com
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

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAE_gQfUdPurAMF9Q4mpProD4BeGjDbaJ5tSqwqXekUMAC%2Bf4Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Lucas Possamai

unread,
Apr 4, 2019, 3:24:43 AM4/4/19
to ansible...@googlegroups.com
On Thu, 4 Apr 2019 at 19:45, Raghavendra Rao <raghaven...@gmail.com> wrote:
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:
 

David Baumann

unread,
Apr 4, 2019, 1:15:04 PM4/4/19
to Ansible Project
Maybe forgot a delegate_to and you execure the module on remote host?

Lucas Possamai

unread,
Apr 4, 2019, 6:07:01 PM4/4/19
to ansible...@googlegroups.com
On Fri, 5 Apr 2019 at 06:15, David Baumann <da...@tsb.at> wrote:
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:
---
# Perform PURE Flasharray Database snapshots
- name: perform PURE volume snapshot
  purefa_snap:
    name: Oracle/db2-prod-oracledb
    suffix: snap
    fa_url: "{{ fa_url }}"
    api_token: "{{ apiToken }}"

 

Kai Stian Olstad

unread,
Apr 5, 2019, 3:57:31 AM4/5/19
to ansible...@googlegroups.com
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).

--
Kai Stian Olstad

Lucas Possamai

unread,
Apr 5, 2019, 6:05:44 AM4/5/19
to ansible...@googlegroups.com
On Fri, 5 Apr 2019 at 20:57, Kai Stian Olstad <ansible-pr...@olstad.com> wrote:
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).


OKay... so... 
As you can see in the task and in the link I've provided, I'm using the Pure Storage ansible module,  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"

Jonathan Lozada De La Matta

unread,
Apr 5, 2019, 8:58:18 AM4/5/19
to ansible...@googlegroups.com
how did you install the python library purestorage ?


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--

Jonathan lozada de la matta

AUTOMATION PRACTICE



 

Lucas Possamai

unread,
Apr 5, 2019, 6:10:11 PM4/5/19
to ansible...@googlegroups.com
On Sat, 6 Apr 2019 at 01:58, Jonathan Lozada De La Matta <jloz...@redhat.com> wrote:
how did you install the python library purestorage ?


pip install purestorage 

Jonathan Lozada De La Matta

unread,
Apr 5, 2019, 6:32:10 PM4/5/19
to ansible...@googlegroups.com
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 ?

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Lucas Possamai

unread,
Apr 5, 2019, 11:17:23 PM4/5/19
to ansible...@googlegroups.com
On Sat, 6 Apr 2019 at 11:32, Jonathan Lozada De La Matta <jloz...@redhat.com> wrote:
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.
 

Lucas Possamai

unread,
Apr 6, 2019, 1:04:43 AM4/6/19
to ansible...@googlegroups.com
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!

Kai Stian Olstad

unread,
Apr 6, 2019, 6:30:17 AM4/6/19
to ansible...@googlegroups.com
> 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.

--
Kai Stian Olstad

Lucas Possamai

unread,
Apr 6, 2019, 7:21:12 AM4/6/19
to ansible...@googlegroups.com
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

Kai Stian Olstad

unread,
Apr 6, 2019, 8:32:33 AM4/6/19
to ansible...@googlegroups.com
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'"


--
Kai Stian Olstad

Lucas Possamai

unread,
Apr 6, 2019, 11:10:23 PM4/6/19
to ansible...@googlegroups.com
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 "<string>", line 2, in <module>
ImportError: No module named purestorage

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

Kai Stian Olstad

unread,
Apr 7, 2019, 1:21:31 AM4/7/19
to ansible...@googlegroups.com
On 07.04.2019 05:09, Lucas Possamai wrote:
>
> 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 "<string>", line 2, in <module>
> ImportError: No module named purestorage
>
>
> Thanks for your help. Will try to get this python issue fixed.

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

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages