Hi@akhtar,
Variable in playbooks are very similar to using variables in any programming language. It helps you to use and assign a value to a variable and use that anywhere in the playbook.
- hosts: all
vars:
- pname: "httpd"
tasks:
- package:
name: "{{ pname }}"
state: present