States

Synopsis

The dictionary cl_states comprises the states of the managed files. If mounted, the path is unmounted when state is in the list cl_states_unmount (default=absent)

cl_states_unmount: [absent, unmounted]

Then, the module file is applied if state is in the list cl_states_file (default=file)

cl_states_file: [absent, directory, file, hard, link, touch]

In the end, the path is mounted if state is in the list cl_states_mount (default=absent)

cl_states_mount: [present, mounted, remounted]

The variables cl_states_unmount, cl_states_mount, cl_states_file are declared in defaults/main.yml. Details of the parameters are described in the modules mount and file.

Parameters

Parameter

Type

Comments

path

string required

Path to file.

state

string

State of the file.

owner

string

Owner of the file.

group

string

Group of the file.

mode

string

Mode of the file.

<TBD: see tasks/states.yml>

Examples

Lighttpd document root ownership and permissions

[contrib/lighttpd/conf-light/states.d/lighttpd-server-document-root.yml]

1---
2lighttpd_server_document_root:
3  state: directory
4  path: "{{ cl_lighttpd_server_document_root }}"
5  owner: "{{ cl_lighttpd_server_username }}"
6  group: "{{ cl_lighttpd_server_groupname }}"
7  mode: "0750"

Delete snap directories

[contrib/ubuntu-snap-disable/conf-light/states.d/snap.yml]

 1---
 2snap_root:
 3  path: /snap
 4  state: absent
 5snap_var:
 6  path: /var/snap
 7  state: absent
 8snap_lib_var:
 9  path: /var/lib/snapd
10  state: absent

See also