crans_bcfg2/Python/etc/crans/services.py
2015-05-14 07:19:56 +02:00

22 lines
514 B
Python

# -*- mode: python; encoding: utf-8 -*-
info["owner"] = "root"
info["group"] = "root"
info["mode"] = 0644
comment_start = "#"
header("Services configuré sur la machine")
clients = metadata.query.all()
groups_dict = {}
for client in clients:
for group in client.groups:
groups_dict.setdefault(group, []).append(client.hostname.split('.', 1)[0])
out("services = {")
for (group_name, clients) in groups_dict.iteritems():
clients.sort()
out(" '%s': %s," % (group_name, clients))
out("}")