Saturday, June 5, 2021

Ansible Handler use



---
- hosts: node1
  become: yes
  become_method: sudo
  tasks:
    - name: copy demo.example.conf configuration template
      copy:
        src: /etc/ansible/playbook/when.yml
        dest: /etc/tmp/when.yml
      notify:
        - stop_httpd
  handlers:
    - name: stop_httpd
      service:
        name: httpd
        state: stopped

No comments: