1

I am attempting to get a list of all IP addresses for each node in mcollective. The problem I am running into is a wide range of ipaddress_${interface} names, especially on newer EL systems who no longer use eth#. Is there a way to pass a wildcard or regex for the fact name?

My goal is to be able to use mco inventory or something equally as quick to produce a report containing every IP address on all nodes:


I've attempted and failed at several different reports along the lines of:

# cat ipaddrs.mc

inventory do
    format "%40s:\t%24s\t%s"

    fields { [ identity, facts["server_role"], facts[/ipaddress_(.*)/] ] }
end

# mco inventory --script ipaddrs.mc


As a work around I am getting a list of all nodes in the collective and grepping the facts I want. This works but takes several minutes for just a few hundred nodes:

for server in $(mco find ); do 
   echo -e "${server}: $(mco inventory ${server}  \
     |grep ipaddress_ |egrep -v '_(lo|flan|dock)' \
     |awk '{print $3}' |sort |tr '\n' ' ')"
done
Lars
  • 108
  • 11

0 Answers0