Page MenuHomeDevCentral

init.sls
No OneTemporary

init.sls

# -------------------------------------------------------------
# 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

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)

Event Timeline