• Blog
  • Ansible community forum
  • Documentation
Ansible Logo
Ansible Core Documentation
Ansible Core

Ansible getting started

  • Getting started with Ansible

Installation, Upgrade & Configuration

  • Installation Guide
  • Ansible Core Porting Guides

Using Ansible Core

  • Building Ansible inventories
  • Using Ansible command line tools
  • Using Ansible playbooks
  • Protecting sensitive data with Ansible vault
  • Using Ansible modules and plugins
  • Using Ansible collections
  • Using Ansible on Windows, BSD, and z/OS UNIX
  • Ansible tips and tricks

Contributing to Ansible Core

  • Ansible Community Guide
  • ansible-core Contributors Guide
  • Advanced Contributor Guide
  • Ansible documentation style guide

Extending Ansible

  • Developer Guide

Ansible Galaxy

  • Galaxy User Guide
  • Galaxy Developer Guide

Reference & Appendices

  • Collection Index
    • Collections in the Ansible Namespace
      • Ansible.Builtin
        • Description
        • Communication
        • Plugin Index
  • Indexes of all modules and plugins
  • Playbook Keywords
  • Return Values
  • Ansible Configuration Settings
  • Controlling how Ansible behaves: precedence rules
  • YAML Syntax
  • Python 3 Support
  • Interpreter Discovery
  • Releases and maintenance
  • Testing Strategies
  • Sanity Tests
  • Frequently Asked Questions
  • Glossary
  • Ansible Reference: Module Utilities
  • Special Variables
  • Red Hat Ansible Automation Platform
  • Ansible Automation Hub
  • Logging Ansible output

Roadmaps

  • ansible-core Roadmaps




Ansible Core
  • Collection Index
  • Collections in the Ansible Namespace
  • Ansible.Builtin
  • ansible.builtin.exists test – does the path exist, follow symlinks
  • Edit on GitHub

ansible.builtin.exists test – does the path exist, follow symlinks

Note

This test plugin is part of ansible-core and included in all Ansible installations. In most cases, you can use the short plugin name exists. However, we recommend you use the Fully Qualified Collection Name (FQCN) ansible.builtin.exists for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same test plugin name.

  • Synopsis

  • Input

  • Examples

  • Return Value

Synopsis

  • Check if the provided path maps to an existing filesystem object on the controller (localhost).

  • Follows symlinks and checks the target of the symlink instead of the link itself, use the ansible.builtin.link or ansible.builtin.link_exists tests to check on the link.

Input

This describes the input of the test, the value before is ansible.builtin.exists or is not ansible.builtin.exists.

Parameter

Comments

Input

path

a path

Examples

vars:
  my_etc_hosts_exists: "{{ '/etc/hosts' is exists }}"
  list_of_local_files_to_copy_to_remote: "{{ list_of_all_possible_files | select('exists') }}"

Return Value

Key

Description

Return value

boolean

Returns True if the path corresponds to an existing filesystem object on the controller (after following symlinks), False if otherwise.

Returned: success

Authors

  • Ansible Core

Collection links

  • Issue Tracker
  • Repository (Sources)
  • Communication
Previous Next

© Copyright Ansible project contributors. Last updated on Oct 02, 2025.