Issue 1:
ISSUE TYPE

Bug Report

COMPONENT NAME

core / vars expansion

ANSIBLE VERSION

ansible 2.2.0.0
config file =
configured module search path = Default w/o overrides```

CONFIGURATION

N/A

OS / ENVIRONMENT

Ubuntu 16.04

SUMMARY

A variable assignment can pass through a simple numeric value, but not a numeric value from a member of an object - in that case it gets silently converted to a string.

STEPS TO REPRODUCE

- hosts: localhost

vars:
five: 5
nested:
five: 5

tasks:
- set_fact:
a: 5
b: '{{ five }}'
c: '{{ nested.five }}'

- debug: msg="a0={{a}}"
- debug: msg="a1={{a+1}}"
- debug: msg="b0={{b}}"
- debug: msg="b1={{b+1}}"
- debug: msg="c0={{c}}"
- debug: msg="c1={{c+1}}"

EXPECTED RESULTS

a, b and c are the number 5; the values of a+1, b+1 and c+1 are 6.

ACTUAL RESULTS

PLAY [localhost] ***************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [set_fact] ****************************************************************
ok: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
"msg": "a0=5"
}

TASK [debug] *******************************************************************
ok: [localhost] => {
"msg": "a1=6"
}

TASK [debug] *******************************************************************
ok: [localhost] => {
"msg": "b0=5"
}

TASK [debug] *******************************************************************
ok: [localhost] => {
"msg": "b1=6"
}

TASK [debug] *******************************************************************
ok: [localhost] => {
"msg": "c0=5"
}

TASK [debug] *******************************************************************
fatal: [localhost]: FAILED! => {"failed": true, "msg": "Unexpected templating type error occurred on (c1={{c+1}}): coercing to Unicode: need string or buffer, int found"}
to retry, use: --limit @/home/ubuntu/vtp/ansible/bar.retry

That is, the value of c is a string not a number.

STEPS TO REPRODUCE

Here is another example, this time using the vars option to the template module. The final test case, using with_items, is the actual use case which bit me.

templates/test.j2

{% for i in range(num) %}
{{ i }}
{% endfor %}

foo.yml

- hosts: localhost

tasks:
- name: test with direct var
template:
src: test.j2
dest: /tmp/f1
vars:
num: 5

- name: test with item var
template:
src: test.j2
dest: '{{ item.filename }}'
vars:
num: '{{ item.count }}'
with_items:
- { filename: '/tmp/f2', count: 5 }

EXPECTED RESULTS

In both cases, the template would be expanded with num equal to the number 5.

ACTUAL RESULTS

PLAY [localhost] ***************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [test with direct var] ****************************************************
ok: [localhost]

TASK [test with item var] ******************************************************
failed: [localhost] (item={u'count': 5, u'filename': u'/tmp/f2'}) => {"failed": true, "item": {"count": 5, "filename": "/tmp/f2"}, "msg": "AnsibleError: Unexpected templating type error occurred on ({% for i in range(num) %}\n{{ i }}\n{% endfor %}\n): an integer is required"}
to retry, use: --limit @/home/ubuntu/vtp/ansible/foo.retry

That is, in the with_items case, the value is string "5" rather than number 5.

WORKAROUND

Change the template so it says:

{% for i in range(num | int) %}
{{ i }}
{% endfor %}

But this seems very arbitrary. Surely an integer value is always an integer value?

Issue 2:
From @my2ndhead on 2016-02-08T19:49:03Z

ISSUE TYPE

Bug Report

COMPONENT NAME

ini_file module

ANSIBLE VERSION

2.0.0.2

SUMMARY

Compared to 1.9.x the version 2.0.0.2 does not add an empty line between sections. This makes ini-files hard to read.

1.9.x

[section1]
key=value

[section2]
key=value

2.0.0.2

[section1]
key=value
[section2]
key=value

Copied from original issue: ansible/ansible-modules-core#2988