Life happens everywhere no matters where you are. And in all that places, your smartphone is always with you so let’s have Ansible with us everywhere.
How to get Ansible on Android?
Pre-requirements:
For that we need Termux in first place. For installing it, only F-Droid’s version is valid. so:
- Install F-Droid or F-Droid client. I’ve prefer Droidify so let’s go for it. Download it from here
- Once installed, dowload from it Termux
- Now I’ve recomend to configure some things in it using this
Install Ansible:
For installing Ansible, first things are install dependencies:
pkg update && pkg upgrade -y
pkg install python clang libffi openssl git build-essential rust -y
pkg install python-pip -y
pip install ansible
That will take a while. Relax and let it finish. Once it’s done, you can verify if Ansible is installed by running:
ansible --version
Test Ansible on Android
Now that we have Ansible correctly installed, let’s play with it. The easiest test is to ping a server. For doing that:
-
Create an
inventory.yml
and fulfill it with:all: hosts: my_server: ansible_host: <ip> ansible_user: <user>
-
Generate ssh-key in case you don´t have one:
ssh-keygen -t ed25519 -C "your_email@example.com"
-
Install your public ssh-key in the server:
ssh-copy-id tu_usuario@IP_DEL_SERVIDOR
-
To verify if the ssh-key is correctkly installed, just try:
ssh <user>@<ip>
-
Try to ping using ansible running:
ansible -i inventory.yml all -m ping
You should receive an answer like:
my_server | SUCCESS => { "changed": false, "ping": "pong" }
And with that, you’re ready to go. Happy day!