summaryrefslogtreecommitdiffstats
path: root/roles/common/tasks/hosts.yml
blob: f818635baa84048bae5b4ea89fea6cd7fc25e958 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
- 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

- meta: flush_handlers