Creating symlinks with Salt States

By | 12/02/2012

This morning I finally found a solution to improving vim-usage on my FreeBSD machines. For the longest time I’ve dealt with little annoyances like arrow-keys entering ABCD characters, and backspace only working in certain situations. As it turns out, all I needed was to import a proper vimrc file. As soon as I had tested the fix, I expanded my vim Salt State to include a symlink to the included example vimrc.

states/vim/init.sls:
/root/.vimrc:
file.symlink:
- target: /usr/local/share/vim/vim73/vimrc_example.vim

This state breaks down as follows:

/root/.vimrc – File to create
file.symlink – Use the symlink function (others include file.managed, and file.directory)
-target: /usr/local/share/vim/vim73/vimrc_example.vim – Path to original file

Finally I applied the state using the state.sls module, applying only the vim state:

[[email protected] ~]# salt-call state.sls vim
local:
----------
State: - file
Name: /root/.vimrc
Function: symlink
Result: True
Comment: Created new symlink /root/.vimrc
Changes: new: /root/.vimrc

Leave a Reply

Your email address will not be published. Required fields are marked *