Skip to content

Package Management

Package Operations

# Generic package
- name: Install packages
  package:
    name: 
      - nginx
      - redis
    state: present

# Specific package managers
- name: APT specific
  apt:
    name: postgresql
    update_cache: yes

- name: YUM/DNF specific
  dnf:
    name: httpd
    enablerepo: epel

Package Repositories

- name: Add repository
  apt_repository:
    repo: ppa:nginx/stable
    state: present

- name: Add RPM key
  rpm_key:
    key: https://example.com/key.gpg
    state: present