ansible 剧本中特定情况下管道运算符的含义
Meaning of pipe operator in a specific case in an ansible playbook
在 ansible 剧本的下面块中,|
pipe 运算符后跟 bool
的含义是什么?
我分别理解它们的意思,但在这里对我来说似乎没有任何意义。为什么需要将 bool
解释为多行值?
The pipe symbol at the end of a line in YAML signifies that any indented text that follows should be interpreted as a multi-line scalar value. See the YAML spec.
- name: Remove default nginx vhost config file (if configured).
file:
path: "{{ nginx_default_vhost_path }}"
state: absent
when: nginx_remove_default_vhost | bool
notify: restart nginx
它只是强制类型为 bool。
这里是关于它的文档https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#forcing-the-data-type
在 ansible 剧本的下面块中,|
pipe 运算符后跟 bool
的含义是什么?
我分别理解它们的意思,但在这里对我来说似乎没有任何意义。为什么需要将 bool
解释为多行值?
The pipe symbol at the end of a line in YAML signifies that any indented text that follows should be interpreted as a multi-line scalar value. See the YAML spec.
- name: Remove default nginx vhost config file (if configured).
file:
path: "{{ nginx_default_vhost_path }}"
state: absent
when: nginx_remove_default_vhost | bool
notify: restart nginx
它只是强制类型为 bool。
这里是关于它的文档https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#forcing-the-data-type