Unpinned package versions

Validate production package updates and specify the required versions and dependency scope.

Description

state: latest selects the newest package available from the repository at run time. This can support a planned patch policy, but the same playbook may install different versions on different runs.

Potential impact

An untested package or dependency change can disrupt service or degrade performance.

Remediation

When you need version control, specify the version in the package name and use state: present. With state: latest, update_only: true updates only installed packages and still allows their versions to change. Manage repositories and dependencies, and regularly review and test security updates before advancing a pinned version.

Examples

These yum excerpts require a compatible Ansible version and package backend. Confirm that the repository provides the version you intend to install.

Before

yaml
---
- name: 패키지 설치
  hosts: localhost
  tasks:
    - name: nginx 최신 버전 설치
      ansible.builtin.yum:
        name: nginx
        state: latest

After

yaml
---
- name: 패키지 설치
  hosts: localhost
  tasks:
    - name: nginx 고정 버전 설치
      ansible.builtin.yum:
        name: nginx-1.24.0
        state: present

nginx-1.24.0 illustrates how to select a version. Manage distribution package releases and dependency versions separately if those must also be pinned.

References