community.general.yum_versionlock (8.5.0) — module

Locks / unlocks a installed package(s) from being updated by yum package manager

| "added in version" 2.0.0 of community.general"

Authors: Florian Paul Azim Hoberg (@gyptazy), Amin Vakil (@aminvakil)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

This module adds installed packages to yum versionlock to prevent the package(s) from being updated.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Prevent Apache / httpd from being updated
  community.general.yum_versionlock:
    state: present
    name:
    - httpd
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Prevent Apache / httpd version 2.4.57-2 from being updated
  community.general.yum_versionlock:
    state: present
    name:
    - httpd-0:2.4.57-2.el9
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Prevent multiple packages from being updated
  community.general.yum_versionlock:
    state: present
    name:
    - httpd
    - nginx
    - haproxy
    - curl
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove lock from Apache / httpd to be updated again
  community.general.yum_versionlock:
    state: absent
    name: httpd

Inputs

    
name:
    description:
    - Package name or a list of package names with optional version or wildcards.
    - Specifying versions is supported since community.general 7.2.0.
    elements: str
    required: true
    type: list

state:
    choices:
    - absent
    - present
    default: present
    description:
    - If state is V(present), package(s) will be added to yum versionlock list.
    - If state is V(absent), package(s) will be removed from yum versionlock list.
    type: str

Outputs

packages:
  description: A list of package(s) in versionlock list.
  elements: str
  returned: success
  sample:
  - httpd
  type: list
state:
  description: State of package(s).
  returned: success
  sample: present
  type: str