How can I use Ansible of a serial connection instead of SSH? - ansible

I have a bunch of Raspberry Pi devices that I only configure over the serial console. I am hoping to configure Ansible to update them for me.
I can't find any obvious way to do it (on this list for example: Plugins)
Do I need to write my own connector? Or is there an obvious way to use Ansible of a serial console that I am missing?

Do I need to write my own connector
Right, currently, there is no serial connection possible out-of-box. You will need a connector like Ansible Serial Unix and enhance em for your needs (if necessary).

Related

NiFi: port to use in handlehttprequest

NiFi 1.5:
i want to use the port in HandleHTTPRequest. how to decide the port can be used in HandleHTTPRequest? is there any range of port can be used here.
i already saw the nifi configuration, but could not find the ports that can be used here.
please guide me. thanks.
Any port that the OS user running NiFi can access can be used for HandleHttpRequest, but only one can be used at a time (not a range). For example, sometimes the "NiFi user" (meaning the OS user that executed the nifi.sh command to start it) isn't allowed to use system ports (<1024) so you'd need to choose one above that number. Also you need to choose a port that is not already in use by another process.
The reason a port range is not available is because HandleHttpRequest is meant to model a well-known URL as a web service; if the ports could change, the clients would all have to try the same range.

Identify type of devices in an IT Environment using C# (i.e. Windows, Linux, Network etc)

I have to scan my Infrastructure and find it out the way I should use (WMI, SSH, SNMP, etc.) to discover the device details.
The approach I am following as of now is
Get the availability of device.
Query using WMI (If responding? use this protocol to discover this device)
If the above device does not respond to WMI use another protocol like SSH or SNMP (it's configurable) etc.
Is there any other way of discovery for a mixed environment? Please suggest.
The approach you are taking seems reasonable. Alternatively, you could have some existing software do this for you.

How to open busy serial port (share port) with pyserial

Is it possible open serial port which already in use?
and send data to it
Or create new one and share it for few applications?
I'm trying to avoid use of port pairs (created by windows driver)
I guess you could use an intemediate program like Hyperterminal and sendkeys to it from other apps, ao that Hyperterminal sends them from multiple sources.
Other than a workaround like that I've never heard of a port beng open in more than one program simultaneously.

writing to serial port with a shell script

I need to communicate with a serial device by sending it ascii characters. I know that in Linux you can use fopen() to write to a serial port, but I didn't know if you could do that from a shell. If not, is there another simple way to do this?
I believe you can simply redirect/cat data to the serial port from the shell. You'll want to use setserial(8) to configure baud and other information first.

How do I detect hosts on my LAN?

To help users, I would like my code to discover Oracle databases on the LAN. I thought to do this by first detecting all hosts, then checking each host to see if it is listening on Oracle's default port.
Any ideas how to go about this? Preferably in Java, but any language or algorithm would do.
Are you using DHCP? If so, your DHCP server has a list of the leases it has passed out. That should do you for a list of hosts on the LAN. Then try opening a connection to the Oracle port on each of those hosts and see if it accepts the connection.
It should be pretty simple to implement as a shell script with half a dozen lines or so. Java seems like overkill for something like this. Loop through the leases file, grab the IP from each lease, and telnet to the Oracle port; if it connects, disconnect and print the IP to standard out.
If you want to stay platform-independant, and unless you have access to some kind of database that lists the hosts, the only way to get a list is to try each IP address in the local network - might as well try to connect to the Oracle port on each of them.
There are lots of problems with this approach:
Will only search through the local network, which may only be a small part of the LAN (in case of large companies with lots of subnets)
Can take a long time (you definitely want to reduce the timeout for the connection attempts, but if someone has configured his LAN as a class A network, it will still take forever)
Can trigger all kinds of alerts, such as desktop users' personal firewalls, and intrusion detection systems - because you're doing exactly the same thing someone trying to exploit a security hole in Oracle servers would do
As brazzy points out, scanning for hosts is likely to cause problems, especially if there is a bug in your scanner.
A better approach may be to get the owners of the databases to register them somewhere, for example in a local DNS service (or does Oracle have zeroconf support?), or simply on some intranet webpage or wiki.
You better register the SID names/addresses to some server with a fixed address(maybe with a simple web service), and then query the list from there. Another approach is the bruteforce one (explained by #brazzy) by scanning one or more subnets, but this isn't really a good thing to do.
In case you are looking for a tool Loo#Lan can do this for you. Unfortunately there's no source available...
All of these smart answers are the reasons why many companies do not use the default port. Using a different port for each database is entirely possible, you know.

Resources