# How to execute a playbook before a role?

**URL:** <https://forum.ansible.com/t/how-to-execute-a-playbook-before-a-role/30064>\
**Category:** Ansible Project\
**Created:** [April 4, 2019, 4:50pm UTC](https://forum.ansible.com/t/how-to-execute-a-playbook-before-a-role/30064 "2019-04-04T16:50:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [April 4, 2019, 4:50pm UTC](https://forum.ansible.com/t/how-to-execute-a-playbook-before-a-role/30064/1 "2019-04-04T16:50:55Z")

</div>

This doesn’t work of course, but shows what I am trying to do. I wish to call a playbook before a couple of roles. How might I do this?

Doesn’t work, but is an explanatory example:

`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [April 4, 2019, 5:03pm UTC](https://forum.ansible.com/t/how-to-execute-a-playbook-before-a-role/30064/2 "2019-04-04T17:03:43Z")

</div>

you cannot have a play inside a play, - import\_playbook cannot be in a  
task section, but easy enough to do what you want:

- import\_playbook: /etc/ansible/playbooks/one-offs/update\_gitlab\_scripts.yml

- hosts: "{{ host}}"  
&nbsp;&nbsp;roles: ....

---

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [April 4, 2019, 5:12pm UTC](https://forum.ansible.com/t/how-to-execute-a-playbook-before-a-role/30064/3 "2019-04-04T17:12:57Z")

</div>

Thanks Brian!
