cloudmesh / cloudmesh-pi-burn

Burns many SD cards so we can build a Raspberry PI cluster
Other
18 stars 12 forks source link

auto detect hostnames from ip addresses #60

Open jpfleischer opened 2 years ago

jpfleischer commented 2 years ago

implementation without ips is done as. implemented in cloudmesh inventory

cms host find

+-------+----------------+------+---------------+-------------------+------------+--------+------------------+
| name  | ip             | user | os            | mac               | model      | memory | serial           |
+-------+----------------+------+---------------+-------------------+------------+--------+------------------+
| red   | 192.168.50.163 | pi   | 11 (bullseye) | dc:a6:... | Pi 4 B 1.4 | 7.7Gi  | 10000000... |
| red01 | 192.168.50.249 | pi   | 11 (bullseye) | dc:a6:... | Pi 4 B 1.1 | 3.8Gi  | 10000000... |
+-------+----------------+------+---------------+-------------------+------------+--------+------------------+
cms host find [--ips=IPS]
ips = Parameter.expand(arguments.ips)
for ip in ips:
    try:
      r = Shell.run(f"ssh {ip} hostname -I").strip()
      # we find the hostname, maybe with try except
      if error:
          report
    except Exception as e:
        print(e)
        Console.error("failed")

how do we use this? cms host names --ips=192.168.1.[100-103] add "How to use" this into the FAQ e.g. "what if my hostnames dont show up in my network?"

perhaps use nmap... it must be installed first. find mac addresses https://raspberrypi.stackexchange.com/questions/28365/what-are-the-possible-ouis-for-the-ethernet-mac-address https://standards-oui.ieee.org/oui/oui.txt

laszewsk commented 2 years ago

command will be host find

laszewsk commented 2 years ago

Gregor implemented

laszewsk commented 2 years ago

there were lots of confusion about this. Former student die not think it works, however i think other then documentation this works and was implemented.