2017-12-05 7 views

答えて

0

あなたはjinja filterであなたのリストに参加し、このように、変数として渡すことができます。

ansible -m script -a "myscript.sh {{ test_list|join(' ') }}" localhost -e "{"test_list": [1,2,3]}"

myscript.shがある場合:

#!/bin/bash 
echo Args are: ${@}, 1st: $1 2nd: $2, 3d: $3 

出力は次のようになります。

localhost | SUCCESS => { 
    "changed": true, 
    "failed": false, 
    "rc": 0, 
    "stderr": "", 
    "stdout": "Args are: 1 2 3, 1st: 1 2nd: 2, 3d: 3\n", 
    "stdout_lines": [ 
     "Args are: 1 2 3, 1st: 1 2nd: 2, 3d: 3" 
    ] 
} 
関連する問題