Ansible: Store command's stdout in new variable?

前端 未结 6 629
暗喜
暗喜 2020-12-22 22:35

Inside my playbook I\'d like to create a variable holding the output of an external command. Afterwards I want to make use of that variable in a couple of templates.

6条回答
  •  有刺的猬
    2020-12-22 23:12

    You have to store the content as a fact:

    - set_fact:
        string_to_echo: "{{ command_output.stdout }}"
    

提交回复
热议问题