We consider this unsafe due to the fact that, if the variable is based on a
fact of some kind, your tasks could start doing unexpected or malicious
things (in the event that the remote system is compromised in some way).
In your example, you could still simplify your task by simply restructuring
it a bit:
- file:
src: "{{item.src}}"
dest: "{{item.dest}}"
state: link
with_items:
<your var list here>
James Cammarata
Ansible Lead/Sr. Principal Software Engineer
Ansible by Red Hat
twitter: @thejimic, github: jimi-c
On Thu, Mar 16, 2017 at 6:02 AM, MichaĆ Czeraszkiewicz <[email protected]>
wrote:
> I'm trying out this playbook:
>
> ---
>
> - name: Test
> hosts: all
> vars:
> link_list:
> - src: /etc/hosts
> dest: /tmp/2
> state: link
> - src: /etc/fstab
> dest: /tmp/1
> state: link
> - src: /etc/hostname
> dest: /tmp/3
> state: link
> - src: /etc/resolv.conf
> dest: /tmp/4
> state: link
> tasks:
> - file:
> args: "{{ item }}"
> with_items: "{{ link_list }}"
>
>
>
> I get the following message:
>
> [DEPRECATION WARNING]: Using variables for task params is unsafe,
> especially if the variables come from an external source like facts.
> This feature will be removed in a future release. Deprecation warnings
> can be disabled by setting deprecation_warnings=False in ansible.cfg.
>
> Why is that so?
>
> I think the usage of args is more elegant and feature proof (I don't need
> to extend my role when parameters change in the module) than specifying the
> arguments by hand. See example here
> <https://github.com/geerlingguy/ansible-role-elasticsearch-curator/pull/10/files>
> .
>
> --
> 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/8de82682-1289-467d-907d-b2b5272045a9%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/8de82682-1289-467d-907d-b2b5272045a9%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CAEhzua7Ja1YcnBRhJ8cQCfhDJttQ_GnZp8KqZtGjiD7GuGcroQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.