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? 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/05aeda06-925b-4a52-a2be-4d65253e25d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to