mirror of https://github.com/sipwise/ngcpcfg.git
returns hash of IPs of a role and type with dbnode as value Change-Id: Ibdf9ea2354d78135188f68259167a8ae9079111dchanges/54/7454/2
parent
f84cfcf381
commit
9f4d913f6b
@ -0,0 +1,29 @@
|
||||
[%
|
||||
# Return a hash of IPs from the interface of a given
|
||||
# type for all nodes which act as a given role
|
||||
# dbnode value of that host
|
||||
#
|
||||
# @param argv.role The role of the node to process
|
||||
# One of: proxy, lb, mgmt
|
||||
# @param argv.type The interface type of a node to extract
|
||||
# the ip from
|
||||
# One of: web_int, web_ext, sip_int, sip_ext, ...
|
||||
# @return out The hash of ips and dbnode values
|
||||
-%]
|
||||
[% out = {} -%]
|
||||
[% FOREACH host IN hosts.keys -%]
|
||||
[% IF hosts.$host.role.grep('^' _ argv.role _ '$').size() -%]
|
||||
[% FOREACH iface IN hosts.$host.interfaces -%]
|
||||
[% FOREACH realiface IN hosts.$host.keys -%]
|
||||
[% IF realiface == iface -%]
|
||||
[% IF hosts.$host.$realiface.type.grep('^' _ argv.type _ '$').size() -%]
|
||||
[% ip = hosts.$host.$realiface.ip -%]
|
||||
[% IF !out.exists($ip) -%]
|
||||
[% out.$ip = hosts.$host.dbnode -%]
|
||||
[% END -%]
|
||||
[% END -%]
|
||||
[% END -%]
|
||||
[% END -%]
|
||||
[% END -%]
|
||||
[% END -%]
|
||||
[% END -%]
|
||||
Loading…
Reference in new issue