LoginSignup
101
97

More than 5 years have passed since last update.

Ansible ~yumモジュール~

Last updated at Posted at 2014-11-04

Ansible Documentationのyumモジュールの内容のメモです。

Ansible Documentation

概要

yumパッケージマネージャによるパッケージやグループのインストール、アップグレード、削除、一覧表示を実行する。

オプション

頻度 パラメータ 必須 デフォルト値 選択肢 説明
conf_file no - - 対象ホストで /etc/yum.conf以外のファイルを使用する場合に指定する
disable_gpg_check no no yes
no
パッケージの署名チェックを無効にする
disablerepo no - - 無効にするリポジトリを指定する。複数の場合はカンマ区切りで記述する。
enablerepo no - - 有効にするリポジトリを指定する。複数の場合はカンマ区切りで記述する。
list no - - ?
name yes - - パッケージ名を指定する。『state=latest』かつ『name=*』を指定した場合は『yum -y update』を実行する。URLやローカルパスの指定も可能。
state no present present
latest
absent
present:インストールされていること。
latest:最新に更新する。
absent:インストールされていない。
(※groupinstallの時はlatestだと動かないためpresentを指定すること)

example.yml
- name: install the latest version of Apache
  yum: name=httpd state=latest

- name: remove the Apache package
  yum: name=httpd state=absent

- name: install the latest version of Apache from the testing repo
  yum: name=httpd enablerepo=testing state=present

- name: upgrade all packages
  yum: name=* state=latest

- name: install the nginx rpm from a remote repo
  yum: name=http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm state=present

- name: install nginx rpm from a local file
  yum: name=/usr/local/src/nginx-release-centos-6-0.el6.ngx.noarch.rpm state=present

- name: install the 'Development tools' package group
  yum: name="@Development tools" state=present

参考

101
97
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
101
97