aboutsummaryrefslogtreecommitdiffstats
path: root/roles/hostname/tasks/main.yml
blob: f24d86509eb67ccc71c04a82584f1b4e19a4cb8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
- name: set hostname
  hostname:
    name: '{{ hostname_fqdn }}'
  register: hostname

- name: update /etc/hosts
  template:
    src: etc/hosts.j2
    dest: /etc/hosts
  register: hosts_file

- name: gather hostname facts
  setup:
    filter:
      - ansible_fqdn
      - ansible_hostname
      - ansible_domain
  when: hostname.changed or hosts_file.changed