res_symlink - Clockwork Resource Type for managing symbolic links


A fair portion of Linux system administration involves creating and maintaining configuration files. Sometimes, these files need to be linked elsewhere in the filesystem hierarchy. The res_symlink resource for Clockwork allows administrators to set up (or tear down) such links.



The path (on the local system) that should be the symbolic link


The target file that the link should point to. Defaults to =item /dev/null. Note that this path doesn't have to exist.


Whether or not this link should exist. Valid values are "yes" and "no". The default value is "yes".


Ensuring a symbolic link:

symlink "/home/user/.bashrc" {
    target: "/etc/base/bashrc"

If you want to remove a symbolic link:

symlink "MOTD" {
    path: "/etc/motd"
    present: "no"

(This is similar to using the resource name "/etc/motd" directly).


All parent components of the path will be created if the link should exist and does not. By default, these parent directories will be owned by root:root with mode 0755. However, if the policy defines res_dir(5) resources with paths matching any component of the parent directory chain, the file resource will be set to depend on them.

An example should clear up any confusion:

symlink "/u/apps/foo/config.yml" {
    target: "/etc/foo/config.yml"

dir "/u/apps" {
    owner: "webmaster"
    group: "web"
    mode:  0755

dir "/u/apps/foo" {
    owner: "apache"
    group: "web"
    mode:  0775

If the above policy was enforced on a host without the /u directory, the following would happen (in order):

1. Create /u, per defaults (root:root; 0755)
2. Create /u/apps, per policy (webmaster:web; 0755)
3. Create /u/apps/foo, per policy (apache:web; 0775)


Clockwork was designed and written by James Hunt.

The Clockwork website is licensed under the Creative Commons Attribution-NoDerivs 3.0 United States License