diff --git a/lib/get_all_shared_names_by_role b/lib/get_all_shared_names_by_role new file mode 100644 index 00000000..dae62658 --- /dev/null +++ b/lib/get_all_shared_names_by_role @@ -0,0 +1,20 @@ +[% + # Return an array of Carrier nodes shared names with a given role + # + # @param argv.role The role of the node to process + # One of: proxy, lb, mgmt + # @return out The array of shared names: + # [ 'prx01', 'prx02', 'prx05' ] + + out = [] + blktmp.processed_hosts = {}; + FOREACH host IN hosts.keys.sort; + NEXT IF blktmp.processed_hosts.$host.defined; + NEXT UNLESS hosts.$host.role.grep('^' _ argv.role _ '$').size(); + peer = hosts.$host.peer; + blktmp.processed_hosts.$peer = 1; + matches = host.match('^(\w+[0-9])[ab]$'); + out.push(matches.0); + END; + out = out.sort; +-%]