How to develop an Ansible agent for another OS

Hello

I am looking for some docs explaining how to develop an agent for another Operating System

I noticed in

/usr/local/python2.7/dist-packages:ansible/modules-utils/facts/hardware

some files like
aix.py
sunos.py
netbsd.py
linux.py
hpux.py

and so

It seems ansible_distribution may be the name of the OS, according to

https://docs.ansible.com/ansible/2.6/user_guide/playbooks_best_practices.html?highlight=operating%20system

Thanks for any hint

Hi,

Could you please explain what you are trying to achieve, so we can guide you?

The existing code supports most common Operating Systems even if their isn’t a specific Python file for that Operating System.

Kind regards,
gundalow

Hello

I was trying to port Ansible to OpenVMS Itanium.

Ansible is written in Python, and Python is available for OpenVMS

I thought I had read some time ago some Ansible doc explaining how to deal with another OS, but I can’t find it in the docs.

Regards

Hi,
Thanks for the detail.

So, just to clarify some things:

  • ansible-playbook will still be run on a standard Linux machine, that’s the controller

  • Ansible doesn’t have an agent. It communicates over ssh, nothing to install on the remote-node

  • We are talking about supporting OpenVMS/Itanium as a remote-node

Assuming you have an inventory file that defines openvms-01

  1. If we start with the simplest task:
    ansible openvms-01 -m ping

This ensure we have connectivity

  1. Then look at
    ansible openvms-01 -m setup -a ‘gather_subset=!min’

Which should return something like

SUCCESS => {
“ansible_facts”: {
“gather_subset”: [
“!min”
],
“module_setup”: true
},
“changed”: false

You can play around with the various gather_subset as defined on https://docs.ansible.com/ansible/latest/modules/setup_module.html

  1. Then
    ansible openvms-01 -m setup -a ‘gather_subset=min’

How do those commands seem?

If any fail add -vv and rerun

This should give us an indication of what works “out of the box”.

You can see the code for the existing for facts in https://github.com/ansible/ansible/tree/devel/lib/ansible/module_utils/facts

Kind regards,
gundalow

Hello

Thanks for your valuable inputs

after setting up SSH between the Linux and OpenVMS node, the

ansible openvms-01 -m ping

succesfully connects to the remote system (via ssh), then
sends
‘/bin/sh -c ‘"’“‘echo ~SYSTEM && sleep 0’”’"‘’

but this is an illegal command on OpenVMS which has a specific shell named DCL.

So, now, how to specifiy a correct command for the OpenVMS host and check the reply.

use the 'raw' module:

ansible openvms-01 -m raw -a "command"