Ansible - 조건적 실행 ( handler, when )
·
Infra/Ansible
[ Handler ]핸들러는 notify에 의해 호출되며 주로 서비스 재시작, 캐시클리어 등 후속 작업을 처리합니다.별로의 handler 폴더에 정의되어 실행할 수 있습니다.핸들러는 플레이북 실행 종료 시점에 호출됩니다.동일한 핸들러가 여러 태스크에서 호출되더라도 한번만 실행합니다.실행 순서는 notify에 나열된 순서가아니라 handler에 선언된 순서로 실행됩니다. [ Handler Example ]tasks:- name: Template configuration file ansible.builtin.template: src: template.j2 dest: /etc/foo.conf notify: - Restart apache - Restart memcachedhandlers..