Playbook パッケージのアンインストールの書き方のサンプル

環境
Ansible 2.9
RHEL8
Python 3.8

構文

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
yum :
name:パッケージ名
state:absent
yum : name:パッケージ名 state:absent
yum :
  name:パッケージ名
  state:absent

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
- hosts: all
become: yes
tasks:
- name: Uninstall httpd
yum:
name: httpd
state: absent
- hosts: all become: yes tasks: - name: Uninstall httpd yum: name: httpd state: absent
- hosts: all
  become: yes
  tasks:
    - name: Uninstall httpd
      yum:
        name: httpd
        state: absent

Ansible 実行後のインストール済みパッケージ確認
# yum list installed | grep httpd

Ansible

Posted by arkgame