Skip to content

Commit 34c2848

Browse files
Add packagekit stop tasks
1 parent 7b0a83c commit 34c2848

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

ansible/playbooks/fully-patch-system.yaml

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

99
tasks:
10+
- name: Check if packagekit service exists
11+
shell: systemctl list-units --full --all | grep packagekit.service
12+
register: service_check
13+
changed_when: false
14+
become: yes
15+
ignore_errors: yes
16+
failed_when: false
17+
18+
- name: Mask and stop packagekit service
19+
service:
20+
name: packagekit
21+
enabled: no
22+
state: stopped
23+
become: yes
24+
when: service_check.rc == 0
25+
26+
- name: Wait for packagekitd processes to stop
27+
command: pgrep packagekitd
28+
register: result
29+
until: result.rc != 0
30+
retries: 30
31+
delay: 1
32+
become: yes
33+
ignore_errors: yes
34+
when: service_check.rc == 0
35+
36+
- name: Kill any existing Zypper processes
37+
command: pkill zypper
38+
ignore_errors: yes
39+
failed_when: false
40+
41+
- name: Wait for all Zypper processes to stop
42+
command: pgrep zypper
43+
register: zypper_check
44+
until: zypper_check.rc != 0
45+
retries: 30
46+
delay: 1
47+
become: yes
48+
ignore_errors: true
49+
failed_when: false
50+
51+
- name: Check if Zypper lock file exists
52+
stat:
53+
path: /var/run/zypp.pid
54+
register: lockfile_check
55+
become: yes
56+
57+
- name: Remove stale Zypper lock file
58+
file:
59+
path: /var/run/zypp.pid
60+
state: absent
61+
become: yes
62+
when: lockfile_check.stat.exists
63+
1064
# Fully patch system
1165
- name: Apply all available patches
1266
community.general.zypper:

0 commit comments

Comments
 (0)