Documentation
Rash version v1.2
Rash version v2.9
Rash version v2.8
Rash version v2.7
Rash version v2.6
Rash version v2.5
Rash version v2.4
Rash version v2.3
Rash version v2.2
Rash version v2.1
Rash version v2.0
Rash version v1.10
Rash version v1.9
Rash version v1.8
Rash version v1.7
Rash version v1.6
Rash version v1.5
Rash version v1.4
Rash version v1.3
Rash version v1.2
Rash version v1.1
Rash version v1.0
Rash version master
PLEASE NOTE: This document applies to v1.2 version and not to the latest stable release v2.9
Documentation for other releases can be found by using the version selector in the left bottom of any doc page.Tasks
tasks
are the main execution unit. They need a module and admit some optional fields described below.
- name: this must be ignored
assert:
that:
- "rash.path == ''"
ignore_errors: true
- command: ls examples
register: ls_result
- name: "save password to multiple files"
copy:
content: "{{ env.MY_PASSWORD }}"
dest: "/tmp/MY_PASSWORD_FILE_{{ item }}"
mode: "400"
loop: "{{ ls_result.output | split(pat='\n') }}"
when: env | get(key="MY_PASSWORD")
register: save_passwords_result
Fields
Tasks admit the following keys:
pub struct Task {
/// Module could be any [`Module`] accessible by its name.
///
/// [`Module`]: ../modules/struct.Module.html
module: Module,
/// Params are module execution params passed to [`Module::exec`].
///
/// [`Module::exec`]: ../modules/struct.Module.html#method.exec
params: Yaml,
/// Task name.
name: Option<String>,
/// Template expression passed directly without {{ }}; if false skip task execution.
when: Option<String>,
/// Variable name to store [`ModuleResult`].
///
/// [`ModuleResult`]: ../modules/struct.ModuleResult.html
register: Option<String>,
/// Template expression passed directly without {{ }}; if true errors are ignored.
ignore_errors: Option<bool>,
/// `loop` field receives a Template (with {{ }}) or a list to iterate over it.
r#loop: Option<Yaml>,
}
Register structure
Use the Register field to define the name of the variable in which you wish to save the module result. Its value will conform to the following structure:
pub struct ModuleResult {
/// True when the executed module changed something.
changed: bool,
/// The Output value will appear in logs when module is executed.
output: Option<String>,
/// Modules store the data they return in the Extra field.
extra: Option<Value>,
}
For example:
- command: ls examples
register: ls_result
- command: echo "{{ ls_result.output }}"