# Driver `task.host`

**Minimal configlet:**

	[task#1]
	type = host

**Minimal setup command:**

	om test/vol/foo set --kw="type=host"

**Supported keywords:**

- blocking_post_provision
- blocking_post_run
- blocking_post_stop
- blocking_post_unprovision
- blocking_pre_provision
- blocking_pre_run
- blocking_pre_stop
- blocking_pre_unprovision
- capability_bounding_set
- check
- command
- comment
- configs_environment
- confirmation
- container
- cwd
- disable
- encap
- environment
- group
- install
- limit_as
- limit_core
- limit_cpu
- limit_data
- limit_fsize
- limit_memlock
- limit_nofile
- limit_nproc
- limit_rss
- limit_stack
- limit_vmem
- log
- max_parallel
- monitor
- net_rules
- no_new_privileges
- on
- on_error
- optional
- pace
- pg_blkio_weight
- pg_cpu_burst
- pg_cpu_quota
- pg_cpu_shares
- pg_cpus
- pg_mem_high
- pg_mem_limit
- pg_mem_oom_control
- pg_mem_swappiness
- pg_mems
- pg_pids_max
- pg_vmem_limit
- post_provision
- post_run
- post_stop
- post_unprovision
- pre_provision
- pre_run
- pre_stop
- pre_unprovision
- provision
- provision_requires
- retcodes
- run_requires
- run_timeout
- schedule
- secrets_environment
- shared
- snooze
- standby
- stat_timeout
- stop
- stop_requires
- stop_timeout
- subset
- systemd_properties
- tags
- timeout
- type
- umask
- unprovision
- unprovision_requires
- user

## Keyword `blocking_post_provision`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute after the resource `provision` action.

Errors interrupt the action.

This trigger is only executed on leaders.


## Keyword `blocking_post_run`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute after the resource `run` action.

Errors interrupt the action.


## Keyword `blocking_post_stop`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute after the resource `stop` action.

Errors interrupt the action.


## Keyword `blocking_post_unprovision`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute after the resource `unprovision` action.

Errors interrupt the action.

This trigger is only executed on leaders.


## Keyword `blocking_pre_provision`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute before the resource `provision` action.

Errors interrupt the action.


## Keyword `blocking_pre_run`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute before the resource `run` action.

Errors interrupt the action.


## Keyword `blocking_pre_stop`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute before the resource `stop` action.

Errors interrupt the action.


## Keyword `blocking_pre_unprovision`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute before the resource `unprovision` action.

Errors interrupt the action.


## Keyword `capability_bounding_set`

	required:    false
	scopable:    true
	group:       process
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	capability_bounding_set=CAP_NET_BIND_SERVICE CAP_CHOWN

**Description:**

The capabilities the commands of the resource keep in their bounding set,
all others dropped: a process can never gain a capability out of its
bounding set, by a setuid root program or file capabilities included, and
a command run as root only has the capabilities listed. Prefixed with `~`,
the list is of the capabilities dropped, all others kept, as the
`CapabilityBoundingSet` of systemd.

The names are the Linux ones, as `CAP_NET_BIND_SERVICE`, in any case. An
unknown name is refused by the validation. The capabilities dropped are
removed from the inheritable set too. Applied by om exec before the
demotion to the user, which still works, and inherited by the children of
the command. Not set, the commands keep the bounding set of the daemon.

Refused on an operating system other than Linux, rather than ignored.


## Keyword `check`

	required:    false
	scopable:    true
	group:       status
	candidates:  last_run, last_run_warn, 
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	check=last_run

**Description:**

If set to `last_run`, the last run retcode is used to report a task resource
status.

If set to `last_run_warn`, the last run error retcode is displayed as a
resource warning.

If not set (default), the status of a task is always n/a.


## Keyword `command`

	required:    false
	scopable:    true
	group:       process
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Description:**

The shlex expression of the command to execute on `run` actions.


## Keyword `comment`

	required:    false
	scopable:    false
	group:       identity

**Description:**

A free form text describing the role of the object, of the node, or of the
section it is set in.

The keyword is accepted in any section, so the DEFAULT section can document a
configuration as a whole, and a resource, pool, heartbeat, array or network
section can document itself.

The agent does not interpret the value.


## Keyword `configs_environment`

	required:    false
	scopable:    true
	group:       environment
	deprecated:  since v3.0.0-rc57, replaced by environment
	convert:     shlex
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	configs_environment=PORT=http/port webapp/app1* {name}/* {name}-debug/settings

**Description:**

A whitespace-separated list of `<var>=<cfg name>/<key path>` or
`<cfg name>/<key matcher>`.

If the `cfg` or config key doesn't exist then `start` and `stop` actions on
the resource will fail with a non 0 exit code.

A shell expression splitter is applied, so double quotes can be around
`<cfg name>/<key path>` only or whole `<var>=<cfg name>/<key path>`.

Example with,

* `<ns>/cfg/nginx` a config having a `user` key with value `user1`.

* `<ns>/cfg/cfg1` a config having a `key1` key with value `val1`.

`configs_environment = NGINX_USER=nginx/user cfg1/*` creates the following
variables in the process execution environment:

	NGINX_USER=user1
	key1=val1



## Keyword `confirmation`

	required:    false
	scopable:    false
	group:       run
	convert:     bool
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Description:**

If set to `true`, ask for an interactive confirmation to run the task.

This flag can be used for dangerous tasks like data restoration.


## Keyword `container`

	required:    false
	scopable:    true
	group:       process
	references:  container rid
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	container=container#1

**Description:**

The container resource the command runs in, by the runtime of the container,
rather than on the node. e.g. `container#1`.

The command is the `command` keyword, run with the `environment`,
`configs_environment` and `secrets_environment` of the task, within its
`timeout`. The `cwd`, `user`, `group`, `umask` and limits of the task apply to
a command run on the node only.

A container not up is not run in, and the run does nothing: what the command
acts on runs in the container, and does it when it starts.

Such a task with `on = FileInstalled,rid=<rid>` has a container read again
the files a volume or fs `install` wrote, e.g. `swanctl --load-all`.


## Keyword `cwd`

	required:    false
	scopable:    true
	group:       process
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Description:**

Change the working directory to the specified location instead of the default
`<pathtmp>`.


## Keyword `disable`

	required:    false
	scopable:    true
	group:       availability
	convert:     bool

**Description:**

A disabled resource will be ignored on `start`, `stop`, `provision` and
`unprovision` actions.

A disabled resource status is `n/a`.

If set in the `DEFAULT` section of an object, the object is disabled and
ignores `start`, `stop`, `shutdown`, `provision` and `unprovision` actions.

These actions do nothing, and exit 7, a code telling the action was not
done because the instance is disabled, which the daemon takes as the end of
a stop and of an unprovision: a disabled object is purged. An `unprovision`
of a disabled instance whose resources are provisioned fails: the object
would be deleted with its storage left on the node. Enable it to
unprovision it.

`om <path> disable` sets `DEFAULT.disable=true`.

`om <path> enable` sets `DEFAULT.disable=false`.

> **Note**: The `enable` and `disable` actions preserve the individual
  resource `disable` state.


## Keyword `encap`

	required:    false
	scopable:    false
	group:       encap
	convert:     bool

**Description:**

Set to `true` to ignore this resource in the nodes context and consider it in the encapnodes context. The resource is thus handled by agents deployed in the service containers.


## Keyword `environment`

	required:    false
	scopable:    true
	group:       environment
	convert:     shlex
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	environment=SLIP=slob OC3_DB_PASSWORD from ./sec/oc3 key db_password source random

**Description:**

A whitespace-separated list of variables: `<var>=<value>`, or
`<var> from <path> key <key> [source <uri>]` to read the value from the key of
a sec or a cfg.

A shell expression splitter is applied, so double quotes can be around
`<value>` only or whole `<var>=<value>`.

The path of a datastore is the one of an install line: `./sec/oc3` is the sec
named oc3 in the namespace of the object, `other/cfg/oc3` a cfg of another
namespace, which has to allow it. A variable read from a sec is a secret.

A `*` in `<var>` stands for the key, and a key pattern names a variable per key
matching: `* from ./sec/oc3 key db_*` sets a variable named after each key
starting with db_, and `OC3_* from ./cfg/oc3 key *` one per key, prefixed with
OC3_.

`source <uri>` seeds the key when the datastore does not hold it, so a template
creates the secrets it reads:

* `source random` generates a password, once, at the provision of the object on
  its leader node, the datastore created in the namespace of the object if
  needed. The other nodes wait for it to reach them. A start, a task run or a
  provision not finding it fails, naming the key and the datastore: no node
  makes one of its own. An object whose resources have nothing to provision,
  as apps alone, is never provisioned, and its first start fails on the key
  missing: give it a `fs.flag` resource, which the provision provisions.
* an `http://` or `https://` uri is fetched, as the `node.allowed_urls` and SSRF
  policies allow, at each provision and start of a node not finding the key.
* any other uri is the path of a regular file of the node, read as the url is,
  which requires the root grant. `/dev/urandom` is such a path, and refused as
  no regular file: `source random` is the generator.

A key the datastore holds is never written again, whatever the source, and an
unprovision leaves it. A key two keywords of the object seed from two sources,
and a key of a datastore of another namespace, are refused by the validation of
the configuration.

A reference ends after its key, or after its source: a bare `source` variable
right after a reference is read as its source, so write it `source=` or before
the reference.

Example:

	environment = SLIP=slob
	    OC3_DB_PASSWORD from ./sec/oc3 key db_password source random
	    OC3_FOO from ./cfg/oc3 key bar

A datastore or a key not existing is logged, and the variable not set, but a
key generated, `source random`, which is an error.


## Keyword `group`

	required:    false
	scopable:    true
	group:       process
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Description:**

If the binary is owned by the `root` user, run it as the specified group
instead of `root`.


## Keyword `install`

	required:    false
	scopable:    true
	group:       install
	references:  fs|volume rids
	convert:     list
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	install=fs#1

**Description:**

The volumes and filesystems whose files the task installs again before its
own work, as the `install` action does for them: `fs#1 volume#data`. A host
task installing files needs no `command`.

The files rendered from a template are rendered from what the node knows at
the time, and the install publishes a `FileInstalled` event for the ones it
wrote. With `on`, the files follow what the events say changed, and the
tasks on `FileInstalled` have what reads them read them again:

    [task#refresh]
    type = host
    install = fs#1
    on = NetworkPeersUpdated

    [task#load_all]
    type = host
    container = container#swanctl
    command = swanctl --load-all
    on = FileInstalled,rid=fs#1

    [fs#1]
    install = /swanctl.conf from ./cfg/{name} key swanctl.conf template

The install takes the lock of the object, as the install action does. It
writes only in the volumes and filesystems of the object, from the install
lines they declare, so a task of any type may ask for it.

A failed install is a failed run, the task's own work not done.


## Keyword `limit_as`

	required:    false
	scopable:    true
	group:       limits
	convert:     size
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Description:**

The limit on the total virtual memory that can be in use by a process (unit bytes)
(same as limit_vmem).

When both `limit_vmem` and `limit_as` is used, the max value is chosen.


## Keyword `limit_core`

	required:    false
	scopable:    true
	group:       limits
	convert:     size
	rbac:        The core dump and locked memory limits of a container require the root grant.

**Description:**

The limit on the largest core dump size that can be produced (unit byte).


## Keyword `limit_cpu`

	required:    false
	scopable:    true
	group:       limits
	convert:     duration
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	limit_cpu=30s

**Description:**

The limit on CPU time (duration).


## Keyword `limit_data`

	required:    false
	scopable:    true
	group:       limits
	convert:     size
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Description:**

The limit on the data segment size of a process (unit byte).


## Keyword `limit_fsize`

	required:    false
	scopable:    true
	group:       limits
	convert:     size
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Description:**

The limit on the largest file that can be created (unit byte).


## Keyword `limit_memlock`

	required:    false
	scopable:    true
	group:       limits
	convert:     size
	rbac:        The core dump and locked memory limits of a container require the root grant.

**Description:**

The limit on how much memory a process can lock with mlock(2) (unit byte, no solaris support).


## Keyword `limit_nofile`

	required:    false
	scopable:    true
	group:       limits
	convert:     size
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Description:**

The limit on the number files a process can have open at once.


## Keyword `limit_nproc`

	required:    false
	scopable:    true
	group:       limits
	convert:     size
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Description:**

The limit on the number of processes this user can have at one time, no solaris support.


## Keyword `limit_rss`

	required:    false
	scopable:    true
	group:       limits
	convert:     size
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Description:**

The limit on the total physical memory that can be in use by a process
(unit byte, no solaris support).


## Keyword `limit_stack`

	required:    false
	scopable:    true
	group:       limits
	convert:     size
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Description:**

The limit on the stack size of a process (unit bytes).


## Keyword `limit_vmem`

	required:    false
	scopable:    true
	group:       limits
	convert:     size
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Description:**

The limit on the total virtual memory that can be in use by a process (unit bytes).


## Keyword `log`

	required:    false
	scopable:    true
	group:       run
	default:     false
	convert:     bool
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Description:**

Log the task outputs in the object logs, and log its scheduled runs as a
run asked by a user is.

The daemon scheduler logs the runs of the jobs it starts only when they ask
it, so a scheduled run of a task with `log = false` leaves no trace in the
journal but its status and its exit code.


## Keyword `max_parallel`

	required:    false
	scopable:    true
	group:       run
	default:     1
	convert:     int
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	max_parallel=2

**Description:**

Support limited, concurrent runs of tasks.

The task#xx.max_parallel=2 setting limits the number of concurrent task runs to 2.

The default value is 1, ensuring backward compatibility.

The run count is determined based on PID files created in the `<resource var>/run/` directories.

The PID file is normally removed when the task execution ends, but if the executor dies abruptly (e.g., due to a SIGKILL), the stale PID file is not considered when computing the resource status. It is removed before the count check of the next run.

Staleness is evaluated using the condition: (PID file mtime < process birth time).

A new status log message may appear to indicate that the maximum concurrency limit has been reached.


## Keyword `monitor`

	required:    false
	scopable:    true
	group:       monitoring
	convert:     bool

**Description:**

A resource with `monitor=true` will trigger the `monitor_action`
(crash or reboot the node, freezestop or switch the service) if:

* The resource is `down`.

* The instance has `local_expect=started` in its daemon monitor data, which
  means the daemon considers this instance is and should remain started.

* All restart tentatives failed.


## Keyword `net_rules`

	required:    false
	scopable:    true
	group:       process
	rbac:        A rule naming an object of another namespace than the one of the object, or another namespace, requires the guest, operator or admin grant on that namespace, or the root grant, a rule reading its addresses from a datastore of another namespace than the one of the object requires the datastore to share its keys with the namespace of the object, by its share keyword, and a rule reading its addresses from a datastore named by a reference that does not evaluate requires the root grant.

**Example:**

	net_rules=allow namespace . allow dns deny cluster deny network lan allow any

**Description:**

The rules saying what the resource may exchange network packets with, and
what it may not, in both directions. One rule per line: `allow` or `deny`,
a noun, then what qualifies the noun:

    net_rules =
        allow node n2
        deny network backend node n3
        allow network backend
        allow object ./svc/db
        allow object ./svc/{name}-db rid ip#1
        allow namespace .
        deny address 192.168.10.5
        allow address 192.168.10.0/24
        allow address fd00:10::5
        allow address from ./cfg/acl key allowed
        allow object ./svc/db port 5432 proto tcp

The rules are an ordered list, and the first one matching a packet decides
of it, from the top: a packet from or to an address an `allow` rule names
passes, one from or to an address a `deny` rule names is dropped, and the
rules after the one that matched are not read. So an exception is written
before the rule it is carved out of: `deny network backend node n3` before
`allow network backend` allows the network but the part of the node n3, and
written after it would decide of nothing.

Every list ends with three rules nobody writes, in this order:

    allow localhost
    allow dns
    deny any

What no rule matches is denied: a list says what is let through, and a list
with no `allow` rule lets through the loopback addresses and the nameservers
alone, which the validation warns of. A last `allow any` turns it around:
the list then says what is denied, and the rest passes.

`localhost` and `dns` are allowed without a rule saying so: a filter written
for the peers of an application is not meant to cut it from its own node,
nor from the names it resolves. They come last, just before the `deny any`,
so a written rule matching them wins: `deny localhost` or `deny dns` takes
them away, and so does a `deny` of what holds them, as `deny cluster` where
the nameservers are the ones of `cluster.dns`, addresses of the cluster
nodes, unless `allow dns` is written before it. The node itself is reached
over the loopback addresses only: its other addresses, as the one its om
listener is on, need a `node` or `cluster` rule. The om socket, a file, is
not filtered. `deny any` alone cuts the resource from the network, its own
node included.

No rule, the keyword unset or empty, is no filter at all.

A service with an address on the `lan` network, reaching the objects of its
namespace, the nameservers and the world, and nothing else of the cluster,
its nodes and its networks:

    net_rules =
        allow namespace .
        allow dns
        deny cluster
        deny network lan
        allow any

The nouns:

* `localhost`: the loopback addresses, `127.0.0.0/8` and `::1`.
* `dns`: the nameservers what the resource runs resolves through, see
  below.
* `any`: every address.
* `address <address or range>`: an ipv4 or ipv6 address, or a range.
* `address from <datastore> key <key>`: the addresses and ranges a key of a
  cfg or a sec holds, one per line, as `./cfg/acl` or `./sec/acl`, of the
  namespace of this object or of a datastore another namespace shares with
  it, see below.
* `network <name>`: the range of a cluster network. Followed by `node
  <nodename>`, the part of it that node hands out.
* `node <nodename>`: a cluster node, the address of its listener and the
  ones its name resolves to.
* `cluster`: every cluster node.
* `object <path>`: the addresses the resources of an object publish in
  their status, as its ip resources, the instances of all the nodes
  together. `./svc/db` is the object of the namespace of this one,
  `prod/svc/db` one of another namespace, and `{name}` and `{namespace}`
  are expanded. Followed by `rid <resource id>`, the addresses of that
  resource alone.
* `namespace <name>`: the addresses of every object of a namespace, `.`
  being the one of this object.

Any rule may end with `port <port> proto tcp|udp`, or `port <first>-<last>
proto tcp|udp`, on a kvm container, see below: it then names that port of
what it names, and no other.

A value written on one line holds several rules, as a command sets it: a
verb starts a rule where the one before it is complete, so `allow network
backend allow node n2` is two rules, and `allow network backend node n2`
one, the part of the network the node hands out. A rule has one verb and
one noun: `allow node n1 node n2` is refused, the verb being written again
for each.

    om <path> config update --set 'container#1.net_rules=allow namespace . deny cluster allow any'

A rule added with `net_rules+=` is added after the others, so after a last
`allow any`, where it decides of nothing: the validation warns of it. The
order being what the rules mean, a list is changed by writing its value
again, whole, or by editing the configuration.

The validation warns of a rule that can never match, a rule before it
matching all it names whatever the cluster holds: any rule after an `allow
any` or a `deny any`, a `node` after `cluster`, an `object` after its
`namespace`, a network narrowed to a node after the network, an address
after a range holding it, a rule written twice. It judges the rules as
written, and resolves nothing: two rules resolving to the same addresses on
this cluster are not warned of. These are warnings: the configuration is
committed, and the filter is the one of the rules as written.

`dns`, written or allowed without a rule, is the nameservers of the
resolver of what is filtered, and no other:

* An app, and a task running a command on the node: the nameservers the
  `/etc/resolv.conf` of the node names. Where it names a local stub, as the
  `127.0.0.53` of systemd-resolved, the command talks to the stub alone,
  and the servers the stub forwards to, the ones of `cluster.dns` among
  them, are not opened.
* A docker or podman container, and a task running one: the nameservers om
  writes in the `/etc/resolv.conf` of the container, which are the ones of
  the `dns` keyword of the networks its addresses are on, else the ones of
  `cluster.dns`, then the ones its `dns` keyword adds, the first three, as
  many as a resolver reads. A container om writes no resolver for, no
  nameserver being named, keeps the one of its engine: the nameservers the
  `/etc/resolv.conf` of the node names are allowed.
* A lxc container: the nameservers the `/etc/resolv.conf` of the node
  names, om writing no resolver for it. A container resolving through
  others, as the ones its own `/etc/resolv.conf` names, needs a rule naming
  them.
* A kvm container: the nameservers of the `dns` keyword of the networks its
  `network` keyword names, which om tells the guest. A guest told none
  resolves through what it is configured with, which om does not know: no
  nameserver is allowed without a rule naming it.

The nameservers of a docker, podman or kvm container are the ones it was
told at its start, which it keeps while it runs: the `dns` keyword of its
networks changed since, its status warns, the filter allows the ones of the
start until the resource restarts, and a rule `allow address <nameserver>`
allows a new one meanwhile, applied with no restart.

A nameserver allowed is reached on every port. The nameservers of
`cluster.dns` are addresses of the cluster nodes, so a container resolving
through them reaches whatever these nodes serve. Naming
in the `dns` keyword of a network an address dedicated to the dns on that
network opens that address alone to the containers of the network. An
address that is also one of a node, where services are bound to every
address, still reaches them.

A rule naming a network, a node, an object, a resource or a namespace the
cluster does not have, or an object not started yet, resolves to nothing,
and matches nothing until what it names exists: an `allow` rule lets
nothing more through, and a `deny` rule denies nothing, leaving the packets
to the rules after it. The validation of the
configuration warns of what does not exist, naming the object as resolved,
`./svc/db` being `test/svc/db` in the `test` namespace. It says nothing of
the objects of another namespace: the logs of the start do.

The rules are resolved when the resource starts: the networks and the nodes
from the configuration of the node, the objects from the daemon. With the
daemon down, the resource starts all the same, its `object` and `namespace`
rules resolving to nothing, with a warning, until the daemon is back.

The daemon then keeps the filter of the running resource current. When an
object named starts, stops, moves or changes address, when an object joins
or leaves a namespace named, when a node joins or a network changes, it
resolves the rules again and sets the filter, which applies at once to what
the resource runs, without a restart. An address every instance of an
object publishes, as a failover address, is the same wherever the object
runs: its failover changes nothing. A daemon starting sets the filters
again.

The filter fails closed, on the side letting less through when the daemon
does not know:

* An address of an `allow` rule is taken away when the status of its
  object no longer publishes it, or the object is deleted. An address drawn from a network
  is released when its resource stops, where an address the configuration
  names is published started or not. It is kept while that status is not
  known, the daemon of a node of the object being down or restarting, which
  stops nothing of what the object runs.
  The delete of the object takes it away at once, a node of the object
  being down or not: a node back without the object says nothing of it.
* An address of a `deny` rule stays denied when its object stops
  publishing it, as what answers there may still be the object, until the
  object is deleted.
* Either is forgotten as soon as another object publishes the address.

An address kept is kept by the rule that resolved to it, at the place of
that rule in the list and on its ports: an object named by an `allow` rule
and by a `deny` rule has its addresses followed by each, and one a `deny`
rule keeps is still denied before the rules written after it.

A change of the rules themselves, of `net_rules`, their order included, is
applied by the daemon to the resource as it runs, on the node running it, within
seconds and without a restart: the one change of the configuration it
applies with no action asked, a filter being a security setting. Rules
tightened, loosened or removed are set as the configuration is written, and
a daemon starting applies the ones changed while it was down. Rules the
validation refuses change nothing: the filter in force is kept, and the
status of the resource warns until they are fixed.

Rules given to a resource running with none are set under it when what it
runs is in a systemd unit of its slice: a container, and an app started
with `systemd_properties`. The start command of an app started with neither
rules nor `systemd_properties` runs in no unit, where nothing is filtered:
the rules apply at its next start, and its status warns until then. So do
the rules given to a container its start would have been refused with, as
one whose engine places it with the cgroupfs driver, and to a lxc container
started by an agent that made no scope of it, before its upgrade. A run of a task in
progress is given the rules as a running app or container is.

The status of the resource shows the filter in force: what each rule
resolves to, in the order of the rules, the implicit ones included, up to
the rule matching every address, which ends the list. The addresses of the
rules naming another namespace are counted there, not listed.

The key of an `address from <datastore> key <key>` rule holds one address
or range per line, ipv4 or ipv6. An empty line, and a line starting with
`#`, is skipped. A line that is neither is left out, the others applying,
and warned of by the validation and by the start, by its number, and by its
text for a cfg. The datastore is one of the namespace of the object, `./`
or the namespace spelled out, or one of another namespace sharing its keys
with it, as `infra/cfg/acl` with `share = <namespace>` or `share = *`, the
keys a resource installs being read the same way: the `share` keyword is
the consent of who administers the datastore, and no grant on its namespace
is asked of who writes the rule. A rule naming a datastore of another
namespace that does not share its keys is an error of the validation, for
root too, and resolves to nothing, in an `allow` rule and in a `deny` rule
alike.
A datastore or a key that does not exist resolves to nothing too, with a
warning, until it does.

The key is read when the resource starts, on its node, and the daemon keeps
the filter current: a key added, changed or removed, as by `om <datastore>
key change`, changes the configuration of the datastore, and the daemon of
the node resolves the rules reading it again when it has it, and sets the
filter under the running resource, with no restart. A line removed is an
address taken away at once. The `share` keyword is read with the key, each
time: a datastore that stops sharing its keys with the namespace of the
object has its addresses taken out of the running filters, the daemon
warning of it, as if its key was removed.

The key of a sec is read by om, as root on the node, as the keys a resource
installs are. Its addresses are in the filter, and not in the status of the
resource, which counts them as it counts the ones of the rules naming
another namespace: who reads the status of a resource does not read the
keys of a sec. The addresses of a cfg are shown, its keys being read by who
reads its namespace, and the ones of a cfg of another namespace too, its
`share` keyword having given them to the namespace of the object. The logs
of the daemon, root's, show the whole filter.

The filter of an app, a task and a docker, podman or lxc container knows
no port: a rule with a `port` qualifier is refused there, by the validation
and at the start, and only a kvm container takes it.

A port is the one of what the rule names, not one of the guest: `allow
object ./svc/db port 5432 proto tcp` lets the guest talk to the port 5432 of
the addresses of the object, from any port of its own, and `deny any port
25 proto tcp`, written first, keeps it from every smtp server, the ones the
rules after it open whole included. The filter follows no
connection: a packet sent to the address passes by its destination port,
and one received from it by its source port. A guest serving a port to
clients is opened to them by a rule with no port. The other protocols of an
address opened on a port only, as the icmp of a ping, do not pass. The
first rule matching decides there too: a rule on a port matches the packets
of that port alone, and leaves the others to the rules after it.

The filter of an app, a task and a docker, podman or lxc container is the
`IPAddressAllow` and `IPAddressDeny` of the systemd slice of the process
group of the resource, enforced by the kernel on its cgroup, whatever
network namespace its processes are in. systemd knows no order, an allowed
range winning over a denied one: it is given the two lists letting through
exactly what the ordered rules do, each `allow` rule less what the `deny`
rules before it name, so `systemctl show` tells ranges carved around the
exceptions, where the status of the resource tells the rules in their
order. A list may be thousands of ranges, as a wide range allowed after
tens of ipv6 addresses denied one by one inside it, each carving it in up
to 128 ranges: a last `allow any` carves nothing, the addresses denied
before it being the denied list as they are. A filter systemd does not
take, as when it can not be reached, is an error: the start fails, and a
running resource keeps the filter in force, the daemon logging the error.
It needs systemd, the
unified cgroup hierarchy and a kernel attaching BPF programs to the cgroups:
the resource refuses to start where one is missing, rather than run
unfiltered, and so does a rootless container, whose group is delegated to
the systemd instance of a user. The `IPAddressAllow` and `IPAddressDeny` of
`systemd_properties` are still taken, and a packet passes when both let it.

What is filtered:

* An app, and a task running a command on the node: the start command, or
  the run command, run in a transient systemd service unit of the slice, as
  with `systemd_properties`. The check, info, stop, quiesce and resume
  commands run outside the unit, and are not filtered.
* A docker or podman container, and a task running one: the container, which
  the engine places in a scope of the slice with its systemd cgroup driver.
  With the cgroupfs driver the container is in no unit, and the resource
  refuses to start. A `--restart` option in `run_args` is refused too: om
  passes none and restarts the containers itself, the filter set first,
  where the engine would restart one unfiltered, at boot or when it exits.
  So is a `--cgroup-parent` or a `--cgroups` option in `run_args`, read
  after the placement of om: the engine would place the container out of
  the slice, unfiltered, which nothing verifies of a container run in the
  foreground, as the one of a task.
* A lxc container: the container and its monitor, which om starts in a
  transient systemd scope of the slice, `<slice>-lxc.scope`, lxc making its
  groups under the one of the scope. Every lxc container is started so, with
  rules or not, on a node running systemd on the unified cgroup hierarchy,
  so rules given later apply at once. The commands `lxc-attach` runs in the
  container join its group, and are filtered. A lxc taking no
  `lxc.cgroup.dir`, 2.1 or older, places the container out of the scope:
  with rules, the resource refuses to start.
* A kvm container: what the guest sends and what is sent to it, through
  the interfaces om makes for the networks of its `network` keyword. The
  filter is a nftables table of the `netdev` family by interface, named
  `osvc_netwarden_<interface>`: a pair of sets by rule, holding the
  addresses it resolves to, and two chains reading them in the order of the
  rules, a line by rule. It is loaded before the interface is plugged, and
  after the rules of `network_filter`, which keep the guest to its own
  addresses. Under the running guest, the addresses moving replace the
  elements of the sets, and a change of the list of rules replaces the
  table, each in one transaction. It needs `nft` and
  a kernel filtering what an interface sends to a guest, Linux 5.16 or
  later: the guest refuses to start where one is missing, and so does a
  guest with rules and no `network`, whose interfaces libvirt makes, as the
  ones of `bridge` or of a `virtinst` command. With rules, a guest
  exchanges arp, ipv4 and ipv6 frames only. What an interface needs to hold
  its address passes whatever the rules: arp, the ipv6 neighbour discovery,
  the dhcp exchange of the guest, and the icmp errors sent to it.

What is not:

* A command run by `om <path> exec` or entering a container, which is the
  operator's.
* A published port of a docker container served by its userland proxy: the
  packets reach the container from the gateway of its bridge, not from the
  client, so the filter sees the gateway. Allowing the gateway allows every
  client of the port.
* A vbox container, whose traffic the cgroup of its processes does not
  carry, and a kvm container with no `network`.
* What no socket of the processes filtered sends or receives. The filter of
  a cgroup judges the packets of the sockets of its processes, in whatever
  network namespace: what the kernel answers by itself in the network
  namespace of a container, as the reply to a ping, passes, and so does
  what that namespace forwards.
* A container whose root may configure its network. The filter keeps an
  application to its peers: it is no confinement of the root of a lxc
  container, or of a docker or podman container given `NET_ADMIN` or run
  privileged, who administers the network namespace the packets leave
  through, and is not to be relied on against it. A container to hold
  against its own root is run without that capability, in a user namespace,
  or as a kvm guest, whose filter is on the interfaces of the node.


## Keyword `no_new_privileges`

	required:    false
	scopable:    true
	group:       process
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	no_new_privileges=true

**Description:**

Set the no_new_privs flag of the commands of the resource: neither the
process nor its children can gain privileges by executing a setuid or
setgid program, or a program with file capabilities. Applied by om exec
after the user and the limits, just before the command is executed. The
flag can not be lowered by the process.

Refused on an operating system other than Linux, rather than ignored.


## Keyword `on`

	required:    false
	scopable:    true
	group:       scheduling
	convert:     list
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	on=NetworkPeersUpdated,name=backend1

**Description:**

The events of the node running the task, each one an event kind and the values
of the fields of the event it requires, as in `om node events --filter`:
`NetworkPeersUpdated` runs it when the peers of any network of the node
changed, `NetworkPeersUpdated,name=backend1` when the ones of backend1 did.

The kinds are:

* `FileInstalled`: an install of a resource of the object wrote files, or
  removed the files of keys gone, by a start, a provision, a task or a change
  of a key. It is not published for an install finding its files up to date.
  Its fields are `node`, `path` and `rid`, the resource, and the events of the
  other objects are not the task's.

* `NetworkPeersUpdated`: a node joined or left a network, the address of a
  node changed, or the tunnel to it. Its fields are `node` and `name`, the
  network.

The runs are paced by `pace`, and require what the scheduled runs
require: the instance provisioned, and `run_requires`. They run whether the
instance is frozen or not, as the scheduled runs do.

A task installing again the files rendered from the networks with
`install` has them follow the networks:

    [task#refresh]
    type = host
    install = fs#1
    on = NetworkPeersUpdated


## Keyword `on_error`

	required:    false
	scopable:    true
	group:       run
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	on_error=/srv/{name}/data/scripts/task_on_error.sh

**Description:**

A command to execute on `run` action if `command` returned an error.


## Keyword `optional`

	required:    false
	scopable:    true
	group:       availability
	convert:     bool

**Description:**

Action errors on optional resources are logged but do not interrupt the action sequence.

The status of optional resources is not included in the instance availability status but is considered in the overall status.

The status of task and sync resources is always included in the overall status, regardless of whether they are marked as optional.

Resources tagged as `noaction` are considered optional by default.

Dump filesystems are a typical use case for optional=true.


## Keyword `pace`

	required:    false
	scopable:    true
	group:       scheduling
	default:     @10s
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	pace=@30s backoff @1m

**Description:**

The pace of the runs the `on` events ask for, `@<interval>[ backoff @<max>]`,
written as the interval of a schedule.

The task runs at the first event, then once at most each interval: the events
coming during an interval run it once at its end.

With `backoff`, each interval ending with such a run doubles the next one, up
to `<max>`, and each interval passing without an event halves it back, down to
`<interval>`: `@30s backoff @1m` runs at most each 30s, and at most each minute
while the events keep coming faster.


## Keyword `pg_blkio_weight`

	required:    false
	scopable:    true
	group:       pg

**Example:**

	pg_blkio_weight=50

**Description:**

Block IO relative weight. Value: between `10` and `1000`.

The kernel default is `100`.

Setting this keyword to `default` puts the capping back where a node that
never capped anything leaves it. Removing the keyword does not: what was
written stays written, whether om wrote it or something else did.


## Keyword `pg_cpu_burst`

	required:    false
	scopable:    true
	group:       pg

**Example:**

	pg_cpu_burst=20%

**Description:**

The cpu time the group banks under its quota, and spends above it.

It is the time the processes of the group may bank while under their
`pg_cpu_quota`, and spend above it in a short spike, in the notation of
`pg_cpu_quota`: `20%` lets the group run a fifth of a cpu above its quota
during a period, out of what it left unused before.

It serves a latency-sensitive service capped tightly: a request arriving
after an idle spell is served at the speed of the burst, rather than
throttled for the rest of the period. Over a longer time the group still
uses no more than its quota.

It needs `pg_cpu_quota`, and cannot exceed it: the kernel refuses a burst
larger than the quota. Only the unified cgroup hierarchy has it.

Setting this keyword to `default` puts the capping back where a node that
never capped anything leaves it. Removing the keyword does not: what was
written stays written, whether om wrote it or something else did.


## Keyword `pg_cpu_quota`

	required:    false
	scopable:    true
	group:       pg

**Example:**

	pg_cpu_quota=50%@all

**Description:**

The percentage of cpu time the processes of the group may use.

Accepted expressions:

* `50%`
  Half of one cpu.

* `50%@all`
  Half of every cpu the node has.

* `10%@2`
  A tenth of two cpus.

Unlike `pg_cpu_shares`, which only arbitrates when the node is cpu-bound, a
quota caps the group whether or not the node is busy.

Setting this keyword to `default` puts the capping back where a node that
never capped anything leaves it. Removing the keyword does not: what was
written stays written, whether om wrote it or something else did.


## Keyword `pg_cpu_shares`

	required:    false
	scopable:    true
	group:       pg
	convert:     size

**Example:**

	pg_cpu_shares=512

**Description:**

The share of cpu the group gets when the node is cpu-bound.

The share is relative to the other groups.

The actual percentile depends on the shares allowed to the other services.
Unset, the kernel default is used, which usually is 1024 shares.

Setting this keyword to `default` puts the capping back where a node that
never capped anything leaves it. Removing the keyword does not: what was
written stays written, whether om wrote it or something else did.


## Keyword `pg_cpus`

	required:    false
	scopable:    true
	group:       pg
	depends:     create_pg=true

**Example:**

	pg_cpus=0-2

**Description:**

The cpus the processes of the group may run on.

Cpus are specified as list or range : `0,1,2` or `0-2`.

Setting this keyword to `default` puts the capping back where a node that
never capped anything leaves it. Removing the keyword does not: what was
written stays written, whether om wrote it or something else did.


## Keyword `pg_mem_high`

	required:    false
	scopable:    true
	group:       pg
	convert:     size

**Example:**

	pg_mem_high=384m

**Description:**

The memory past which the kernel throttles the group, in bytes.

Past it, the kernel slows the processes of the group down, reclaiming their
memory and throttling their allocations.

Unlike `pg_mem_limit`, reaching it does not wake the Out-Of-Memory killer: a
group above it keeps running, slower, while the kernel reclaims. Set below
`pg_mem_limit`, it gives a process growing too much the time to be noticed,
or to shrink, before it is killed.

It is a soft limit, so it is not what a memory claim counts: the claim counts
`pg_mem_limit`. Only the unified cgroup hierarchy has it.

Setting this keyword to `default` puts the capping back where a node that
never capped anything leaves it. Removing the keyword does not: what was
written stays written, whether om wrote it or something else did.


## Keyword `pg_mem_limit`

	required:    false
	scopable:    true
	group:       pg
	convert:     size

**Example:**

	pg_mem_limit=512m

**Description:**

The memory the processes of the group may use, in bytes.

The Out-Of-Memory killer is triggered in case of tresspassing.

Setting this keyword to `default` puts the capping back where a node that
never capped anything leaves it. Removing the keyword does not: what was
written stays written, whether om wrote it or something else did.

On a node holding the v1 cgroup hierarchy, `default` lifts the memory+swap
limit too: a group with no memory limit cannot keep one below it.


## Keyword `pg_mem_oom_control`

	required:    false
	scopable:    true
	group:       pg

**Example:**

	pg_mem_oom_control=1

**Description:**

Whether the Out of Memory killer runs for the group: 0 enables it.

It is a flag (0 or 1) enabling or disabling the Out of Memory killer for the
processes of the group.

* If enabled (0), tasks that attempt to consume more memory than they are
  allowed are immediately killed by the OOM killer.
* If disabled (1), tasks are allowed to continue to try allocating memory,
  stressing the system.

The OOM killer is enabled by default in every cgroup using the memory
controller.

This keyword caps nothing on a node holding the unified cgroup hierarchy,
which has no `memory.oom_control`: that file is of the v1 hierarchy. Setting
it there is warned about, and ignored.


## Keyword `pg_mem_swappiness`

	required:    false
	scopable:    true
	group:       pg

**Example:**

	pg_mem_swappiness=40

**Description:**

Set a swappiness percentile value for the process group.

This keyword caps nothing on a node holding the unified cgroup hierarchy,
which has no `memory.swappiness`: that file is of the v1 hierarchy. Setting
it there is warned about, and ignored.


## Keyword `pg_mems`

	required:    false
	scopable:    true
	group:       pg

**Example:**

	pg_mems=0-2

**Description:**

The memory nodes the processes of the group may allocate from.

Memory nodes are specified as list or range : `0,1,2` or `0-2`.

Setting this keyword to `default` puts the capping back where a node that
never capped anything leaves it. Removing the keyword does not: what was
written stays written, whether om wrote it or something else did.


## Keyword `pg_pids_max`

	required:    false
	scopable:    true
	group:       pg

**Example:**

	pg_pids_max=512

**Description:**

The most processes and threads the group may run at once.

A fork beyond it fails in the process that asked for it, and nothing else
of the node is touched: it is what keeps a runaway fork loop from exhausting
the process table of the node.

Setting this keyword to `default` puts the capping back where a node that
never capped anything leaves it. Removing the keyword does not: what was
written stays written, whether om wrote it or something else did.


## Keyword `pg_vmem_limit`

	required:    false
	scopable:    true
	group:       pg
	convert:     size

**Example:**

	pg_vmem_limit=1g

**Description:**

The memory plus swap the processes of the group may use, in bytes.

The Out-Of-Memory killer is triggered in case of tresspassing.
The specified value must be greater than `pg_mem_limit`.

Setting this keyword to `default` puts the capping back where a node that
never capped anything leaves it. Removing the keyword does not: what was
written stays written, whether om wrote it or something else did.


## Keyword `post_provision`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute after the resource `provision` action.

Errors do not interrupt the action.

This trigger is only executed on leaders.


## Keyword `post_run`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute after the resource `run` action.

Errors do not interrupt the action.


## Keyword `post_stop`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute after the resource `stop` action.

Errors do not interrupt the action.


## Keyword `post_unprovision`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute after the resource `unprovision` action.

Errors do not interrupt the action.

This trigger is only executed on leaders.


## Keyword `pre_provision`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute before the resource `provision` action.

Errors do not interrupt the action.


## Keyword `pre_run`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute before the resource `run` action.

Errors do not interrupt the action.


## Keyword `pre_stop`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute before the resource `stop` action.

Errors do not interrupt the action.


## Keyword `pre_unprovision`

	required:    false
	scopable:    true
	group:       triggers
	rbac:        Triggers require the root grant.

**Description:**

A command or script to execute before the resource `unprovision` action.

Errors do not interrupt the action.


## Keyword `provision`

	required:    false
	scopable:    false
	group:       provisioning
	default:     true
	convert:     bool

**Description:**

Set to `false` to ignore the `provision` and `unprovision` actions on the
resource.

> **Warning**: `provision` and `unprovision` use data-destructive operations
  like formatting.

It is recommended to set `provision=false` on long-lived critical objects,
to force administrators to remove this setting when they really want to
destroy data.


## Keyword `provision_requires`

	required:    false
	scopable:    false
	group:       requirements
	references:  requires

**Example:**

	provision_requires=ip#0 fs#0(down,stdby down)

**Description:**

A whitespace-separated list of conditions to meet to accept a 'provision'
action.

A condition is expressed as `<rid>(<state>,...)`.

If states are omitted, `up,stdby up` is used as the default expected states.


## Keyword `retcodes`

	required:    false
	scopable:    true
	group:       status
	default:     0:up 1:down
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	retcodes=0:up 1:down 3:warn 4: n/a 5:undef

**Description:**

The whitespace-separated list of `<retcode>:<status name>`.

All undefined retcodes are mapped to the `warn` status.

Valid `<status names>` are:

* `up`
* `down`
* `warn`
* `n/a`
* `undef`


## Keyword `run_requires`

	required:    false
	scopable:    false
	group:       requirements
	references:  requires

**Example:**

	run_requires=ip#0 fs#0(down,stdby down)

**Description:**

A whitespace-separated list of conditions to meet to accept a 'run'
action.

A condition is expressed as `<rid>(<state>,...)`.

If states are omitted, `up,stdby up` is used as the default expected states.


## Keyword `run_timeout`

	required:    false
	scopable:    true
	group:       timeouts
	convert:     duration
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	run_timeout=1m30s

**Description:**

Wait for `<duration>` before declaring the action a failure.

Takes precedence over `timeout`.


## Keyword `schedule`

	required:    false
	scopable:    true
	group:       scheduling
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	schedule=00:00-01:00 mon

**Description:**

Set the task `run` schedule.

See `usr/share/doc/opensvc/schedule` for the schedule syntax reference.


## Keyword `secrets_environment`

	required:    false
	scopable:    true
	group:       environment
	deprecated:  since v3.0.0-rc57, replaced by environment
	convert:     shlex
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	secrets_environment=CRT=cert1/server.pem sec1/*

**Description:**

A whitespace-separated list of `<var>=<sec name>/<key path>` or
`<sec name>/<key matcher>`.

If the `sec` or secret key doesn't exist then `start` and `stop` actions on
the resource will fail with a non 0 exit code.

A shell expression splitter is applied, so double quotes can be around
`<sec name>/<key path>` only or whole `<var>=<sec name>/<key path>`.

Example with,

* `<ns>/sec/cert1` a secret having a `server.pem` key with value `mycrt`.

* `<ns>/sec/sec1` a secret having a `key1` key with value `val1`.

`secrets_environment = CRT=cert1/server.pem sec1/*` creates the following
variables in the process execution environment:

	CRT=mycrt
	key1=val1



## Keyword `shared`

	required:    false
	scopable:    true
	group:       provisioning
	convert:     bool

**Description:**

If `true`, the resource will be considered shared during provision and
unprovision actions.

A shared resource driver can implement a different behaviour depending
on weither it is run from the leader instance, or not:

* When `--leader` is set, the driver creates and configures the system
  objects. For example the disk.disk driver allocates a SAN disk and
  discover its block devices.

* When `--leader` is not set, the driver does not redo the actions
  already done by the leader, but may do some. For example, the
  disk.disk driver skips the SAN disk allocation, but discovers the
  block devices.

The daemon takes care of setting the `--leader` flags on the commands
it submits during deploy, purge, provision and unprovision
orchestrations.

> **Warning**: If admins want to submit `--local` provision or unprovision
  commands themselves, they have to set the `--leader` flag correctly.

Flex objects usually don't use shared resources. But if they do, only
the flex primary gets `--leader` commands.

> **Warning**: All resources depending on a shared resource must also be
  flagged as shared.


## Keyword `snooze`

	required:    false
	scopable:    true
	group:       run
	convert:     duration
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	snooze=10m

**Description:**

Snooze the service before running the task, so if the command is cause a
status degradation the user can decide to snooze alarms for the duration
set as value.


## Keyword `standby`

	required:    false
	scopable:    true
	group:       availability
	convert:     bool

**Description:**

If `true`, always start the resource, even on non-started instances.

The daemon is responsible for starting standby resources.

A resource can be set standby on a subset of nodes using keyword scoping.

A typical use-case is a synchronized filesystem on non-shared disks. The
remote filesystem must be mounted to not overflow the underlying filesystem.

> **Warning**: In most situation, don't set shared resources standby, a
  non-clustered fs on shared disks for example.


## Keyword `stat_timeout`

	required:    false
	scopable:    true
	group:       timeouts
	convert:     duration

**Description:**

The fs resources status evaluation includes a stat syscall test.
This keyword defines the maximum wait time for those stat calls to respond.

When expired, the resource status is degraded is to warn, which can trigger
a monitor action (reboot or crash the node) if the resource is monitored.


## Keyword `stop`

	required:    false
	scopable:    true
	group:       process
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	stop=/usr/bin/rm -f /tmp/{fqdn}.{rindex}

**Description:**

The shlex expression of the command to execute to stop a running task.

Without it, the task is stopped by killing the processes its `command` started.


## Keyword `stop_requires`

	required:    false
	scopable:    false
	group:       requirements
	references:  requires

**Example:**

	stop_requires=ip#0 fs#0(down,stdby down)

**Description:**

A whitespace-separated list of conditions to meet to accept a 'stop'
action.

A condition is expressed as `<rid>(<state>,...)`.

If states are omitted, `up,stdby up` is used as the default expected states.


## Keyword `stop_timeout`

	required:    false
	scopable:    true
	group:       timeouts
	convert:     duration
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	stop_timeout=180

**Description:**

Wait for `<duration>` before declaring the app launcher `stop` action a
failure.

Takes precedence over `timeout`.

If neither `timeout` nor `stop_timeout` is set, the agent waits indefinitely
for the app launcher to return.

A timeout can be coupled with `optional=true` to not abort a service instance
stop when an app launcher did not return.


## Keyword `subset`

	required:    false
	scopable:    true
	group:       selection

**Description:**

The name of the subset this resource is assigned to.

Resources of a same driver group and a same subset are ordered and acted upon
together, and are configured as a whole in a `[subset#<group>:<name>]` section,
or in a less precise `[subset#<name>]` one.

That section accepts `parallel`, to act on the members concurrently rather than
one after the other, and the `pg_*` keywords, to place the members in their own
process group.


## Keyword `systemd_properties`

	required:    false
	scopable:    true
	group:       process
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	systemd_properties=ProtectSystem=strict ReadWritePaths=/srv/app/data PrivateTmp=yes ProtectHome=yes

**Description:**

The properties of the transient systemd service unit the start command, or
the run command of a task, is run in, as `systemd-run -p` takes them: the
sandbox of the command, as `ProtectSystem=strict ReadWritePaths=/srv/data
PrivateTmp=yes`. A word starting with a property name and `=` starts a
property, and the words after it, up to the next property, are its value,
so a list of paths needs no quotes. Quote a value with blanks a property
does not split. Not set, the command runs in no unit.

The unit is named after the process group of the resource, as
`opensvc-ns.prod-svc.web-app.main.service`, and placed in it: the
`pg_*` cappings apply to it. Its command is om exec, which sets the user,
the group, the umask, the limits, `capability_bounding_set` and
`no_new_privileges` as without a unit, inside the sandbox. The environment
is given to the unit in a file only root reads, not as properties every
user sees. The check, info, stop, quiesce and resume commands run in the
namespaces of the unit while it runs, so they see the files the command
sees, as its private `/tmp`.

The unit is ordered before the om daemon, and never stopped by a stop
job: the stop of the resource ends its processes, and the unit with them,
so a reboot stops the resource with the object, in order, before systemd
stops what is left. A property systemd does not know fails the start,
never running the command unsandboxed. So does a node not running systemd.

The properties om sets itself are refused: the type, the command, the
identity, the environment, the slice, the dependencies and ordering, the
restarts, the timeouts, the limits, `KillMode`, `NoNewPrivileges` and
`CapabilityBoundingSet`, whose keywords om exec applies.

To share properties between resources, set them in a key of the `env`
section and reference it, as `systemd_properties = {env.sandbox}
ReadWritePaths=/srv/data`.


## Keyword `tags`

	required:    false
	scopable:    true
	group:       selection
	convert:     set

**Description:**

A whitespace-separated list of tags.

Tags can be used for resource selection by tag.

Some tags can influence the driver behaviour:

* `noaction`

  Skip any state changing action on the resource and imply `optional=true`.

* `nostatus`

  Force the status `n/a`.


## Keyword `timeout`

	required:    false
	scopable:    true
	group:       timeouts
	convert:     duration
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	timeout=5m

**Description:**

Wait for `<duration>` before declaring the task `run` action a failure.

If no timeout is set, the agent waits indefinitely for the task command to exit.


## Keyword `type`

	required:    false
	scopable:    false
	group:       identity
	rbac:        Requires the root grant, except for the values oci, docker, podman, acme.

**Description:**

The resource driver name.


## Keyword `umask`

	required:    false
	scopable:    true
	group:       process
	convert:     umask
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Example:**

	umask=022

**Description:**

The umask to set for the application process.


## Keyword `unprovision`

	required:    false
	scopable:    false
	group:       provisioning
	default:     true
	convert:     bool

**Description:**

Set to `false` to ignore the `unprovision` action on the resource.

> **Warning**: `unprovision` use data-destructive operations like
  formatting.

It is recommended to set `provision=false` on long-lived critical objects,
to force administrators to remove this setting when they really want to
destroy data.


## Keyword `unprovision_requires`

	required:    false
	scopable:    false
	group:       requirements
	references:  requires

**Example:**

	unprovision_requires=ip#0 fs#0(down,stdby down)

**Description:**

A whitespace-separated list of conditions to meet to accept a 'unprovision'
action.

A condition is expressed as `<rid>(<state>,...)`.

If states are omitted, `up,stdby up` is used as the default expected states.


## Keyword `user`

	required:    false
	scopable:    true
	group:       process
	rbac:        A keyword of the host driver, which needs the root grant to choose.

**Description:**

If the binary is owned by the `root` user, run it as the specified user
instead of `root`.


