Cross-platform salt formula to set the computer name of a system.
Set the computer name on Windows, or the hostname on Linux.
There are two configuration options:
computername
pattern
The computername
, is read from a salt grain, name-computer:computername
, or
a pillar key, name-computer:lookup:computername
.
The pattern
is read only from pillar, name-computer:lookup:pattern
. The
value is a perl-compatible regular expression (PCRE). The computername
is
tested against the pattern. The default pattern is .*
, which matches any
value.
The logic flow is as follows:
- If the computername grain has a value that matches the pattern, use the grain value.
- Otherwise, if the computername pillar has a value that matches the pattern, use the pillar value.
- If neither of those conditions are met, do nothing.