From 0589c8138676406993bbaf95b5908f7e93f0413d Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Tue, 11 Jan 2022 03:26:11 -0500 Subject: [PATCH] Add 'load' boolean for services. Some services, such as socket activated ones with '@' naming cannot be loaded. Change-Id: I7d95378f393c8b8cc729cc9b3a30dfe4208393b2 --- defaults/main.yml | 1 + tasks/main.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 6250012..7c9669c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -121,6 +121,7 @@ systemd_environment: {} # will place only overrides for the existing service. # `systemd_run_dir` -- (optional) Run directory that will be used for service runtime. Service slice or name is added to the path # `systemd_lock_dir` -- (optional) Lock directory that will be used for service runtime. Service slice or name is added to the path +# `load` -- (optional) Boolean to set if the service is loaded. Socket activated services with '@' may not need to be loaded. # Under the service dictionary the "sockets" key can be added, which may contain list of the sockets # for the given service_name. Each socket in the lsit may have following structure: diff --git a/tasks/main.yml b/tasks/main.yml index 9540ff7..b4f2070 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -146,6 +146,8 @@ enabled: "{{ item.enabled | default(systemd_service_enabled) }}" state: "{{ (item.timer is defined) | ternary(omit, (item.state | default(omit))) }}" with_items: "{{ systemd_services }}" + when: + - item.load | default(True) tags: - systemd-service