link-exists

Example:

# Make sure a symbolic link to a file/folder exists.
- link-exists:
    src: /tmp/source
    dest: /tmp/dest

Description

Ensure a filesystem link from to a file/folder exists.

If the owner and/or group variables is/are specified, those will be created if they don't exist yet.

Variables

Name Type Default Description

dest

string --

The path to the target of the link. Required

src

string --

The path to the file to link to. Required

group

string --

The group of the link, will be created if necessary.

hard

boolean False

Whether to create a hard link instead of a symlink.

mode

string --

The permissions of the link.

owner

string --

The owner of the link, will be created if necessary.

parent_dir_mode

string --

The permissions of the parent directory.

Examples

Example 1

Make sure a symbolic link to a file/folder exists.

Code
- link-exists:
    src: /tmp/source
    dest: /tmp/dest

Example 2

Make sure a hard link to a file/folder exists.

Code
- link-exists:
    src: /tmp/source
    dest: /tmp/dest
    hard: true

Command-line

frecklecute link-exists --help

Usage: frecklecute link-exists [OPTIONS]

  Ensure a filesystem link from to a file/folder exists.

  If the ``owner`` and/or ``group`` variables is/are specified, those will
  be created if they don't exist yet.

Options:
  --dest DEST             The path to the target of the link.  [required]
  --src SRC               The path to the file to link to.  [required]
  --group GROUP_NAME      The group of the link, will be created if necessary.
  --hard / --no-hard      Whether to create a hard link instead of a symlink.
  --mode MODE             The permissions of the link.
  --owner USER_NAME       The owner of the link, will be created if necessary.
  --parent-dir-mode MODE  The permissions of the parent directory.
  --help                  Show this message and exit.