Skip to content

Creating symlinks with Salt States


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.


`/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

-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:

[root@starbuck ~]# salt-call state.sls vim<br /> local:<br /> ----------<br /> State: - file<br /> Name: /root/.vimrc<br /> Function: symlink<br /> Result: True<br /> Comment: Created new symlink /root/.vimrc<br /> Changes: new: /root/.vimrc<br />