'How do I get the IP Address of Unauthenticated Minions?

I'm trying to find out if SaltStack supports retrieving the IP addresses of Minions that are not yet authenticated (ie salt-key -L returns minion ID under Unaccepted Keys). I've looked at the documentation and I do not see anything, but I feel like it should be possible since its reporting a Minion Id from somewhere.

salt-key -L --state-verbose=true

verbose doesnt seem to provide any additional information either.



Solution 1:[1]

salt-key --list unaccepted will list Unaccepted Keys. Now you can use something like host to return IP address:

for i in `salt-key --list unaccepted | grep -v Keys`; do host "$i"; done | awk '{print $4}'

If in the result, instead of IP address you saw found:, it means that server is not reachable. So run the command without awk to see the more info:

for i in `salt-key --list unaccepted | grep -v Keys`; do host "$i"; done

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hassan