Automation Tools/Ansible
1.7 ansible | [test][playbook] nginx 설치
ploz
2021. 3. 16. 14:52
반응형
[root@ANSIBLE ansible]# cat install_nginx.yml
---
- name: "install nginx"
hosts: test1
become: true
tasks:
- name: "yum install"
yum:
name: nginx
state: installed
notify:
- restart nginx
handlers:
- name: restart nginx
service:
name: nginx
state: restarted
## yum 모듈 설치 관련 state 파라미터
## installed, present : 설치
## latest : 최신 버전 설치
## absent, removed : 삭제
## handlers 는 tasks 와 기본적으로 하는 일은 같으나 차이점은 notify에 의해 호출 되었을때만 동작함.
## 또한 changed 된 상태에서만 동작하며 ok로 변화가 없으면 실행 되지 않는다.
반응형