summaryrefslogtreecommitdiffstats
path: root/roles/ands_network/tasks/add_names.yml
blob: 3edde38c35bc1877480d11c9b4eef7d90684eba7 (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
# Currently EXCLUDED
# Kind of post-install. We can include this in maitain later.

# We should not do it before Gluster peers are probed, otherwise everything will fail.
# Some peers will have names and others IPs.
- name: Configure all storage hostnames in /etc/hosts
  lineinfile: dest="/etc/hosts" line="{{ ip }} {{ fqdn }} {{ hostname }}" regexp="{{ fqdn }}" state="present"
  when: 
    - hostvars[item]['ands_facts_configured'] is defined
  vars:
    ip: "{{ hostvars[item]['ands_storage_ip'] }}"
    hostname: "{{ hostvars[item]['ands_hostname_storage'] }}"
    fqdn: "{{  hostvars[item]['ands_hostname_storage'] ~ ands_inner_dot_domain }}"
  with_inventory_hostnames:
    - nodes
    - new_nodes

- name: Configure all public hostnames in /etc/hosts
  lineinfile: dest="/etc/hosts" line="{{ ip }} {{ fqdn }} {{ hostname }}" regexp="{{ fqdn }}" state="present"
  when: 
    - hostvars[item]['ands_facts_configured'] is defined
  vars:
    ip: "{{ hostvars[item]['ands_openshift_public_ip'] }}"
    hostname: "{{ hostvars[item]['ands_hostname_public'] }}"
    fqdn: "{{  hostvars[item]['ands_hostname_public'] ~ ands_inner_dot_domain }}"
  with_inventory_hostnames:
    - nodes
    - new_nodes