From 9663d5f9064e34870b8ed293b5d74dadb24cb484 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Wed, 29 Sep 2021 16:56:04 +0100 Subject: [PATCH] Add a disabled: true attribute to services All the attribute does right now is, it will skip host allocation for the service. --- plugins/inventory/float.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/inventory/float.py b/plugins/inventory/float.py index 1e29228a..a68e19f3 100644 --- a/plugins/inventory/float.py +++ b/plugins/inventory/float.py @@ -522,7 +522,9 @@ class Assignments(object): service = services[service_name] available_hosts = cls._available_hosts(service, group_map) num_instances = service.get('num_instances', 'all') - if num_instances == 'all': + if service.get('disabled'): + service_hosts = [] + elif num_instances == 'all': service_hosts = sorted(available_hosts) else: service_hosts = sorted(_binpack( @@ -530,7 +532,7 @@ class Assignments(object): service_hosts_map[service_name] = service_hosts for h in service_hosts: host_occupation[h] += 1 - if service.get('master_election'): + if service.get('master_election') and not service.get('disabled'): if 'master_scheduling_group' in service: available_hosts = set(available_hosts).intersection( set(group_map[service['master_scheduling_group']])) -- GitLab