I’m working on an automation to create/delete users on storage devices.
I have been only provided with the commands that the storage admin use and users that can ssh to the storage devices.
My first attempt was to create a normal playbook that connects to the storage device and run the commands.
The problem with this option is that the storage devices aren’t unix/linux, so its not possible to run the playbook normally. Basically is not able to create the temporary directory and it doesn’t have python to run the command.
So, my second attempt was to use existing modules/API.
My problem this time is that some of the storage devices don’t have API available or the user doesn’t have API access :S
My last will be to try to use shell and use multiple commands.
name: iterate user groups
shell: |
sshpass “password” ssh user@storage_device
do_some_stuff_here
and_some_other_stuff
Is there any better option to do this kind of connection?
Other than the modules themselves, not really, they use https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/connection.py
to establish a connection via the 'ansible-conneciton' tool (which is
what actually uses the connection plugin), which exposes a socket to
the module, the module then uses jsonrpc to send/read commands sent
over that socket, which ansible-connection relays to the remote target
(while not copying any code to it).