Playbook state:latestですべてのパッケージをアップデートする

環境
Ansible 2.9
RHEL8
Python 3.8

構文

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
yum:
name: '*'
state: latest
yum: name: '*' state: latest
yum:
name: '*'
state: latest

name: '*’ かつ state: latest を指定してすべてのパッケージをアップデートします。

使用例
OSのすべてのパッケージをアップデートします。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
- hosts: all
become: yes
tasks:
- name: Update packages
yum:
name: '*'
state: latest
- hosts: all become: yes tasks: - name: Update packages yum: name: '*' state: latest
- hosts: all
  become: yes
  tasks:
    - name: Update packages
      yum:
        name: '*'
        state: latest

Ansible 実行後のアップデート可能パッケージチェック
# yum check-update

Ansible

Posted by arkgame