diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2013-10-30 20:59:39 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2015-06-07 02:50:26 +0200 |
commit | a43183028558300268e4cf74fec9631d342c0406 (patch) | |
tree | f6b948ea9ae83cf3e5c8c52e9d4af75e09c0cc4f /roles/common/tasks | |
parent | 4b3fd7e66dc1ed8b577cb522859d290b313b4ab1 (diff) |
Configure /etc/{hosts,hostname,mailname}.
Diffstat (limited to 'roles/common/tasks')
-rw-r--r-- | roles/common/tasks/hosts.yml | 27 | ||||
-rw-r--r-- | roles/common/tasks/main.yml | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/roles/common/tasks/hosts.yml b/roles/common/tasks/hosts.yml new file mode 100644 index 0000000..18ccfd9 --- /dev/null +++ b/roles/common/tasks/hosts.yml @@ -0,0 +1,27 @@ +- name: Set hostname + template: src=etc/hostname.j2 + dest=/etc/hostname + owner=root group=root + mode=0644 + tags: hostname + notify: + - Refresh hostname + +- name: Set mailname + template: src=etc/mailname.j2 + dest=/etc/mailname + owner=root group=root + mode=0644 + tags: mailname + +- name: Fix /etc/hosts (1) + lineinfile: dest=/etc/hosts create=yes + regexp="^127\.0\.0\.1\s+" + line="127.0.0.1 localhost" + tags: hosts + +- name: Fix /etc/hosts (2) + lineinfile: dest=/etc/hosts create=yes + regexp="^127\.0\.1\.1\s+" + line="127.0.1.1 {{ inventory_hostname }} {{ inventory_hostname_short }}" + tags: hosts diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index acc9611..1abcbb6 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -1,2 +1,3 @@ --- - include: sysctl.yml tags=sysctl +- include: hosts.yml |