# with\_nested and empty lists

**URL:** <https://forum.ansible.com/t/with-nested-and-empty-lists/22448>\
**Category:** Ansible Project\
**Created:** [September 1, 2016, 11:10am UTC](https://forum.ansible.com/t/with-nested-and-empty-lists/22448 "2016-09-01T11:10:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pim\_Rupert](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Pim\_Rupert](https://forum.ansible.com/u/Pim_Rupert)\
**Post date:** [September 1, 2016, 11:10am UTC](https://forum.ansible.com/t/with-nested-and-empty-lists/22448/1 "2016-09-01T11:10:59Z")

</div>

I have the following task which uses with\_nested with variables that could be empty.

> - name: Authorize SSH keys for all website users.
> 
> authorized\_key:
> 
> user=“{{ item.0.user | default(websites\_default\_user) }}”
> 
> key=“{{ lookup(‘file’, ‘data/public-ssh-keys/’ ~ item.1.key) }}”
> 
> key\_options=“{{ item.1.options | default(omit) }}”
> 
> state=“{{ item.1.state | default(‘present’) }}”
> 
> with\_nested:
> 
> - “{{ websites }}”
> 
> - “{{ ssh\_keys\_for\_all\_websites }}”

This stopped working in Ansible 2.0, but is working again since Ansible 2.1 (see [https://github.com/ansible/ansible/issues/14498](https://github.com/ansible/ansible/issues/14498)).

However, it is now throwing the following warning:

> [DEPRECATION WARNING]: Skipping task due to undefined Error, in the future this will be a fatal error.:  
> ‘ssh\_keys\_for\_all\_websites’ is undefined.

First of all, this warning is incorrect. The variable “ssh\_keys\_for\_all\_websites” is defined, it is defined as “”, an empty list. Further, I want to continue to be able to use with\_nested with variables that could (for some hosts) be empty. If this is deprecated, what is the suggested alternative?
