pub struct Template {
pub change_mode: ChangeMode,
pub change_signal: Option<String>,
pub dest_path: String,
pub embedded_tmpl: Option<String>,
pub envvars: bool,
pub left_delim: String,
pub right_delim: String,
pub perms: String,
pub source_path: Option<String>,
pub splay: Duration,
}Expand description
The Template block instantiates an instance of a template renderer. This creates a convenient way to ship configuration files that are populated from environment variables, Consul data, Vault secrets, or just general configurations within a Nomad task. Nomad utilizes a tool called Consul Template. Since Nomad v0.5.3, the template can reference Nomad’s runtime environment variables. For a full list of the API template functions, please refer to the Consul Template README.
Fields§
§change_mode: ChangeModeSpecifies the behavior Nomad should take if the rendered template changes.
The default value is ChangeMode::Restart
See also ChangeMode
change_signal: Option<String>Specifies the signal to send to the task as a string like “SIGUSR1” or “SIGINT”. This option is required if the change_mode is signal. Defaults to empty.
dest_path: StringSpecifies the location where the resulting template should be rendered, relative to the task directory.
embedded_tmpl: Option<String>Specifies the raw template to execute. One of source_path or embedded_tmpl must be specified, but not both. This is useful for smaller templates, but we recommend using SourcePath for larger templates.
envvars: boolSpecifies whether the template should be read back as environment variables for the task.
left_delim: StringSpecifies the left delimiter to use in the template. The default is “{{” for some templates, it may be easier to use a different delimiter that does not conflict with the output file itself.
right_delim: StringSpecifies the right delimiter to use in the template. The default is “}}” for some templates, it may be easier to use a different delimiter that does not conflict with the output file itself.
perms: StringSpecifies the rendered template’s permissions. File permissions are given as octal of the Unix file permissions rwxrwxrwx. Defaults to 644.
source_path: Option<String>Specifies the path to the template to be rendered. source_path is mutually exclusive with EmbeddedTmpl attribute. The source can be fetched using an Artifact resource. The template must exist on the machine prior to starting the task; it is not possible to reference a template inside of a Docker container, for example.
splay: DurationSpecifies a random amount of time to wait between 0 ms and the given splay value before invoking the change mode. Defaults to 5 seconds.
Trait Implementations§
Source§impl Default for Template
impl Default for Template
Source§fn default() -> Self
fn default() -> Self
Return Template { change_mode: Default::default(), change_signal: Some("".to_string()), dest_path: Default::default(), embedded_tmpl: Default::default(), envvars: Default::default(), left_delim: ("{{").into(), right_delim: ("}}").into(), perms: ("644").into(), source_path: Default::default(), splay: Duration :: from_secs(5) }
Source§impl<'de> Deserialize<'de> for Template
impl<'de> Deserialize<'de> for Template
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Template
impl StructuralPartialEq for Template
Auto Trait Implementations§
impl Freeze for Template
impl RefUnwindSafe for Template
impl Send for Template
impl Sync for Template
impl Unpin for Template
impl UnwindSafe for Template
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.