# Compiling a Playbook or resolving variables

**URL:** <https://forum.ansible.com/t/compiling-a-playbook-or-resolving-variables/17958>\
**Category:** Ansible Project\
**Created:** [April 11, 2015, 11:27am UTC](https://forum.ansible.com/t/compiling-a-playbook-or-resolving-variables/17958 "2015-04-11T11:27:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Ford](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@Matt\_Ford](https://forum.ansible.com/u/Matt_Ford)\
**Post date:** [April 11, 2015, 11:27am UTC](https://forum.ansible.com/t/compiling-a-playbook-or-resolving-variables/17958/1 "2015-04-11T11:27:18Z")

</div>

Hi,

I would like to be able to sort-of compile a playbook. Ideally I’d like to be able to see my playbook with all variables fully resolved (useful for some tools we are using to reason about Ansible).

For example; something like this would replace all {{ }} code with the real variables.

```auto
- hosts: localhost
connection: local
gather_facts: false

vars_files:
- "../vars/all.yml"
- "../vars/{{ env }}.yml"

tasks:
- name: create rabbitmq-internal stack
cloudformation:
stack_name: "{{ rabbitmq_internal_stack }}"
state: "present"
disable_rollback: true
region: "{{ cfn_aws_region }}"
template: "../templates/rabbitmq-internal.json"
template_parameters:
name: "rabbitmq-internal"
public: "false"
environment: "{{ env }}"

```

We have a simplar shell based parser but this is a dirty hack ( and fails on more complex j2 pipes). What would be the best approach to have Ansible do it? It must do the variable resolution so I figure we can back on to that. I’ve not looked at the code yet but figured some one might have done it all ready or perhaps a guru can point me to an elegant hack?

Many thanks for any pointers,

Matt.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 13, 2015, 1:12pm UTC](https://forum.ansible.com/t/compiling-a-playbook-or-resolving-variables/17958/2 "2015-04-13T13:12:07Z")

</div>

it is not that easy, the variables get resolved at different stages  
and might have different values depending on that, so even if you run  
through jinja2 with the loaded variables, you might not get the same  
results as when the play actually runs.
