Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
systemd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
webarch
systemd
Commits
1a5ff5f4
Verified
Commit
1a5ff5f4
authored
9 months ago
by
Chris Croome
Browse files
Options
Downloads
Patches
Plain Diff
test fix molecule verify
parent
1b82d5bb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#33583
failed
9 months ago
Stage: bookworm
Stage: jammy
Stage: noble
Stage: trixie
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tasks/unit_present.yml
+15
-2
15 additions, 2 deletions
tasks/unit_present.yml
with
15 additions
and
2 deletions
tasks/unit_present.yml
+
15
−
2
View file @
1a5ff5f4
...
...
@@ -101,23 +101,36 @@
-
systemd_file_changed is defined
-
systemd_file_changed | bool
-
name
:
Gather service facts
ansible.builtin.service_facts
:
register
:
systemd_service_facts
-
name
:
Unit not enabled and stopped
ansible.builtin.systemd
:
name
:
"
{{
systemd_unit.name
}}"
enabled
:
false
state
:
stopped
vars
:
systemd_service_jpq
:
'
ansible_facts.services.["{{
systemd_unit.name
}}.service"]|[0]'
when
:
-
systemd_unit.state is defined
-
systemd_unit.state == "stopped"
-
>-
( systemd_service_facts | community.general.json_query(systemd_service_jpq)).status == "enabled" ) or
( systemd_service_facts | community.general.json_query(systemd_service_jpq)).state == "running" )
-
name
:
Unit enabled and started
ansible.builtin.systemd
:
name
:
"
{{
systemd_unit.name
}}"
enabled
:
true
state
:
started
vars
:
systemd_service_jpq
:
'
ansible_facts.services.["{{
systemd_unit.name
}}.service"]|[0]'
when
:
>-
( systemd_unit.state is not defined ) or
( systemd_unit.state != "enabled" )
( ( systemd_unit.state is not defined ) or
( systemd_unit.state == "enabled" ) ) and
( ( systemd_service_facts | community.general.json_query(systemd_service_jpq)).status != "enabled" ) or
( systemd_service_facts | community.general.json_query(systemd_service_jpq)).state != "running" ) )
-
name
:
Systemd unit restarted
ansible.builtin.systemd
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment