|
|
f6303c |
From ddf34ef7c71b79ca12ccfcd00eada2c08c34d2c9 Mon Sep 17 00:00:00 2001
|
|
|
f6303c |
From: Milan Lysonek <mlysonek@redhat.om>
|
|
|
f6303c |
Date: Mon, 14 Nov 2022 17:16:53 +0100
|
|
|
f6303c |
Subject: [PATCH 1/2] Revert "Align service_disabled template to
|
|
|
f6303c |
service_enabled"
|
|
|
f6303c |
|
|
|
f6303c |
This reverts commit dc37d3c376cd3f2a2178d82a928629b231662cf9.
|
|
|
f6303c |
---
|
|
|
f6303c |
.../service_disabled/ansible.template | 32 ++++++++++++++-----
|
|
|
f6303c |
1 file changed, 24 insertions(+), 8 deletions(-)
|
|
|
f6303c |
|
|
|
f6303c |
diff --git a/shared/templates/service_disabled/ansible.template b/shared/templates/service_disabled/ansible.template
|
|
|
f6303c |
index 752f6ac5099..5c70756b8af 100644
|
|
|
f6303c |
--- a/shared/templates/service_disabled/ansible.template
|
|
|
f6303c |
+++ b/shared/templates/service_disabled/ansible.template
|
|
|
f6303c |
@@ -3,17 +3,33 @@
|
|
|
f6303c |
# strategy = disable
|
|
|
f6303c |
# complexity = low
|
|
|
f6303c |
# disruption = low
|
|
|
f6303c |
+{{%- if init_system == "systemd" %}}
|
|
|
f6303c |
- name: Disable service {{{ SERVICENAME }}}
|
|
|
f6303c |
block:
|
|
|
f6303c |
- - name: Gather the package facts
|
|
|
f6303c |
- package_facts:
|
|
|
f6303c |
- manager: auto
|
|
|
f6303c |
-
|
|
|
f6303c |
- name: Disable service {{{ SERVICENAME }}}
|
|
|
f6303c |
- service:
|
|
|
f6303c |
- name: "{{{ DAEMONNAME }}}"
|
|
|
f6303c |
+ systemd:
|
|
|
f6303c |
+ name: "{{{ DAEMONNAME }}}.service"
|
|
|
f6303c |
enabled: "no"
|
|
|
f6303c |
state: "stopped"
|
|
|
f6303c |
masked: "yes"
|
|
|
f6303c |
- when:
|
|
|
f6303c |
- - '"{{{ PACKAGENAME }}}" in ansible_facts.packages'
|
|
|
f6303c |
+ ignore_errors: 'yes'
|
|
|
f6303c |
+
|
|
|
f6303c |
+- name: "Unit Socket Exists - {{{ DAEMONNAME }}}.socket"
|
|
|
f6303c |
+ command: systemctl list-unit-files {{{ DAEMONNAME }}}.socket
|
|
|
f6303c |
+ args:
|
|
|
f6303c |
+ warn: False
|
|
|
f6303c |
+ register: socket_file_exists
|
|
|
f6303c |
+ changed_when: False
|
|
|
f6303c |
+ ignore_errors: True
|
|
|
f6303c |
+ check_mode: False
|
|
|
f6303c |
+
|
|
|
f6303c |
+- name: Disable socket {{{ SERVICENAME }}}
|
|
|
f6303c |
+ systemd:
|
|
|
f6303c |
+ name: "{{{ DAEMONNAME }}}.socket"
|
|
|
f6303c |
+ enabled: "no"
|
|
|
f6303c |
+ state: "stopped"
|
|
|
f6303c |
+ masked: "yes"
|
|
|
f6303c |
+ when: '"{{{ DAEMONNAME }}}.socket" in socket_file_exists.stdout_lines[1]'
|
|
|
f6303c |
+{{%- else %}}
|
|
|
f6303c |
+JINJA TEMPLATE ERROR: Unknown init system '{{{ init_system }}}'
|
|
|
f6303c |
+{{%- endif %}}
|
|
|
f6303c |
|
|
|
f6303c |
From 8c20a2bc997c0a24eba2a9924d832954b9e91b6a Mon Sep 17 00:00:00 2001
|
|
|
f6303c |
From: Milan Lysonek <mlysonek@redhat.om>
|
|
|
f6303c |
Date: Mon, 14 Nov 2022 17:37:50 +0100
|
|
|
f6303c |
Subject: [PATCH 2/2] Make service_disabled template compatible with Ansible
|
|
|
f6303c |
2.14
|
|
|
f6303c |
|
|
|
f6303c |
---
|
|
|
f6303c |
shared/templates/service_disabled/ansible.template | 2 --
|
|
|
f6303c |
1 file changed, 2 deletions(-)
|
|
|
f6303c |
|
|
|
f6303c |
diff --git a/shared/templates/service_disabled/ansible.template b/shared/templates/service_disabled/ansible.template
|
|
|
f6303c |
index 5c70756b8af..72678e050cf 100644
|
|
|
f6303c |
--- a/shared/templates/service_disabled/ansible.template
|
|
|
f6303c |
+++ b/shared/templates/service_disabled/ansible.template
|
|
|
f6303c |
@@ -16,8 +16,6 @@
|
|
|
f6303c |
|
|
|
f6303c |
- name: "Unit Socket Exists - {{{ DAEMONNAME }}}.socket"
|
|
|
f6303c |
command: systemctl list-unit-files {{{ DAEMONNAME }}}.socket
|
|
|
f6303c |
- args:
|
|
|
f6303c |
- warn: False
|
|
|
f6303c |
register: socket_file_exists
|
|
|
f6303c |
changed_when: False
|
|
|
f6303c |
ignore_errors: True
|