summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Livulpi <james.livulpi@me.com>2022-01-06 15:10:29 -0500
committerGitHub <noreply@github.com>2022-01-07 06:10:29 +1000
commitffd0343670aeb597ed5c015322bcd098c6df25b9 (patch)
tree3affcd9034b96e376dd27874a261b4f7dafae907
parent4d380dcbaa73a98fec9916abf738a958baf363ea (diff)
downloadansible-ffd0343670aeb597ed5c015322bcd098c6df25b9.tar.gz
add systemd alias check (#76608)
* add systemd alias check * add .yml * Delete 75538-systemd-alias-check * Update lib/ansible/modules/systemd.py Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
-rw-r--r--changelogs/fragments/75538-systemd-alias-check.yml2
-rw-r--r--lib/ansible/modules/systemd.py4
2 files changed, 4 insertions, 2 deletions
diff --git a/changelogs/fragments/75538-systemd-alias-check.yml b/changelogs/fragments/75538-systemd-alias-check.yml
new file mode 100644
index 0000000000..fefb34b106
--- /dev/null
+++ b/changelogs/fragments/75538-systemd-alias-check.yml
@@ -0,0 +1,2 @@
+bugfixes:
+- systemd - check if service is alias so it gets enabled (https://github.com/ansible/ansible/issues/75538). \ No newline at end of file
diff --git a/lib/ansible/modules/systemd.py b/lib/ansible/modules/systemd.py
index f6b58daa1b..4f5827cd28 100644
--- a/lib/ansible/modules/systemd.py
+++ b/lib/ansible/modules/systemd.py
@@ -502,8 +502,8 @@ def main():
# check systemctl result or if it is a init script
if rc == 0:
enabled = True
- # Check if service is indirect and if out contains exactly 1 line of string 'indirect' it's disabled
- if out.splitlines() == ["indirect"]:
+ # Check if the service is indirect or alias and if out contains exactly 1 line of string 'indirect'/ 'alias' it's disabled
+ if out.splitlines() == ["indirect"] or out.splitlines() == ["alias"]:
enabled = False
elif rc == 1: