Example Handler Task in a Play

Ansible Terminal
  tasks:

  - name: Ensure httpd package is present
    yum:
      name: httpd
      state: latest
    notify: httpd_running

  - name: Verify correct config file is present
    copy:
      src: files/index.html
      dest: /var/www/html/index.html

  handlers:

  - name: httpd_running
    service:
      name: httpd
      state: restarted
			

Example Handler Task in a Play

Ansible Terminal
  tasks:

  - name: Ensure httpd package is present
    yum:
      name: httpd
      state: latest
    notify: httpd_running                                    

  - name: Verify correct config file is present
    copy:
      src: files/index.html
      dest: /var/www/html/index.html

  handlers:

  - name: httpd_running
    service:
      name: httpd
      state: restarted
			

Example Handler Task in a Play

Ansible Terminal
  tasks:

  - name: Ensure httpd package is present
    yum:
      name: httpd
      state: latest
    notify: httpd_running

  - name: Verify correct config file is present
    copy:
      src: files/index.html
      dest: /var/www/html/index.html

  handlers:                                                  

  - name: httpd_running
    service:
      name: httpd
      state: restarted
			

Example Handler Task in a Play

Ansible Terminal
  tasks:

  - name: Ensure httpd package is present
    yum:
      name: httpd
      state: latest
    notify: httpd_running

  - name: Verify correct config file is present
    copy:
      src: files/index.html
      dest: /var/www/html/index.html

  handlers:

  - name: httpd_running                                      
    service:
      name: httpd
      state: restarted
			

Example Handler Task in a Play

Ansible Terminal
  tasks:

  - name: Ensure httpd package is present
    yum:
      name: httpd
      state: latest
    notify: httpd_running                                    

  - name: Verify correct config file is present
    copy:
      src: files/index.html
      dest: /var/www/html/index.html

  handlers:                                                  
                                                             
  - name: httpd_running                                      
    service:
      name: httpd
      state: restarted