Output of script & newline

ansible 1.9.0.1

  • name: Get java version
    script: /tmp/javaver.sh
    register: java_ver

  • name: Touch test file
    copy: dest=“/tmp/{{ java_ver.stdout }}”
    content=“test”

TASK: [Show output from installer] ********************************************
ok: [flamingo] => {
“msg”: “1.8.0_45\n”
}

joliver@flamingo U_JRE7_UNIX_V1R4_prep $ ls -l /tmp/
total 32
-rw-r–r-- 1 joliver staff 4 May 8 14:45 1.8.0_45?

Adding ‘_lines’ get a file called:

[‘1.8.0_45’]

How do I have ansible not try to interpret the newline?

Use the |trim jinja2 filter to strip whitespace off of the ends.