ansible.builtin.exists 测试 – 路径是否存在,遵循符号链接
注意
此测试插件是 ansible-core 的一部分,包含在所有 Ansible 安装中。在大多数情况下,您可以使用简短的插件名称 exists。但是,我们建议您使用 完全限定的集合名称 (FQCN) ansible.builtin.exists,以便轻松链接到插件文档并避免与可能具有相同测试插件名称的其他集合冲突。
概要
- 检查提供的路径是否映射到控制器(localhost)上的现有文件系统对象。 
- 遵循符号链接并检查符号链接的目标而不是链接本身,使用 ansible.builtin.link 或 ansible.builtin.link_exists 测试来检查链接。 
输入
这描述了测试的输入,is ansible.builtin.exists 或 is not ansible.builtin.exists 之前的数值。
| 参数 | 注释 | 
|---|---|
| 路径 | 
示例
vars:
  my_etc_hosts_exists: "{{ '/etc/hosts' is exists }}"
  list_of_local_files_to_copy_to_remote: "{{ list_of_all_possible_files | select('exists') }}"
返回值
| 键 | 描述 | 
|---|---|
| 如果路径对应于控制器上存在的(遵循符号链接后的)文件系统对象,则返回  返回:成功 | 
