From 652ab3d1bbd04ac7fccc446e49cd8943a748c1e4 Mon Sep 17 00:00:00 2001 From: Johan Wassberg Date: Wed, 15 May 2024 08:54:30 +0200 Subject: [PATCH] Try new tag --- .../overlay/etc/puppet/setup_cosmos_modules | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/global/overlay/etc/puppet/setup_cosmos_modules b/global/overlay/etc/puppet/setup_cosmos_modules index 0a2b102..bf7e239 100755 --- a/global/overlay/etc/puppet/setup_cosmos_modules +++ b/global/overlay/etc/puppet/setup_cosmos_modules @@ -6,6 +6,27 @@ import os import os.path import sys +import socket + +try: + fqdn = socket.getfqdn() + hostname = socket.gethostname() +except OSError: + host_info = None +else: + domainname = fqdn[len(hostname + ".") :] + environ = "test" if (domainname.find("test") != -1) else "prod" + customer = domainname.split(".")[0] + + host_info = { + "customer": customer, + "domainname": domainname, + "environment": environ, + "fqdn": fqdn, + "hostname": hostname, + } + + try: from configobj import ConfigObj @@ -94,6 +115,10 @@ def main(): if OS_INFO["VERSION_CODENAME"] == "bullseye": pass + if host_info: + if "internal-dco-prod-monitor-1" in host_info["fqdn"]: + modules["sunet"]["tag"] = "jocar-nrpe-scriptherder*" + # Build list of expected file content file_lines = create_file_content(modules)