I tried to import ansible.runner in a Python script but I get the following error:

Traceback (most recent call last):
  File "./boot-device.py", line 5, in 
    import ansible.runner
ImportError: No module named runner

When I search the ansible package, I can not find any file called runner.

I have installed ansible and python 2.7.5-5ubuntu3.

Which package I need to use Ansible's runner module?

1 Answer 1


There is an issue at Ansible's GitHub repository about this. The runner module does not exist anymore because of backward-incompatible changes in Ansible's Python API. You would have to change your script accordingly as detailed in Ansible's documentation about its Python API.

P.S.: I was considering providing actual code for the changes you need to make but that would seem out of scope for Ask Ubuntu and would fit in better at Stack Overflow. If you have questions about Ansible's Python API, you should ask them at Stack Overflow.

  • This means the simple runner examples, one can find on the net, are all obsolete?
    – ceving
    Sep 15, 2016 at 7:50
  • @ceving I would imagine so since you can't even import the runner module anymore unless you make sure you are using the pre-2.0 version of Ansible's Python API.
    – edwinksl
    Sep 15, 2016 at 7:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .