# Ansible variables between playbooks

**URL:** <https://forum.ansible.com/t/ansible-variables-between-playbooks/29216>\
**Category:** Ansible Developer\
**Tags:** windows\
**Created:** [December 7, 2018, 2:08pm UTC](https://forum.ansible.com/t/ansible-variables-between-playbooks/29216 "2018-12-07T14:08:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Revanth\_Gopu](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@Revanth\_Gopu](https://forum.ansible.com/u/Revanth_Gopu)\
**Post date:** [December 7, 2018, 2:08pm UTC](https://forum.ansible.com/t/ansible-variables-between-playbooks/29216/1 "2018-12-07T14:08:25Z")

</div>

I have a requirement to create directories in UNIX based on group of windows hosts. Plan is to create a playbook1 which runs against windows inventory and set a list/array using set\_stats module and utilize this variable in playbook2 to create directories in UNIX. Below is the script i am using as of now and end result is one directory with one big string which is concatenation of all windows hosts names.

Can you help in approach of creating list dynamically and setting the stat.

Playbook runs on Windows - name: set hostname in a variable set\_stats: data: current\_hostname: “{{ ansible\_hostname }}” per\_host: no Playbook runs on Unix name: Creates UNIX directory file: path: “{{ ARCH\_DIR\_LOC + current\_hostname + ‘/’}}” state: directory mode: 0777

Thank you,  
Revanth
