AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,100 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example" published by Apress, and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

Install a package in Suse-like systems - Ansible module zypper

By Luca Berton · Published 2024-01-01 · Category: installation

A real-life example of how to install a package in Suse-like systems: SUSE Linux Enterprise Server and openSUSE

How to Install a package with Ansible in Suse-like systems? I'm going to show you a live Playbook with some simple Ansible code. I'm Luca Berton and welcome to today's episode of Ansible Pilot. Ansible Install a package in Suse-like systems Today we're talking about the Ansible module zypper. The full name is community.general.zypper which means is part of the Community General Collection so maintained by the Ansible Community contributors. It works on Syse-like operating systems and Manages packages on SUSE and openSUSE via the zypper package manager. It's similar to the yum or DNF module for RedHat-like operating systems or the apt module for Debian-like operating systems.

Parameters • name _string_ - name or package specific • state _string_ - present / absent / latest • type _string_ - package / patch / pattern / product / srcpackage / application • update_cache _boolean_ - no/yes

The parameter list is pretty wide but these four are the most important options. In the "name" parameter you are going to specify the name of the package or the specific version you would like to install. The state specifies the action that we would like to perform. In our case for install is "present". The type of package to be operated on package / patch / pattern / product / srcpackage / application. "update_cache" forces to update the repository metadata before the installation. It could be useful to make sure that repositories are up-to-date. The equivalent of console commandzypper refresh.

## Playbook Let's jump in a real-life playbook to install a package in Suse-like systems with Ansible.

code • zypper.yml

execution output

verification

code with ❤️ in GitHub

Conclusion Now you know how to install a package of a package in Suse-like systems.

Related ArticlesAnsible Become GuideAnsible Inventory GuideAnsible Roles Guide

Category: installation

Watch the video: Install a package in Suse-like systems - Ansible module zypper — Video Tutorial

Browse all Ansible tutorials · AnsiblePilot Home