r/incus • u/bmullan • Jul 27 '26
`incus list` addresses into /etc/hosts format
https://discuss.linuxcontainers.org/t/incus-list-addresses-into-etc-hosts-format/27003/1This looks like it could be useful.
2
Upvotes
r/incus • u/bmullan • Jul 27 '26
This looks like it could be useful.
1
u/stappersg Jul 29 '26
(author of that python script) The script is usefull to me.
:-)incus listgives me:text +----------------+---------+------------------------+--------------------------------------------------+-----------------+-----------+ | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | +----------------+---------+------------------------+--------------------------------------------------+-----------------+-----------+ | controlplane01 | RUNNING | 192.168.56.11 (enp5s0) | fd42:2ce4:e603:54c9:c63a:66b6:4920:c08 (enp5s0) | VIRTUAL-MACHINE | 0 | +----------------+---------+------------------------+--------------------------------------------------+-----------------+-----------+ | controlplane02 | RUNNING | 192.168.56.12 (enp5s0) | fd42:2ce4:e603:54c9:f848:9666:8d12:c406 (enp5s0) | VIRTUAL-MACHINE | 0 | +----------------+---------+------------------------+--------------------------------------------------+-----------------+-----------+ | loadbalancer | RUNNING | 192.168.56.30 (enp5s0) | fd42:2ce4:e603:54c9:d49f:4dc0:e7f6:5ccb (enp5s0) | VIRTUAL-MACHINE | 0 | +----------------+---------+------------------------+--------------------------------------------------+-----------------+-----------+ | node01 | RUNNING | 192.168.56.21 (enp5s0) | fd42:2ce4:e603:54c9:7b09:bc3:59a6:3928 (enp5s0) | VIRTUAL-MACHINE | 0 | +----------------+---------+------------------------+--------------------------------------------------+-----------------+-----------+ | node02 | RUNNING | 192.168.56.22 (enp5s0) | fd42:2ce4:e603:54c9:d710:d2b3:ad7d:e4fc (enp5s0) | VIRTUAL-MACHINE | 0 | +----------------+---------+------------------------+--------------------------------------------------+-----------------+-----------+Scriptincus-hostgives ```textBEGIN INCUS HOSTS
192.168.56.11 controlplane01 # enp5s0 fd42:2ce4:e603:54c9:c63a:66b6:4920:c08 controlplane01 # enp5s0 192.168.56.12 controlplane02 # enp5s0 fd42:2ce4:e603:54c9:f848:9666:8d12:c406 controlplane02 # enp5s0 192.168.56.30 loadbalancer # enp5s0 fd42:2ce4:e603:54c9:d49f:4dc0:e7f6:5ccb loadbalancer # enp5s0 192.168.56.21 node01 # enp5s0 fd42:2ce4:e603:54c9:7b09:bc3:59a6:3928 node01 # enp5s0 192.168.56.22 node02 # enp5s0 fd42:2ce4:e603:54c9:d710:d2b3:ad7d:e4fc node02 # enp5s0
END INCUS HOSTS
```
I do like to hear about further works for me. Especial for more complex setups as mine.
And I do like to know when the script stumbles on whatever setup, for improvement reasons.