What format to follow to add ansible vars in vars yaml file?

Content of vars.yaml


---
symfony_root_dir: /var/www/project
symfony_web_dir: "{{ symfony_root_dir }}/web"
symfony_var_dir: "{{ symfony_root_dir }}/var"
symfony_console_path: "{{ symfony_root_dir }}/bin/console"

Defining variables stored in external files

Content of first.tf


---
# this is a demo of conditional imports.  This is a powerful concept
# and can be used to use the same recipe for different types of hosts,
# based on variables that bubble up from the hosts from tools such
# as ohai or facter.
#
# Here's an example use case:
#
# what to do if the service for apache is named 'httpd' on CentOS
# but is named 'apache' on Debian?


# there is only one play in this playbook, it runs on all hosts
# as root

- hosts: all
  remote_user: root

# we have a common list of variables stored in /vars/external_vars.yml
# that we will always import

# next, we want to import files that are different per operating system
# and if no per operating system file is found, load a defaults file.
# for instance, if the OS was "CentOS", we'd try to load vars/CentOS.yml.
# if that was found, we would immediately stop.  However if that wasn't
# present, we'd try to load vars/defaults.yml.  If that in turn was not
# found, we would fail immediately, because we had gotten to the end of
# the list without importing anything.

  vars_files:

     - "vars/external_vars.yml"

     - [ "vars/{{ facter_operatingsystem }}.yml", "vars/defaults.yml" ]

# and this is just a regular task line from a playbook, as we're used to.
# but with variables in it that come from above.  Note that the variables
# from above are *also* available in templates

  tasks:

  - name: ensure apache is latest
    action: "{{ packager }} pkg={{ apache }} state=latest"

  - name: ensure apache is running
    service: name={{ apache }} state=running

Defining variables stored in external files

Content of first.tf


# Content of var_vars-files.yaml

---
- name: This sets up an httpd webserver
  hosts: web
  vars_files:
    - "vars.yaml"

  vars:
    myname: "raj-playbook"
    mycomp: "hp-playbook"

  tasks:
  - name: Install the httpd apps
    yum: name=httpd
  - name: start the httpd service
    service: name=httpd state=started
  - debug:
      msg: System {{ myname }} has uuid {{ ansible_product_uuid }}
  - debug: msg="System {{ myname }} has uuid {{ ansible_product_uuid }}"
  - debug: msg={{ ansible_product_uuid }}
  - debug: var=ansible_product_uuid
  - debug:
      var: ansible_product_uuid

# Content of vars.yaml

---
myname: "raj-varsfile"
age: "5"
...

# ansible-playbook -i inventory var_vars-files.yaml