group_vars/all kinda works

So I’m trying to make use of group_vars/all so I don’t have to do something like this in all my playbooks:

James Nguyễn wrote:

So I'm trying to make use of group_vars/all so I don't have to do
something
like this in all my playbooks:

---
- name: sample playbook
  hosts: all
  vars_files:
  - vars/global.yml
  tasks:
  command: echo ${playbook_tasks}/${playbook}.yml
  - include: ${playbook_tasks}/${playbook}.yml
...

include is a pre-processing directive. This means it runs before any hosts
or groups are consulted, and thus can't use any host or group data. There is
only one task list, that is the same for all hosts, so includes have to be
globally processed.

Daniel

Thanks for the clarification.