IT automation platform
Source Code: https://github.com/ansible/ansible
It looks like Ansible is currently available in Termux through Arch Linux PRoot. This script is designed to install Arch Linux in just a few keystrokes. Tapping this link https://sdrausty.github.io/TermuxArch/setupTermuxArch.sh will transfer setupTermuxArch.sh to your device. Simply run bash ~/storage/downloads/setupTermuxArch.sh to install Arch Linux in Termux. To install use pacman -S ansible and this will install Ansible on device.

Why I have to use an Arch Linux chroot inside termux?
@elroncio You don't have to. Ansible may eventually be packaged natively. This is just one possible solution to run it today.
@Neo-Oli I can give a try at compiling!
@Neo-Oli I know, but I don't understand why this could be a good solution. I could also run a chroot with any other linux version, but I don't see the point in doing so.
@elroncio I agree that it is a bad solution and would love to see Ansible becoming available in Termux.
I tried pip2 install ansible and it goes on forever.
If anybody has more patience than me, does it install successfully?
@vishalbiswas It was quite fast for me, had to install the dependency pynacl using the steps in https://github.com/termux/termux-packages/issues/1628 but the actual installation of ansible finished without errors quite quick. I installed from the git repo instead of with pip though.
Importing it doesn't throw an error but I haven't tested it further.
(And since it seems to be quite easy to install through pip I guess we can close this package request, any objections?)
@elroncio @Neo-Oli is this solution inelegant? Possibly so. Is it a solution as both of you state? Answer a simple question. What is a bad solution?
@Grimler91 Maybe you could add a (short) wiki article outlining the steps to install it?
@Neo-Oli yeah that's a good idea. We can have a section for python packages that require special treatment.
@Neo-Oli @elroncio comments such as, "bad solution" are infantile, and achieve nothing good. Should such a statement be justified, an infantile comment is promoted to an educated constructive judgment which promotes an issue and our community. Justify your comments to improve our community and your answers as well. Answering simple questions is helpful too. It encourages dialogue.
This is my second question to both of you in this thread. @Neo-Oli @elroncio Do you understand and agree that stating a firm opinion without justification impinges on the validity of an expressed belief, and on the beholder of this opinion?
@sdrausty I think that everyone think that installing a chroot environment to be able to run a quite small package like ansible is a bit of an overkill.
Thanks for pointing out that it is available through arch in termux. Arch linux in termux is indeed helpful to run packages that aren't available natively in termux yet. Hopefully all package requests will all be available in termux natively sooner or later.
@Grimler91 I could not agree with you more. This is exactly why I posted this information in the first place; So that Termux users will know what is available. Thank you for your time and comments in this matter.
Running a flavor of Linux in Termux also assists in diagnostics. It answers a simple question. Does a package work in another OS on device in Termux? The quicker we can diagnose whether the problem is with Termux or the package in question, the faster we should create new packages for Termux. For example, today I ran svn in Termux and Termux PRoot for our community. It only works in PRoot https://github.com/termux/termux-packages/issues/1897.
debootstrap was debugged today in a similar fashion. It fails both in Termux and in Termux PRoot https://github.com/sp4rkie/debian-on-termux/issues/7 indicating that this issue is upstream, not a Termux issue at all it appears.
Closing this as we have outlined the steps on how to install it from pip (in short, first install pynacl following instructions in https://github.com/termux/termux-packages/issues/1628 and then install ansible through pip).
I can install ansible with pip but get this error when I run it

@tcaddy Python in Termux does not support sem_open()
Python in Termux does not support sem_open()
@xeffyr do you know whether this is also true with api 24?
The functions to implement Message Queues and Semaphore Arrays are not available before Nougat. So, this is not possible yet.
Maybe, when we make the minimum API Level 24.
Reference https://github.com/termux/termux-packages/issues/2427#issuecomment-389037334
@sdrausty It may be available only after recompiling python with api 24 enabled toolchain, currently it is built with api 21.
Any chance this sem_open thing can be fixed?
I'm on Oreo and running into it still, in this case with flake8.
ˋˋˋ
$ flake8 db.py
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/synchronize.py", line 28, in
from _multiprocessing import SemLock, sem_unlink
ImportError: cannot import name 'SemLock' from '_multiprocessing' (/data/data/com.termux/files/usr/lib/python3.7/lib-dynload/_multiprocessing.cpython-37m.so)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/bin/flake8", line 11, in
sys.exit(main())
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/flake8/main/cli.py", line 16, in main
app.run(argv)
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/flake8/main/application.py", line 412, in run
self._run(argv)
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/flake8/main/application.py", line 400, in _run
self.run_checks()
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/flake8/main/application.py", line 318, in run_checks
self.file_checker_manager.run()
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/flake8/checker.py", line 338, in run
self.run_parallel()
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/flake8/checker.py", line 286, in run_parallel
pool = multiprocessing.Pool(self.jobs, _pool_init)
File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/context.py", line 119, in Pool
context=self.get_context())
File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/pool.py", line 159, in __init__
self._setup_queues()
File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/pool.py", line 273, in _setup_queues self._inqueue = self._ctx.SimpleQueue() File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/context.py", line 112, in SimpleQueue
return SimpleQueue(ctx=self.get_context())
File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/queues.py", line 332, in __init__ self._rlock = ctx.Lock() File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/context.py", line 66, in Lock
from .synchronize import Lock
File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/synchronize.py", line 32, in
" synchronization primitives needed will not" +
ImportError: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.
ˋˋˋ
only way it could happen is if we compile python using api-24. Im not sure even then. I will investigate...
Yeah it won't work.
Any way to fix this? I run into this when I pip install ansible
https://pasteboard.co/HULFOIC.png
@rathel header files are in the -dev packages. You are missing openssl/opensslv.h so I would try to install openssl-dev.
Any known work arounds for this? I can install ansible cleanly but it can't run due to sem_open() which if I understand, the python multiprocessing on android is to blame.
no there aren't. Sem_open is not available.
Is there a previous version of ansible that does not rely on multiprocessing? I thought I had read that it was introduced in 1.9.x I'll try it tonight if I can
so
pip2 install 'ansible<1.9.0'
works well to get around the sem_open() and multiprocessing errors. Ansible now runs correctly. problem is it is so outdated none of the playbooks im trying work due to operations in 1.9.x and forward including 'become' and 'dnf'
could we get around the sem_open issue making an ansible branch for termux that replaces all the multiprocessing calls? Like in this issue: https://github.com/asciinema/asciinema/issues/271
For what it's worth you can give my alternative a try. It enables the usage of modern Ansible versions on Termux by creating a proot alpine image and installing ansible in it.
You can reach the host via SSH. It's a work in progress, but Ansible 2.8 and 2.9 work fine.
Why does it work in a proot?
Why does it work in a proot?
🤷♂️
I can confirm that python3's import multiprocess.synchronize definitely works within a proot-ed debian. Not sure why.
I can confirm that python3's import multiprocess.synchronize definitely imports properly within a proot-ed debian. I can see that if __ANDROID__ is defined in the compiler, sem_unlink is not defined during the build, which may be why the import fails (as the import line tries to import sem_unlink). The prooted build is built without this option turned off.
Most helpful comment
For what it's worth you can give my alternative a try. It enables the usage of modern Ansible versions on Termux by creating a proot alpine image and installing ansible in it.
You can reach the host via SSH. It's a work in progress, but Ansible 2.8 and 2.9 work fine.
https://github.com/pschmitt/termux.sh#ansible