with_nested and empty lists

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).

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?