Let's say you've a playbook named foo.yml that exists in the /usr/local directory, like this.
/usr/local/foo.yml
The playbook_dir variable will contain the directory that contains the playbook. Here is how you would print the playbook_dir variable.
- name: "output the 'playbook_dir' variable"
debug:
msg: "{{ playbook_dir }}"
Running this playbook should produce the following.
TASK [output the 'playbook_dir' variable]
ok: [server1.example.com] => {
"msg": "/usr/local"
}