Configuration > Resources

directory


Description

This resource manages a directory within the fileystem hierarchy of the client. Its main parameter is path.

Relationship to other resources

The value of the path parameter must be unique among all directory, file and symlink resources.

A directory implicitly depends on any other directory or symlink resources whose path parameters are ancestors to the directory path. For example when the path parameter of this directory is set to /my/very/elaborate/example and there is another directory whose path is /my/very/elaborate, then the former implicitly depends on the latter.

A directory also implicitly depends on user resources whose home parameter matches the directory's path. This is because the tools creating the user already create a home directory. So in most cases the home directory does not need to be managed by a directory resource. But when it is it will be applied after the user resource and operate on the existing home directory.

A directory also forms a relationship with child nodes, that is directory, file and symlink resources who this directory is a parent to. A directory resource needs to keep track of managed child nodes, because if will remove unmanaged child nodes if the purge parameter is set to true.

Parameters

To declare a resource within the [[resources]] array as a directory, set the type meta-parameter to directory.

In addition to the meta-parameters listed in Resources, this table lists all resource-specific parameters:

Name TOML type Description Mandatory Default
ensure string

Determines the desired state of the resource. One of:

  • present, meaning the resource is created and kept up-to-date
  • absent, meaning the resource is deleted and kept absent
yes present
path string Primary parameter. An absolute filesystem path. yes
owner string The name of the user who owns this directory. yes root
group string The name of the group who owns this directory. no
purge boolean

Determines if unknown child nodes, that is directory, file and symlink resources who are not managed by Pullconf, should be removed from the directory.

Note that only direct children will be removed. That means if a directory `A` contains another directory `B`, but Pullconf does not manage `B`, `B` will be recursively deleted if `A` has purge set to true.

However if both `A` and `B` are managed directory resources and `A` has purge set to true, `B` and its contents will remain intact (unless of course, `B` also has purge set to true).

This setting allows you to easily manage the contents of entire directories and purge unwanted files that may have been forgotten, added temporarily for testing purposes, or falsely created in this directory in the first place.

no false

Examples

Minimal

	    
[[resources]]
type = "directory"
path = "/my/elaborate/example"
	    
	  

Full

	    
[[resources]]
type = "directory"
ensure = "present"
path = "/my/elaborate/example"
owner = "myuser"
group = "mygroup"