Skip to content

Commit

Permalink
Add packagekit stop tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
BillAnastasiadis committed Oct 30, 2023
1 parent 7b0a83c commit 34c2848
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions ansible/playbooks/fully-patch-system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,60 @@
use_reboottimeout: 600

tasks:
- name: Check if packagekit service exists
shell: systemctl list-units --full --all | grep packagekit.service
register: service_check
changed_when: false
become: yes
ignore_errors: yes
failed_when: false

- name: Mask and stop packagekit service
service:
name: packagekit
enabled: no
state: stopped
become: yes
when: service_check.rc == 0

- name: Wait for packagekitd processes to stop
command: pgrep packagekitd
register: result
until: result.rc != 0
retries: 30
delay: 1
become: yes
ignore_errors: yes
when: service_check.rc == 0

- name: Kill any existing Zypper processes
command: pkill zypper
ignore_errors: yes
failed_when: false

- name: Wait for all Zypper processes to stop
command: pgrep zypper
register: zypper_check
until: zypper_check.rc != 0
retries: 30
delay: 1
become: yes
ignore_errors: true
failed_when: false

- name: Check if Zypper lock file exists
stat:
path: /var/run/zypp.pid
register: lockfile_check
become: yes

- name: Remove stale Zypper lock file
file:
path: /var/run/zypp.pid
state: absent
become: yes
when: lockfile_check.stat.exists

# Fully patch system
- name: Apply all available patches
community.general.zypper:
Expand Down

0 comments on commit 34c2848

Please sign in to comment.