Skip to content

Instantly share code, notes, and snippets.

@mooperd
Created March 12, 2015 13:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mooperd/0bebed50eb1404b03d76 to your computer and use it in GitHub Desktop.
{%- set fqdn = grains['id'] %}
{%- if grains['os_family'] == 'RedHat' %}
etc-sysconfig-network:
cmd.run:
- name: echo -e "NETWORKING=yes\nHOSTNAME={{ fqdn }}\n" > /etc/sysconfig/network
- unless: test -f /etc/sysconfig/network
file.replace:
- name: /etc/sysconfig/network
- pattern: HOSTNAME=localhost.localdomain
- repl: HOSTNAME={{ fqdn }}
/etc/hostname:
file.managed:
- contents: {{ fqdn }}
- backup: false
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment