[Ansible] yum module 예제 정리

 

예제 1. httpd 최신 버전의 패키지 설치

- name: install the latest version of Apache
  yum:
    name: httpd
    state: latest

 

 

예제 2. 여러 패키지를 한 번에 설치

- name: Install a list of packages
  yum:
    name:
      - nginx
      - postgresql
      - postgresql-server
    state: present

 

 

예제 3. httpd 패키지 삭제

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

 

 

예제 4. 외부에 있는 repo로부터 rpm 패키지 설치 

- 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

 

 

예제 5. 패키지를 다운만 받고 설치는 하지 않음

- name: Download the nginx package but do not install it
  yum:
    name:
      - nginx
    state: latest
    download_only: true

 

출처 : https://docs.ansible.com/ansible/latest/modules/yum_module.html

댓글

Designed by JB FACTORY

loading