Skip to content

guillaumeaubert/ansible-symlink-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Symlink plugin for Ansible

Build Status

Synopsis

This Ansible plugin allows creating symlinks while optionally backing up the destination if it already exists and it isn't a symlink. This is particularly useful to replace default configuration files, when you don't want to just overwrite the default without a way to check it again in the future.

Installation

Go to your ansible's plugins directory and run the following commands:

git clone git@github.com:guillaumeaubert/ansible-symlink-plugin.git symlink

If you don't have a plugins directory, you can edit ansible.cfg to define defaults.library.

Options

Parameter Required Default Choices Comments
src yes Path of the file or directory to symlink to.
dest yes Remote absolute path where the symlink should be created.
archive no True
  • True
  • False
This flag indicates whether a backup of the destination should be made, if the destination exists and is not a symlink.
archive_suffix no _original If the destination needs to be archived, the file or directory will be renamed using this suffix.

Examples

# Archive /etc/apache2 to /etc/apache2.original if it exists and isn't already
# a symlink, then create a symlink /etc/apache2 pointing to /gitrepo/apache2.
- symlink:
    src="/gitrepo/apache2"
    dest="/etc/apache2"
    archive=True
    archive_suffix=.original

# Same as the above, with implicit defaults.
- symlink:
    src="/gitrepo/apache2"
    dest="/etc/apache2"

# Delete the destination if it exists (without making a backup), and create the
# symlink.
- symlink:
    src="/gitrepo/apache2"
    dest="/etc/apache2"
    archive=False

Copyright

Copyright (C) 2014-2016 Guillaume Aubert

License

This software is released under the MIT license. See the LICENSE file for details.

About

An ansible plugin to create symlinks and archive the destination if it already exists.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages