Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an alternative to Ansible on Python3

I changed the Python 2 to Python 3. I felt the benefits of Asyncio.

Earlier in my project I used Ansible, but it is not supported with Python 3. Can you recommend to me an alternative to Ansible for Python 3?

like image 336
lynxbyorion Avatar asked Aug 20 '15 08:08

lynxbyorion


People also ask

Does Ansible work with Python3?

Ansible will automatically detect and use Python 3 on many platforms that ship with it. To explicitly configure a Python 3 interpreter, set the ansible_python_interpreter inventory variable at a group or host level to the location of a Python 3 interpreter, such as /usr/bin/python3.

Does Ansible need Python3?

While you can write Ansible modules in any language, most Ansible modules are written in Python, including the ones central to letting Ansible work. By default, Ansible assumes it can find a /usr/bin/python on your remote system that is either Python2, version 2.6 or higher or Python3, 3.5 or higher.

Which is better Ansible or Python?

Python is quicker than Ansible, but that might not be a problem if you don't have 1000's of devices to automate. Both use human readable code, but Ansible is considered to be more human readable with it's YAML playbooks.


2 Answers

As of 2.2, Ansible works with Python 3. Yep, you may encounter some bugs but any patch related to py3 will be quickly reviewed and merged by the team. I already fixed two that I encountered myself.

like image 113
sorin Avatar answered Sep 19 '22 13:09

sorin


Edit: as of Ansible 2.2 this answer is no longer accurate.

The best answer here is to have both versions of Python installed, possibly running Python 2 and Ansible in a virtualenv.

It's possible that Ansible will be refactored for Python 3 but it's unlikely for now, and there is no Alternative in Python 3. If you don't want to use Ansible on Python2, you'll need to switch to another tool like Saltstack, Chef, or Puppet.

like image 37
MillerGeek Avatar answered Sep 22 '22 13:09

MillerGeek