how to share variables between hosts

i have this:

i have this:

---
- hosts: all
vars:
- site: "{{ ansible_hostname | regex_replace('^(.{2}).*' ,'\\1' ) }}"
- datavg: DATAVG
- datavgpvs: /dev/sdb
- lv_int:
- { lv: app, size: "{{appS}}", vg: "{{datavg}}", fs: xfs, mount: "/app" }

- hosts:
- a
become: yes
become_method: sudo
vars:
- appS: 30G

tasks:
- name: Setup datavg LVs
lvol: lv={{item.lv}} state=present vg={{datavg}} size={{item.size}}
with_items: "{{ hostvars[all].lv_inst }}"

but i have error in hostvars "' 'all' is undefined"

It's unclear why you don't loop over lv_int:

with_items: "{{ lv_int }}"

Otherwise use group variables to share variables between hosts.

Regards
        Racke