## PLAY VARIABLES

Ansible Terminal

    - name: Ensure apache is installed and started
      hosts: web
      become: yes
      vars:
        http_port: 80
        http_docroot: /var/www/gokev.com

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

      - name: Verify correct config file is present
        template:
          src: templates/httpd.conf.j2
          dest: /etc/httpd/conf/httpd.conf

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

Variables are used to store metadata for each host drawing from numerous sources. Here we see another one of those sources, a variable "http_port" that has been embedded in a play.

Recalling the previous variable precedence slide, play variables are number 7 in Ansible's the precedence chain.