# How to use registered variable in with\_items list?

**URL:** <https://forum.ansible.com/t/how-to-use-registered-variable-in-with-items-list/18874>\
**Category:** Ansible Project\
**Created:** [July 28, 2015, 1:49pm UTC](https://forum.ansible.com/t/how-to-use-registered-variable-in-with-items-list/18874 "2015-07-28T13:49:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_John](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@Tim\_John](https://forum.ansible.com/u/Tim_John)\
**Post date:** [July 28, 2015, 1:49pm UTC](https://forum.ansible.com/t/how-to-use-registered-variable-in-with-items-list/18874/1 "2015-07-28T13:49:23Z")

</div>

Hey guys, I’m trying to use a registered variable in **with\_items** list, but can find a way to do it.

Here is what I’m doing:

```yaml
- **name** : acquire Django root path
**shell** : pip show django | grep 'Location' | sed 's/Location:\ //g'
**register** : django_root

- **name** : customize Graphite Apache configuration
**lineinfile** : dest={{ apache_vhost_folder }}/graphite.conf regexp={{ item.default }} line={{ item.custom }} state=present
**with_items** :
- { **default** : 'WSGISocketPrefix run/wsgi', **custom** : 'WSGISocketPrefix /var/run/{{ apache_service_name }}/wsgi' }
- { **default** : '\@DJANGO_ROOT\@', **custom** : "{{ **django_root**.stdout_lines }}" } # trying to use registered variable **django_root** , but failed

```

First, I get the Django root path, and register it as a variable named ` **django_root** `;  
Then, I’d like to use it in the second item of ` **with_items** ` list, but failed.

Is there a good way to achieve this goal? Thanks!

Tim
