Zul*_*kis 26 deployment ansible
我尝试mosh_version
使用 ansibledebug msg
命令打印先前注册的变量,如下所示:
- name: Print mosh version
debug: msg="Mosh Version: {{ mosh_version.stdout }}"
Run Code Online (Sandbox Code Playgroud)
它不起作用并打印以下错误:
Note: The error may actually appear before this position: line 55, column 27
- name: Print mosh version
debug: msg="Mosh Version: {{ mosh_version.stdout }}"
^
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
Should be written as:
with_items:
- "{{ foo }}"
Run Code Online (Sandbox Code Playgroud)
我试过
- name: Print mosh version
debug: msg=Mosh Version: "{{ mosh_version.stdout }}"
Run Code Online (Sandbox Code Playgroud)
但这只会打印“Mosh”。
让它运行的最佳方法是什么?
Tom*_*Aac 39
尝试这个:
- name: Print mosh version
debug: "msg=Mosh Version: '{{ mosh_version.stdout }}'"
Run Code Online (Sandbox Code Playgroud)
更多信息在http://docs.ansible.com/YAMLSyntax.html#gotchas
编辑:这样的东西对我来说很完美:
- name: Check Ansible version
command: ansible --version
register: ansibleVersion
- name: Print version
debug:
msg: "Ansible Version: {{ ansibleVersion.stdout }}"
Run Code Online (Sandbox Code Playgroud)
http://pastie.org/private/cgeqjucn3l5kxhkkyhtpta
归档时间: |
|
查看次数: |
156414 次 |
最近记录: |