Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3938329
init.sls
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
init.sls
View Options
# -------------------------------------------------------------
# Salt — Set machine hostname
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2016-06-15
# Description: Set hostname
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
# -------------------------------------------------------------
# Store hostname into a configuration file
# -------------------------------------------------------------
/etc/hostname
:
file.managed
:
-
name
:
/etc/hostname
-
contents
:
{{
salt
[
'node.get'
](
'hostname'
)
}}
# -------------------------------------------------------------
# When the hostname is changed, what to run afterwards?
# -------------------------------------------------------------
after_hostname_change
:
cmd.run
:
-
name
:
hostname `cat /etc/hostname`
-
onchanges
:
-
file
:
/etc/hostname
{%
if
grains
[
'os_family'
]
==
'Debian'
%}
after_hostname_change_debian
:
cmd.run
:
-
name
:
invoke-rc.d hostname.sh start
-
onchanges
:
-
file
:
/etc/hostname
{%
endif
%}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 26, 01:17 (4 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2282850
Default Alt Text
init.sls (1 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment