On Wed, Apr 1, 2015 at 7:08 AM, Ronaldo Afonso
<[email protected]> 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

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAG9juEpO4S%2Bfr1CGp-3qFeUurpAC%2BfDCj4ewKQ9dXkC5a%2Bfk3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to