## HOST SELECTOR

Ansible Terminal

    - name: Ensure apache is installed and started
      hosts: web
      become: yes

      tasks:
      - name: Ensure httpd package is present
        yum:
          name: httpd
          state: latest

      - name: Ensure latest index.html file is present
        copy:
          src: files/index.html
          dest: /var/www/html/

      - name: Ensure httpd is started
        service:
          name: httpd
          state: started

The Ansible play host selector defines which nodes in the inventory the automation is targeting.

In this example, a single group of "web" is being targeted. Ansible supports targeting intersections, unions and filters of multiple groups or hosts though.

For more details see the host selector Patterns page in the Ansible documentation.