Skip to content

Commit b07a1a5

Browse files
Add packagekit stop tasks
1 parent 7b0a83c commit b07a1a5

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

ansible/playbooks/fully-patch-system.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,38 @@
77
use_reboottimeout: 600
88

99
tasks:
10+
- name: Check if Zypper lock file exists
11+
stat:
12+
path: /var/run/zypp.pid
13+
register: lockfile_check
14+
become: yes
15+
16+
- name: Get PID from Zypper lock file
17+
slurp:
18+
src: /var/run/zypp.pid
19+
register: pid_content
20+
become: yes
21+
when: lockfile_check.stat.exists
22+
23+
- name: Set PID variable
24+
set_fact:
25+
zypper_pid: "{{ (pid_content['content'] | b64decode).strip() }}"
26+
when: lockfile_check.stat.exists
27+
28+
- name: Check if process with PID is running
29+
shell: ps -p {{ zypper_pid }} -o comm=
30+
register: process_check
31+
failed_when: false
32+
changed_when: false
33+
when: lockfile_check.stat.exists
34+
35+
- name: Remove stale Zypper lock file
36+
file:
37+
path: /var/run/zypp.pid
38+
state: absent
39+
become: yes
40+
when: lockfile_check.stat.exists and process_check.stdout == ""
41+
1042
# Fully patch system
1143
- name: Apply all available patches
1244
community.general.zypper:

0 commit comments

Comments
 (0)