# ansible-playbook structure

**URL:** <https://forum.ansible.com/t/ansible-playbook-structure/17650>\
**Category:** Ansible Project\
**Created:** [March 2, 2015, 4:56pm UTC](https://forum.ansible.com/t/ansible-playbook-structure/17650 "2015-03-02T16:56:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Khoa\_Nguyen](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@Khoa\_Nguyen](https://forum.ansible.com/u/Khoa_Nguyen)\
**Post date:** [March 2, 2015, 4:56pm UTC](https://forum.ansible.com/t/ansible-playbook-structure/17650/1 "2015-03-02T16:56:46Z")

</div>

Hi  
I make a playbook with structure:

ansible-test/  
├── playbook.yaml  
└── staging  
├── group\_vars  
│ ├── test1  
│ └── test2  
└── inventory

**playbook.yaml:**

- hosts: test1  
gather\_facts: false  
tasks:

- hosts: test2  
gather\_facts: false  
tasks:

**staging:**  
[test1]  
127.0.0.1  
[test2]  
127.0.0.1

**test1**  
env\_name: test1  
**test2**  
env\_name: test2

The result:  
PLAY [test1] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK: [debug var={{env\_name}}] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [127.0.0.1] =\> {  
“test2”: “{{ test2 }}”  
}

PLAY [test2] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK: [debug var={{env\_name}}] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [127.0.0.1] =\> {  
“test2”: “{{ test2 }}”  
}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
127.0.0.1 : ok=2 changed=0 unreachable=0 failed=0

When ansible access test1 host, It load test2 in group\_vars.  
But I think It should load test1 in group\_vars. I posted this problem here

[https://github.com/ansible/ansible/issues/10370](https://github.com/ansible/ansible/issues/10370)

However, I still don’t understand .

Please help me deal with this problem.

Thank you in advance

Thanks and Regards,

Khoa Nguyen
