Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hshbase-formula
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
salt
hshbase-formula
Commits
b854644d
Commit
b854644d
authored
5 years ago
by
Jan Philipp Timme
Browse files
Options
Downloads
Patches
Plain Diff
Add new state to manage /etc/hostname and /etc/hosts
parent
28d5425b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
hshbase/hostname/files/hosts
+20
-0
20 additions, 0 deletions
hshbase/hostname/files/hosts
hshbase/hostname/init.sls
+12
-0
12 additions, 0 deletions
hshbase/hostname/init.sls
hshbase/init.sls
+1
-0
1 addition, 0 deletions
hshbase/init.sls
with
33 additions
and
0 deletions
hshbase/hostname/files/hosts
0 → 100644
+
20
−
0
View file @
b854644d
### THIS FILE IS MANAGED BY SALT!
### YOUR CHANGES WILL BE OVERWRITTEN!
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
{%- set fqdn = grains['id'] -%}
{%- set localname = '' -%}
{%- if '.' in grains['id'] -%}
{%- set localname = fqdn.split('.')[0] -%}
{%- endif %}
{% for ip in grains['ipv4'] -%}
{%- if ip != '127.0.0.1'%}
{{ ip }} {{ fqdn }} {{ localname }}
{%- endif %}
{%- endfor %}
This diff is collapsed.
Click to expand it.
hshbase/hostname/init.sls
0 → 100644
+
12
−
0
View file @
b854644d
hsh_etc_hostname_content:
file.managed:
- name: /etc/hostname
- contents: |
{{ grains['id'] }}
hsh_etc_hosts_content:
file.managed:
- name: /etc/hosts
- template: jinja
- source: salt://hshbase/hostname/files/hosts
This diff is collapsed.
Click to expand it.
hshbase/init.sls
+
1
−
0
View file @
b854644d
...
...
@@ -8,3 +8,4 @@ include:
- .openvmtools
- .time
- .locale
- .hostname
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment