https://github.com/plus3it/name-computer-formula
Salt formula to set the computer name of a system
https://github.com/plus3it/name-computer-formula
Last synced: 5 months ago
JSON representation
Salt formula to set the computer name of a system
- Host: GitHub
- URL: https://github.com/plus3it/name-computer-formula
- Owner: plus3it
- License: apache-2.0
- Created: 2016-05-02T20:13:23.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2025-01-06T16:06:13.000Z (over 1 year ago)
- Last Synced: 2025-01-21T23:17:46.363Z (over 1 year ago)
- Language: Jinja
- Size: 79.1 KB
- Stars: 0
- Watchers: 5
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](./LICENSE)
[](https://travis-ci.org/plus3it/name-computer-formula)
[](https://ci.appveyor.com/project/plus3it/name-computer-formula)
# name-computer-formula
Cross-platform salt formula to set the computer name of a system.
## Available States
### name-computer
Set the computer name on Windows, or the hostname on Linux.
## Configuration
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:
1. If the computername grain has a value that matches the pattern, use the
grain value.
2. Otherwise, if the computername pillar has a value that matches the pattern,
use the pillar value.
3. If neither of those conditions are met, do nothing.