如何指定在某些行上具有前導空格的多行字符串?帶前導空格的多行字符串
如果我定義一個變量爲
multiline_str: |
foo
bar
baz
然後將其寫入使用
- name: write multiline string
copy: content="{{ multiline_str }}" dest="/path/to/file"
則目標文件內容的文件是
foo
bar
baz
什麼訣竅這裏?
如何指定在某些行上具有前導空格的多行字符串?帶前導空格的多行字符串
如果我定義一個變量爲
multiline_str: |
foo
bar
baz
然後將其寫入使用
- name: write multiline string
copy: content="{{ multiline_str }}" dest="/path/to/file"
則目標文件內容的文件是
foo
bar
baz
什麼訣竅這裏?
試試這個。
- name: write multiline string
copy:
content: "{{ multiline_str }}"
dest: /path/to/file
與local_action
相同的問題。
這工作:
- name: write multiline string
local_action:
module: copy
content: "{{ multiline_str }}"
dest: /path/to/file
您可以使用\ n(換行符)和\ S(空格)\ T(標籤)
這是相關的? http://stackoverflow.com/questions/715818/ruby-write-escaped-string-to-yaml –
@HighlyIrregular我不這麼認爲 – zerkms