{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt-bootstrap/issues/661","labels_url":"https://api.github.com/repos/saltstack/salt-bootstrap/issues/661/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt-bootstrap/issues/661/comments","events_url":"https://api.github.com/repos/saltstack/salt-bootstrap/issues/661/events","html_url":"https://github.com/saltstack/salt-bootstrap/issues/661","id":108694645,"number":661,"title":"Hostname based on minion id","user":{"login":"Cramix","id":8523951,"avatar_url":"https://avatars.githubusercontent.com/u/8523951?v=3","gravatar_id":"","url":"https://api.github.com/users/Cramix","html_url":"https://github.com/Cramix","followers_url":"https://api.github.com/users/Cramix/followers","following_url":"https://api.github.com/users/Cramix/following{/other_user}","gists_url":"https://api.github.com/users/Cramix/gists{/gist_id}","starred_url":"https://api.github.com/users/Cramix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cramix/subscriptions","organizations_url":"https://api.github.com/users/Cramix/orgs","repos_url":"https://api.github.com/users/Cramix/repos","events_url":"https://api.github.com/users/Cramix/events{/privacy}","received_events_url":"https://api.github.com/users/Cramix/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-09-28T16:23:12Z","updated_at":"2015-12-22T11:22:48Z","closed_at":null,"body":"Hello,\r\n\r\nWould you be interested by a feature who changes the hostname based on the minion id in the bootstrap-salt.sh? If yes, I can do a pull request.\r\n\r\nThank you"},"comment":{"url":"https://api.github.com/repos/saltstack/salt-bootstrap/issues/comments/166587709","html_url":"https://github.com/saltstack/salt-bootstrap/issues/661#issuecomment-166587709","issue_url":"https://api.github.com/repos/saltstack/salt-bootstrap/issues/661","id":166587709,"user":{"login":"vutny","id":16338056,"avatar_url":"https://avatars.githubusercontent.com/u/16338056?v=3","gravatar_id":"","url":"https://api.github.com/users/vutny","html_url":"https://github.com/vutny","followers_url":"https://api.github.com/users/vutny/followers","following_url":"https://api.github.com/users/vutny/following{/other_user}","gists_url":"https://api.github.com/users/vutny/gists{/gist_id}","starred_url":"https://api.github.com/users/vutny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vutny/subscriptions","organizations_url":"https://api.github.com/users/vutny/orgs","repos_url":"https://api.github.com/users/vutny/repos","events_url":"https://api.github.com/users/vutny/events{/privacy}","received_events_url":"https://api.github.com/users/vutny/received_events","type":"User","site_admin":false},"created_at":"2015-12-22T11:22:48Z","updated_at":"2015-12-22T11:22:48Z","body":"Very generic SLS for doing this:\r\n\r\n```\r\nset-hostname:\r\n  file.managed:\r\n    - name: /etc/hostname\r\n    # hostname is always minion ID.\r\n    - contents_grains: id\r\n    - user: root\r\n    - group: root\r\n    - mode: 644\r\n  cmd.wait:\r\n    # Will fail in Docker container.\r\n    # Use `docker run --hostname=hostname' command to spin up.\r\n    - name: hostname -F /etc/hostname || true\r\n    - watch:\r\n      - file: set-hostname\r\n\r\n{%- if grains['os_family'] == 'RedHat' %}\r\n\r\n/etc/sysconfig/network:\r\n  file.replace:\r\n    - name: /etc/sysconfig/network\r\n    - pattern: ^.*HOSTNAME=.*\r\n    - repl: HOSTNAME=\"{{ grains['id'] }}\"\r\n    - append_if_not_found: True\r\n\r\n{%- endif %}\r\n```"}}