sharedfile_to_node

This method shares a file with another Rudder node.

⚙️ Compatible targets: Linux

Parameters

NameDocumentation
remote_nodeWhich node to share the file with.

This parameter is required.
file_idUnique name that will be used to identify the file on the receiver.

This parameter must match ^[A-z0-9._-]+$.
This parameter is required.
file_pathPath of the file to share.

This parameter is required.
ttlTime to keep the file on the policy server in seconds or in human readable form (see long description).

This parameter must match `^(\d+\s*(days?

Outcome conditions

You need to replace ${file_id} with its actual canonified value.

  • ✅ Ok: sharedfile_to_node_${file_id}_ok
    • ☑️ Already compliant: sharedfile_to_node_${file_id}_kept
    • 🟨 Repaired: sharedfile_to_node_${file_id}_repaired
  • ❌ Error: sharedfile_to_node_${file_id}_error

Example

method: sharedfile_to_node
params:
  remote_node: VALUE
  file_path: VALUE
  file_id: VALUE
  ttl: VALUE

Documentation

This method shares a file with another Rudder node using a unique file identifier.

Read the Rudder documentation for a high level overview of file sharing between nodes.

The file will be kept on the policy server and transmitted to the destination node's policy server if it is different. It will be kept on this server for the destination node to download as long as it is not replaced by a new file with the same id or remove by expiration of the TTL.

Parameters

This section describes the generic method parameters.

remote_node

The node you want to share this file with. The uuid of a node is visible in the Nodes details (in the Web interface) or by entering rudder agent info on the target node.

file_id

This is a name that will be used to identify the file in the target node. It should be unique and describe the file content.

file_path

The local absolute path of the file to share.

ttl

The TTL can be:

  • A simple integer, in this case it is assumed to be a number of seconds

  • A string including units indications, the possible units are:

  • days, day or d

  • hours, hour, or h

  • minutes, minute, or m

  • seconds, second or s

The ttl value can look like 1day 2hours 3minutes 4seconds or can be abbreviated in the form 1d 2h 3m 4s, or without spaces 1d2h3m4s or any combination like 1day2h 3minute 4seconds Any unit can be skipped, but the decreasing order needs to be respected.

file_id

This is a name that will be used to identify the file once stored on the server. It should be unique and describe the file content.

Example:

We have a node A, with uuid 2bf1afdc-6725-4d3d-96b8-9128d09d353c which wants to share the /srv/db/application.properties with node B with uuid 73570beb-2d4a-43d2-8ffc-f84a6817849c.

We want this file to stay available for one year for node B on its policy server.

The node B wants to download it into /opt/application/etc/application.properties.

They have to agree (i.e. it has to be defined in the policies of both nodes) on the id of the file, that will be used during the exchange, here it will be application.properties.

To share the file, node A will use:

sharedfile_to_node("73570beb-2d4a-43d2-8ffc-f84a6817849c", "application.properties", "/srv/db/application.properties", "356 days")

To download the file, node B will use sharedfile_from_node with:

sharedfile_from_node("2bf1afdc-6725-4d3d-96b8-9128d09d353c", "application.properties", "/opt/application/etc/application.properties")