On Tue, Jan 12, 2016 at 2:16 PM, Jacob Weber <
weber...@gmail.com> wrote:
> I'm trying my playbooks with Ansible 2.0, and ran into a few minor issues:
>
> - The Ansible upgrade guide says "Using variables for task parameters is
> unsafe and will be removed in a future version." What does this mean
> exactly? I use variables in task parameters all the time -- this seems
> fundamental to Ansible. Can you clarify this? Is it only when you define
> variables and use them in the same task, like in the example?
>
it's this type of construct that's being deprecated:
---
- hosts: localhost
vars:
params:
data: 'message'
tasks:
- ping:
args: "{{ params }}"
This is the replacement:
tasks:
- ping:
data: "{{ params['data'] }}"
> - When my source and destination boxes are Linux, and I deployed a template
> with Windows line endings, they used to be converted to Unix line endings
> (in Ansible 1.9). Now the Windows line endings are preserved, but I didn't
> see this in the changelog.
>
Hmm... I don't see a change where we specifically set out to do that
but it makes sense. In 1.9.x some ansible modules (lineinfile and the
argument parsing in general) would make it impossible to retain
certain characteristics of your input data. Specifying trailing
newlines, for instance, could end up without newlines in the output.
In 2.0.x we tried not to do as much magic when it prevented people
from achieving those goals. If we had realized that one of those
changes was going to change automatic Unix vs Windows newline
conversion we would have called it out in the changelog but it's
probably the way we want 2.0 to behave even though we didn't
specifically add it.
If this turns out to be a wide spread problem we might be persuaded to
add a parameter to specific modules that controls line ending
conversion.
> - The upgrade guide says I should receive a deprecation warning in this
> case: "Bare variables in with_ loops should instead use the “{{var}}”
> syntax, which helps eliminate ambiguity." But I'm not getting that warning
> for things like "with_items: some_variable".
>
I looked at the code and see that we are not printing the deprecation
warning here even though there's a note in the code 9as well as the
changelog) that it is deprecated. I've alerted @bcoca about hte issue
and opened a bug report:
https://github.com/ansible/ansible/issues/13852
-Toshio