Jump to: navigation, search


Ansible and AIX


Ansible: 2.10 wheels for AIX
Python: Python3-3.6.12 py36

My goal is to get a tutorial working for Ansible with/on AIX



Using my Python package - built to not have any dependencies other than a recent OpenSSL, and AIX 6.1 TL6 or later AND support for wheels - installation is fairly simple.

First, get the installp package from py36. Then download/install a recent pip, the ansible-bundle, and a helper script py_wheel_setup.

Additionally, I recommend installing virtualenv either directly (LPAR has direct access), or from this bundle python3-virtualenv-wheels.tar.bz2


# installp -d aixtools.python.py36. -aYXc aixtools.python.py36.adt aixtools.python.py36.rte
## use all to also get the man pages

# export PYTHONWARNINGS=ignore # optional
# bzip2 -dc ansible-2.10-wheels.tar.bz2 | tar xf -
  • while root update pip to a later (might not be the latest - but this will do)
# /opt/bin/pip3 install pip-20.2.3-py2.py3-none-any.whl
  • Now also install virtualenv - so that you can continue as non-root - and more easily cleanup if needed.
# bzip2 -dc python3-virtualenv-wheels.tar.bz2 | tar xf -
# pip3 install virtualenv/*.whl

At this point the base Python3 is complete. Become a regular user (PS1 == $)

Install Ansible in virtualenv

When finished with this part you will have Python and Ansible installed and ready for further experimentation.

First you need to create a virtualenv to do your later work in.

$ virtualenv --clear py36
$ . ./py36/bin/activate
$ mkdir py36/wheels
$ cd py36/wheels
$ cp $download_location/*.whl .
$ python3 $download_location/ *.whl | ksh -x
$ pip install *.whl

When this finishes Ansible is installed in your virtualenv. Test it with the following command

$ ansible -m ping localhost

--Michael Felt (talk) 16:08, 6 October 2020 (CEST) To be continued

  • NOTE: you can also do everything as root - but still install ansible in a virtualenv created by root.

Getting Started


The basic concepts I'll cover here are:

  • Control Node
  • Managed Nodes
  • Inventory

The other concepts will come - soon.

The Control Node is the server you have just installed. This node has the complete Ansible product installed.

The control node is also, by default, a Managed Node known as localhost. That is how we tested our installation above.

Defining target hosts

Lets start by going back to our test command - and look at the command syntax, noise, and the actual result.

 (py36) $ ansible localhost -m ping
/home/aixtools/py36/lib/python3.6/site-packages/cryptography/hazmat/bindings/openssl/ CryptographyDeprecationWarning: OpenSSL version 1.0.2 is no longer supported by the OpenSSL project, please upgrade. The next version of cryptography will drop support for it.
localhost | SUCCESS => {
    "changed": false,
    "ping": "pong"

"Deep" in python there is a warnings.warn() call with the message above. I don't really care about that right now, so to get rid of that message I add locally, and to my .profile (for future sessions).

(py36) $ export PYTHONWARNINGS=ignore
(py36) $ print "export PYTHONWARNINGS=ignore" >> ~/.profile

And while I think of it, add an alias to kickoff my virtualenv

(py36) $ print "py36='. ${HOME}/py36/bin/activate'" >> ~/.profile

The first Managed Node

I don't want to use Ansible only on the control node - I want to use it on managed nodes. So now, same command, but on the remote node x076.

(py36) $ ansible -m ping x076

If only it were so easy - my host x076 is unknown to Ansible

[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: x076

Ansible says it is missing an inventory, so in it's simplest form, we create an inventory

(py36) $ echo x076 >inventory
(py36) $ ansible x076 -m ping -i inventory
x076 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: aixtools@x076: Permission denied (publickey,password,keyboard-interactive).",
    "unreachable": true

One step further, but my local userid does not exist on x076 - so one more addition.

  • Prior to this I setup ssh connectivity to x076 so that my public key id (.ssh/ is included in root@x076:.ssh/authorised_keys
(py36) $ ansible x076 -m ping -i inventory -u root
[WARNING]: Platform aix on host x076 is using the discovered Python interpreter at /opt/bin/python3.6,
but future installation of another Python interpreter could change the meaning of that path.
See for more information.
x076 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/opt/bin/python3.6"
    "changed": false,
    "ping": "pong"

We have a new warning message above - that is coming from the Ansible module ping. We shall deal with how to clear that up later.

Setting Ansible Defaults


Inventory and Vars

Personal tools