GithubHelp home page GithubHelp logo

spuxy / ansible-stow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from caian-org/ansible-stow

0.0 0.0 0.0 344 KB

an ansible module that interacts with gnu stow packages

License: Creative Commons Zero v1.0 Universal

Shell 12.65% Python 87.35%

ansible-stow's Introduction

Tests GitHub tag

ansible-stow

An Ansible module that interacts with GNU Stow packages.

Table of Contents

Compatibility

This ansible module is tested against ansible 2.10.7 | 3.4.0 | 4.10.0 | 5.4.0 and python >= 3.6, < 4.0. Note that for ansible >= 4.10.0, python >= 3.8 is required. For development (linting and other code verification) python >= 3.7.2 is required.

For python < 3 (legacy systems that still uses 2.x), use the v0.1.3 of this module.

Dependencies

To use ansible-stow, the managed node should have stow installed.

GNU Stow is widely available in all major distributions and can be installed with apt-get, pacman, yum etc.

Installation

Download the module and move it into your global Ansible library or into the library directory alongside your top-level playbook. E.g.:

$ wget https://raw.githubusercontent.com/caian-org/ansible-stow/v1.1.1/stow
$ (sudo) mv stow /usr/share/ansible

Usage

Options

Parameter Required Choices / Defaults Comments
package yes Name of the Stow package
target no Default: user's home directory Path of target directory to perform
dir yes Path of the Stow directory
state yes Choices:
  • absent
  • latest
  • present
  • supress
  • absent: unstow / delete the package. Equivalent to stow --delete.
  • latest: first unstow a package, then stow again. Equivalent to stow --restow.
  • present: stow a package. Equivalent to stow --stow.
  • supress: stow a package and overwrite the file if any conflict is found. THIS CAN LEAD TO DATA LOSS! Use wisely.

Examples

# stow package "zsh" of directory "/media/user/dots" to the home directory
- stow:
    state: present
    package: zsh
    dir: /media/user/dots
    target: '$HOME'

# remove package "tmux"
- stow:
    state: absent
    package: tmux
    dir: /media/user/dots

# in case of conflict, overwrite the file with a symlink
- stow:
    state: supress
    package: vim
    dir: /media/user/dots

# loop through list of packages
- stow:
    state: latest
    package: '{{ item }}'
    dir: /media/user/dots
  with_items:
    - zsh
    - tmux
    - i3

Caveats

  • If the package target already exists on the node filesystem as a file or a symbolic link, the supress state will delete/unlink the target and then stow the package.
  • If the package target already exists and is a directory, ansible-stow will fail -- even using the supress state. This is an implementation decision.
  • Stow cannot handle the tilde expansion (~). Use the $HOME environment variable instead or Ansible's template function lookup.

Acknowledgements

Original implementation by Ric da Silva.

License

To the extent possible under law, Caian Ertl has waived all copyright and related or neighboring rights to this work. In the spirit of freedom of information, I encourage you to fork, modify, change, share, or do whatever you like with this project! ^C ^V

License

ansible-stow's People

Contributors

upsetbit avatar dependabot[bot] avatar lgtm-migrator avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.