multiple variables

36 views
Skip to first unread message

atrebla

unread,
Nov 16, 2016, 12:06:49 PM11/16/16
to Ansible Project
Is there a way to register two or more variables echoed from shell script? 
I want to do something like this: 

    script.sh
      A="hello"
      B="world"
      echo $A
      echo $B

    ROLE
      shell: "{{ script }} "
      register: result
      ignore_errors: False
    - name: debug
      debug: var={{ result1 }} -->of echo 1 --> hello 
      debug: var={{ result2 }} -->of echo 2 --> world


Is there some other way to do what I'm trying to do there?

thx

Kai Stian Olstad

unread,
Nov 16, 2016, 12:57:55 PM11/16/16
to ansible...@googlegroups.com
Your code would not run since it has some errors.

But you can get the first line from a output like this:
- debug: var=result.stdout_lines.0

and the second line like this:
- debug: var=result.stdout_lines.1


--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages