Output of script & newline

20 views
Skip to first unread message

John Oliver

unread,
May 8, 2015, 5:55:35 PM5/8/15
to ansible...@googlegroups.com
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? 

Matt Martz

unread,
May 8, 2015, 6:04:16 PM5/8/15
to ansible...@googlegroups.com
Use the |trim jinja2 filter to strip whitespace off of the ends.

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8949ea26-28c8-4eeb-b9cd-7d9c7748cc2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Matt Martz
@sivel
sivel.net
Reply all
Reply to author
Forward
0 new messages