From 14a2cc65f91d858a920e1dd1f09283aa70529443 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Mon, 17 Oct 2022 18:52:42 +0200 Subject: [PATCH] better config change detection --- ansible/filter_plugins/fileslist.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/ansible/filter_plugins/fileslist.py b/ansible/filter_plugins/fileslist.py index d593b70..4f08bec 100644 --- a/ansible/filter_plugins/fileslist.py +++ b/ansible/filter_plugins/fileslist.py @@ -30,21 +30,30 @@ def fileslist(data, is_host=False, name_only=False, prefix=None): prefix, ) for service, service_data in data.items(): - if service_data['activate'] and service_data['engine'] != 'none': - _add(files, - {'owner': 'root', 'group': 'root', 'mode': '0755'}, - base_systemd + '/systemd/system/' + service_data['doc'], - name_only, - prefix, - ) - if service_data['activate'] and 'overrides' in service_data: - for override_data in service_data['overrides'].values(): + if not service_data['activate']: + if service_data['engine'] == 'none' and service_data['type'] == 'service' and not 'overrides' in service_data: _add(files, {'owner': 'root', 'group': 'root', 'mode': '0755'}, - base_systemd + '/systemd/system/' + override_data['name'] + '.d/rougail.conf', + base_systemd + '/systemd/system/' + service_data['doc'], name_only, prefix, ) + else: + if service_data['activate'] and service_data['engine'] != 'none': + _add(files, + {'owner': 'root', 'group': 'root', 'mode': '0755'}, + base_systemd + '/systemd/system/' + service_data['doc'], + name_only, + prefix, + ) + if service_data['activate'] and 'overrides' in service_data: + for override_data in service_data['overrides'].values(): + _add(files, + {'owner': 'root', 'group': 'root', 'mode': '0755'}, + base_systemd + '/systemd/system/' + override_data['name'] + '.d/rougail.conf', + name_only, + prefix, + ) if 'files' not in service_data: continue for file_data in service_data['files'].values():