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 31, 2023
1 parent 7b0a83c commit b07a1a5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions ansible/playbooks/fully-patch-system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,38 @@
use_reboottimeout: 600

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

- name: Get PID from Zypper lock file
slurp:
src: /var/run/zypp.pid
register: pid_content
become: yes
when: lockfile_check.stat.exists

- name: Set PID variable
set_fact:
zypper_pid: "{{ (pid_content['content'] | b64decode).strip() }}"
when: lockfile_check.stat.exists

- name: Check if process with PID is running
shell: ps -p {{ zypper_pid }} -o comm=
register: process_check
failed_when: false
changed_when: false
when: lockfile_check.stat.exists

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

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

0 comments on commit b07a1a5

Please sign in to comment.