1 #!/usr/bin/env -S python3 -Bu
2 ################################################
3 ### Managed by someone's ansible provisioner ###
4 ################################################
5 # Part of: https://git.somenet.org/root/pub/somesible.git
6 # 2017-2024 by someone <someone@somenet.org>
8 # Prevent apt/dpkg from (re)starting services we manage.
21 MANAGED_SERVICES = set("{{apt_ansible_managed_services | join(' ')}} {{apt_ansible_managed_services_extra | join(' ')}}".replace(".service","").split(" "))
22 SERVICE = re.sub(r"@.*", "", re.sub(r"\.service", "", sys.argv[1]))
25 if SERVICE in MANAGED_SERVICES:
26 with open("/tmp/policy-rc.d.log", "a") as fout:
27 fout.write(datetime.datetime.now().isoformat(timespec='seconds')+" -- managed, exit 101: " +str(sys.argv)+"\n")
31 with open("/tmp/policy-rc.d.log", "a") as fout:
32 fout.write(datetime.datetime.now().isoformat(timespec='seconds')+" -- unmanaged, exit 0: " +str(sys.argv)+"\n")