1. when
- name : check
yum:
name: mariadb-server
state: latest
with_items: "{{ ansible_mounts }}"
when: item.mount == "/" and item.size_availabe > 300000
2. 조건 판단
- hosts : all
tasks:
- name :
command: /usr/bin/systemctl is-active postfix
ignore_errors: yes
register: result (결과저장)
- name:
service:
name: httpd
state: restarted
when: result.rc == 0
postfix가 활성화 되어 있으면 httpd를 restart
'Devops' 카테고리의 다른 글
ansible jinja2 템플릿 (0) | 2018.02.12 |
---|---|
ansible 핸들러 (0) | 2018.02.12 |
docker (0) | 2017.07.11 |
ansible playbook 반복 처리 및 필터 (0) | 2017.06.30 |
ansible task 주요 설정키 (0) | 2017.06.30 |