Skip to content
TrySitePrice

Ansible zypper update all packages on OpenSUSE/SUSE

Best/Tutorial

To update all packages on OpenSUSE/SUSE using Ansible, you can use the zypper module.

Here's an example playbook that updates all packages on a target OpenSUSE/SUSE system:

- name: Update all packages on OpenSUSE/SUSE
 hosts: openSUSE
 become: yes
 tasks:
 - name: Update all packages
 zypper:
 name: '*'
 state: latest

In this example, the zypper module is used to update all packages on the target system. The name parameter is set to *, which tells Ansible to update all packages, and the state parameter is set to latest, which tells Ansible to update the packages to the latest version.

You can also use the update command to update all packages with zypper:

- name: Update all packages on OpenSUSE/SUSE
 hosts: openSUSE
 become: yes
 tasks:
 - name: Update all packages
 command: zypper --non-interactive update

You can also specify specific package name to update:

- name: Update package named package_name
 hosts: openSUSE
 become: yes
 tasks:
 - name: Update package
 zypper:
 name: package_name
 state: latest

Please note that you need to have the zypper package manager installed on your OpenSUSE/SUSE system, and you need to run the playbook with the appropriate privileges (usually as root) in order to update packages.

Also it's important to keep your systems updated to ensure security and stability.