Minimal Python need for the "agent"

163 views
Skip to first unread message

Ronaldo Afonso

unread,
Mar 30, 2015, 10:42:21 AM3/30/15
to ansible...@googlegroups.com
  Hi all,

  I'm new to Ansible and I'd like to know what is the really Minimal Python, and modules, needed for the "agent"?

  I'm planning on running Ansible against an OpenWRT router that usually has very low flash memory (HD).

  Any help would be appreciated.

  Thanks ...

[]s
Ronaldo

James Cammarata

unread,
Mar 30, 2015, 11:17:48 AM3/30/15
to ansible...@googlegroups.com
Hi Ronaldo, this is covered in the "Managed Node Requirements" section of our documentation: http://docs.ansible.com/intro_installation.html#managed-node-requirements

It's pretty minimal, as long as you're not executing any modules remotely, which may have additional requirements (ie. ec2 modules), not that I'd expect that in your situation.

Hope that helps!

James Cammarata
Director, Ansible Core Engineering
github: jimi-c

--
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/7714b865-bfb0-4f46-ba8a-fa97e9d6016e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Toshio Kuratomi

unread,
Mar 30, 2015, 11:21:00 AM3/30/15
to ansible...@googlegroups.com
The Python-2.4 interpreter is the minimal version of python needed to
run ansible on the managed nodes (If using python2.4 or 2.5, you also
need the simplejson module installed). Python-2.6 is needed on the
controller. You do not need to install ansible or any of its modules
on the managed node, ansible will copy the ansible modules to the
node. Some modules may need third party python libraries installed on
the managed node -- you would need to install those in order for those
specific ansible modules to work.

If openwrt gives you the option of only installing a portion of the
python stdlib I'm afraid I don't know which portions you will need and
which you won't. There are a few that everyone will need (Things to
handle checksumming and file operations, for instance) but other parts
of the stdlib can be left out or left out if you turn off some default
ansible features (like ansible fact checking).

-Toshio

Ronaldo Afonso

unread,
Mar 31, 2015, 1:36:18 PM3/31/15
to ansible...@googlegroups.com
 Hi James,

 Actually I was looking for some answer like:

  "What is needed is python 2.7 and modules: locale, encoding, sys, etc ...".

 The thing is, I know I can use the "raw" and/or "script" ansible modules with no python as an agente, but I feel like using the whole power of Ansible modues.

 I hava a very strict space on flash and I'm not able to put a "minimum python" that can even run an "ansible ping" module.

[]s
Ronaldo 

Brian Coca

unread,
Mar 31, 2015, 1:46:16 PM3/31/15
to ansible...@googlegroups.com
you don't requrie 2.7, you need at most 2.6 for machine from which you
execute ansible from, 2.4 on target (openwrte) + a json library
(simplejson). Some modules may have additional requirements.

On my openwrt I have no issues with the existing python, I also don't
use too many modules on it, mostly template and copy.

--
Brian Coca

Ronaldo Afonso

unread,
Apr 1, 2015, 10:08:47 AM4/1/15
to ansible...@googlegroups.com
  Hi Brian,

  I'm using the latest trunk version of OpenWRT in a 4MBytes flash router.

  I installed the python-base package in this router and when I try to run a "ansible ping module" I get a "Could not load locale module".

  I checked the router and the "locale" module was really not installed.

  So, at this moment I'm trying to create a OpenWRT python package that includes the python locale module.

p.s) If I had a bigger flash I could put the whole python and use ansible to "provision" my routers.
   


--
Brian Coca

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/hcPumV2dyS4/unsubscribe.
To unsubscribe from this group and all its topics, 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.



--
Ronaldo Afonso
11 9 5252 0484

Brian Coca

unread,
Apr 1, 2015, 10:44:21 AM4/1/15
to ansible...@googlegroups.com
That is probably it, i got the 1gb card which gives me a lot of leeway
to install stuff.


--
Brian Coca

Toshio Kuratomi

unread,
Apr 1, 2015, 10:45:26 AM4/1/15
to ansible...@googlegroups.com
On Wed, Apr 1, 2015 at 7:08 AM, Ronaldo Afonso
<ron...@ronaldoafonso.com.br> wrote:
> Hi Brian,
>
> I'm using the latest trunk version of OpenWRT in a 4MBytes flash router.
>
> I installed the python-base package in this router and when I try to run a
> "ansible ping module" I get a "Could not load locale module".
>
> I checked the router and the "locale" module was really not installed.
>
> So, at this moment I'm trying to create a OpenWRT python package that
> includes the python locale module.
>
> p.s) If I had a bigger flash I could put the whole python and use ansible to
> "provision" my routers.
>
Just to be sure, you are running ansible locally (on a laptop or
desktop with a full python install) and attempting to configure the
router from there? And your ansible command line is really "ansible
ROUTER_NAME -m ping" right?

In OpenWRT's barrier breaker release, they have a minimal python
package labelled "python-mini" and a complete package called "python"
You may be able to figure out how to unpack the python opkg and grab
the modules you need from there. (I haven't looked at the internals of
opkg, though, so I don't know what format they use).

For a first approximation of the modules you'll need to run any given
module, grep on the ansible source is probably the best bet. For
instance for ping:


$ cd /usr/lib/python2.7/site-packages/ansible/
$ grep import modules/core/system/ping.py
import exceptions
from ansible.module_utils.basic import *
# module_utils.basic is needed by all ansible modules, so you'll need
the modules it imports as well:
$ grep import module_utils/basic.py
[...]


Anything at the toplevel when you grep is being imported
unconditionally so you'll definitely need it. imports that are
indented are either needed only in certain situations (for instance,
selinux is only needed if you're trying to manage an selinu enabled
system. So not needed for openwrt) or are alternatives to each other
(for instance you need either json on simplejson but not both).

-Toshio

Ronaldo Afonso

unread,
Apr 1, 2015, 10:51:52 AM4/1/15
to ansible...@googlegroups.com
  Hi Toshio,
  
  Yes, I'm running ansible from my laptop that is a Debian with a full python 2.7 release.

  I'll take a look at the site-packages/ansible and check if I need to create a OpenWRT python package, probably I'll need it.

  Thanks for your anwser.
 
  
  


-Toshio

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/hcPumV2dyS4/unsubscribe.
To unsubscribe from this group and all its topics, 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.

Brian Coca

unread,
Apr 1, 2015, 11:21:35 AM4/1/15
to ansible...@googlegroups.com
Keep us posted, this might be a nice thing to add to a FAQ or HowTo.



--
Brian Coca
Reply all
Reply to author
Forward
0 new messages