Created
April 14, 2017 21:34
-
-
Save leonkatz/3ba86a15886074d8742270952f28ea4d to your computer and use it in GitHub Desktop.
hostname_gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set minion_id = grains['id'] %} | |
{% set host, domain = minion_id.split('.',1) %} | |
{% set this_ipv4 = salt['network.ipaddrs']()[0] %} | |
common.formula.hostname "Update my name {{ minion_id }}": | |
network.system: | |
- enabled: True | |
- hostname: {{ host }} | |
- apply_hostname: True | |
common.formula.hostname "/etc/hosts": | |
host.present: | |
- ip: {{ this_ipv4 }} | |
- names: | |
- {{ minion_id }} | |
- {{ host }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment