Ansible 2.0 -- "shade is required for this module"

7,658 views
Skip to first unread message

Chris Gordon

unread,
Jul 29, 2015, 3:26:48 PM7/29/15
to Ansible Project
I'm trying to use the os_server module in Ansible 2.0 and get the following error:

fatal: [jump]: FAILED! => {"changed": false, "failed": true, "msg": "shade is required for this module"}

Here's what I have:

- Python 2.7.10 (Mac, installed via Homebrew)
- Using a virtual environment.
- shade installed in venv via pip (pulled all of it's dependencies, at least as far as I can tell)
- Ansible cloned from git, devel branch at commit 8798ce1973a5fd0f8d84e001281699337ddabda4
- Installed ansible 2.0 by "python setup.py install" from the venv python interpreter.  It installed in site-packages as expected.

With python in the venv, I can import shade without a problem and create some shade objects.

I'm just starting to test with 2.0, so I have a very simply playbook calling just a single role with a single task.  My Openstack.rc file is sourced and present in my environment.  Other openstack cli tools (nova, neutron, etc.) work fine, so I don't include an auth dictionary in the task.

Playbook:

-   hosts: jump
    connection: local
    roles:
        -   create_vm


create_vm role's task:

-   os_server:
        state: present
        name:  jump
        image: centos7u1-cloud
        flavor: ostck.t2.v3.small
        key_name:  mykeyname
        nics:
            -  net-name:  priv_net
        meta:
            group: jump



Any ideas?  Happy to provide more details or test anything.

Thanks,
Chris

Guido García

unread,
Aug 11, 2015, 10:59:47 AM8/11/15
to Ansible Project
Hi Chris. Same here. Did you manage to fix this issue? Thanks.

David Shrewsbury

unread,
Aug 13, 2015, 3:26:32 PM8/13/15
to Ansible Project
The problem is your environment. I use Python from Homebrew, but I don't
use a virtualenv b/c it's hard to make ansible play nicely with that.

When ansible connects to the host, 'jump' for you, it's going to automatically
use the system python. You can set a different interpreter by adding this to
your ansible hosts file for the 'jump' host:

jump  ansible_python_interpreter=/path/to/python

The path should point to the interpreter that has shade installed.

Alternatively, install shade in the system python.

-Dave

Aaron Trout

unread,
Aug 13, 2015, 3:26:33 PM8/13/15
to Ansible Project
Exact same setup, same problem. I opened an issue on Github but it got shot down :-)

Maybe if this is an actual problem it can get re-opened: https://github.com/ansible/ansible-modules-core/issues/1910

Aaron

James Martin

unread,
Aug 14, 2015, 1:12:16 PM8/14/15
to Ansible Project
If you've installed shade into a virtualenv on your ansible control machine, you may need to tell ansible to use that virtualenv in order to detect it.  I've done it like so in my hosts file for other modules (like boto):

localhost ansible_python_interpreter="/usr/bin/env python"

- James


On Wednesday, July 29, 2015 at 3:26:48 PM UTC-4, Chris Gordon wrote:

Guido García

unread,
Aug 14, 2015, 3:36:11 PM8/14/15
to Ansible Project
Thanks James. Now it works like a charm.

zer...@issany.net

unread,
Jul 21, 2016, 4:24:50 PM7/21/16
to Ansible Project
Hi, forgive me for my bad english.

I have exactly the same problem with ansible 2.2 and python 2.7. All packages are installed in system, no venv but ansible continue with
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "shade is required for this module"}

I know this post is already solved since 2015, but if someone could help me ...

Thanks.
Message has been deleted

navdeep uniyal

unread,
Jul 28, 2016, 8:28:55 AM7/28/16
to Ansible Project

Could you resolve the issue? If yes, please share the solution here. I am not using virtualenv, still getting the same issue.

Thank you

Amit Chaudhary

unread,
Sep 23, 2016, 11:24:41 PM9/23/16
to Ansible Project
I am having the same issue, where it gives error regarding shade. I have tried running in virtalenv also but no luck.

Amit Chaudhary

unread,
Sep 23, 2016, 11:24:41 PM9/23/16
to Ansible Project


On Wednesday, July 29, 2015 at 3:26:48 PM UTC-4, Chris Gordon wrote:

Richard Eggert

unread,
Sep 26, 2016, 12:40:35 PM9/26/16
to Ansible Project
Same issue here, but I did some experimenting to see what the problem is. I found that running the following command:
python -c "import shade"
provided a lot of useful information about why it wasn't loading the shade library.


~Rich

Richard Eggert

unread,
Sep 26, 2016, 12:55:24 PM9/26/16
to Ansible Project
In my case, the file permissions were wrong on some of the package directories that pip had created in site-packages, and one undeclared transitive dependency (importlib) was missing.

unixfox Emilien

unread,
Dec 4, 2016, 9:30:25 PM12/4/16
to Ansible Project
Try installing ansible using pip because I don't know why the python environment of the ansible package provided by my distro (ArchLinux) isn't the same as the shade module (installed using pip).

jordi...@scytl.com

unread,
Jul 18, 2017, 11:13:35 AM7/18/17
to Ansible Project
Thanks Richard that helped a lot!!
Reply all
Reply to author
Forward
0 new messages