## WORKING WITH BLOCKS

Blocks cut down on repetitive task directives, allow for logical grouping of tasks and even in play error handling.

Ansible Terminal

      block:
      - yum:
          name: "{{ item }}"
          state: latest
        with_items:
        - httpd
        - php56

      - template:
          src: templates/httpd.conf.j2
          dest: /etc/httpd/conf/httpd.conf
      when: ansible_os_family == "RedHat"

In the provided example we use a block to group two tasks that are to be conditional executed if a host is running a Red Hat family linux using one conditional clause. In practice, we could have copied the `when` clause onto each task and gotten same result. Using a block, there is less clutter thereby less to maintain and nothing to keep in sync. The utility of using a block increases the more tasks and clauses are in use.

Blocks have a play in error handling and automating roll backs that we won't get into here given the scope of that topic.

See the documentation on blocks to dig deeper.