# Problems passing complex object via role dependencies

**URL:** <https://forum.ansible.com/t/problems-passing-complex-object-via-role-dependencies/13673>\
**Category:** Ansible Project\
**Created:** [October 14, 2013, 9:23pm UTC](https://forum.ansible.com/t/problems-passing-complex-object-via-role-dependencies/13673 "2013-10-14T21:23:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kesten\_Broughton2](https://avatars.discourse-cdn.com/v4/letter/k/ecc23a/32.png) [@Kesten\_Broughton2](https://forum.ansible.com/u/Kesten_Broughton2)\
**Post date:** [October 14, 2013, 9:23pm UTC](https://forum.ansible.com/t/problems-passing-complex-object-via-role-dependencies/13673/1 "2013-10-14T21:23:06Z")

</div>

The goal is to pass a complex object to a dependent role.  
This works fine for scalars, but I was having troubles with  
a dict.

Full details at the gist which i accidentally made private:  
[https://gist.github.com/darKoram/615d075d16762d848a13](https://gist.github.com/darKoram/615d075d16762d848a13)

Or you can clone it and make it public perhaps:  
[https://gist.github.com/615d075d16762d848a13.git](https://gist.github.com/615d075d16762d848a13.git)

Solution (thought i’d share it) and ask if there is an easier way.

### called role. use jinja filters to recompose string to json and

### then capture it.

```auto
 - debug: msg="{{complex | to_json | capture(complicated)}}"

```

---

<div class="post-metadata">

**Author:** ![Brice\_Burgess](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@Brice\_Burgess](https://forum.ansible.com/u/Brice_Burgess)\
**Post date:** [October 15, 2013, 4:27am UTC](https://forum.ansible.com/t/problems-passing-complex-object-via-role-dependencies/13673/2 "2013-10-15T04:27:11Z")

</div>

Passing tags as an array to _role dependencies_ failed with a python error also… perhaps related to Kesten’s post? Bear in mind I though it was probably a “bad thing” to pass tags like this as it could lead to inconsistent state and painful debugging, so moved on.

My example:

[applications/test\_app/meta/main.yml]

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 15, 2013, 1:56pm UTC](https://forum.ansible.com/t/problems-passing-complex-object-via-role-dependencies/13673/3 "2013-10-15T13:56:07Z")

</div>

This list does not allow mentioning of “a Python error” without actually pasting what the error is 🙂

Can you please file a github ticket? Thanks!

---

<div class="post-metadata">

**Author:** ![Brice\_Burgess](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@Brice\_Burgess](https://forum.ansible.com/u/Brice_Burgess)\
**Post date:** [October 15, 2013, 4:35pm UTC](https://forum.ansible.com/t/problems-passing-complex-object-via-role-dependencies/13673/4 "2013-10-15T16:35:37Z")

</div>

Hah! Was nowhere near an environment I could run ansible at while writing that post. Filed now;

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