Skip to content

Instantly share code, notes, and snippets.

@seraphyn
Last active September 24, 2024 12:28
Show Gist options
  • Save seraphyn/873e4c82db11f3a91f3a2b3f8677e22e to your computer and use it in GitHub Desktop.
Save seraphyn/873e4c82db11f3a91f3a2b3f8677e22e to your computer and use it in GitHub Desktop.
There is a zypper core module for ansible (https://docs.ansible.com/ansible/latest/collections/community/general/zypper_module.html), which unfortunately does not show the available updates. I helped myself to write this ansible playbook years ago and thought maybe someone else could use it in their everyday life.
- hosts: sles
become: true
become_user: root
tasks:
- name: Zypper Uppate awk to file
shell:
" zypper ref && zypper lu | awk '{print $5, $7, $9 }' | sed -e '1,10d' | sed 's/\"//' > /tmp/awklist.txt "
register: lsout
tags: lsout
- name: zeige awklist
shell : cat /tmp/awklist.txt
register: displaylist
- debug: msg="{{displaylist.stdout_lines}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment