2016-08-09 4 views
1
name: the file 
    raw: cat "{{item}}" 
    with_items: "{{groups['firewall']}}" 
    when: inventory_hostname == item 
    register: output3 

debug: var=output3.results 

name: Copy File to Local Machine 
    local_action: lineinfile dest=/Users/{{inventory_hostname}} line="{{item}}" 
    with_dict: "{{ output3 }}" 

output3.stdout_linesを広告申込情報にするにはどうすればよいですか?現在の方法では、私が望んでいないものすべてをコピーしています。stdout_linesを使用してファイル内の行に変数を渡すこと

答えて

0

は、この方法を試してください。

- name: Copy File to Local Machine 
    local_action: lineinfile dest=/Users/{{inventory_hostname}} line="{{item.1}}" 
    with_subelements: 
     - "{{output3.results}}" 
     - stdout_lines 
     - flags: 
      skip_missing: yes 

私は、これは、Pythonのサポートなしでいくつかのハードウェア・ボックスであると仮定しますか?
それ以外の場合は、ファイルをフェッチするより洗練された方法があります。

+0

ありがとうございました。 – ehuck

関連する問題