blob: bf2fafb974ab665dc782ea899b69f59703315079 (
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
|
---
- name: Setting master(s) hostname
hostname: name="{% for thishost in groups['masters'] %}{% if inventory_hostname == thishost %}master{{ counter }}.{{ dns_domain }}{% endif %}{% set counter = counter + 1 %}{% endfor %}"
when: "'masters' in group_names"
- name: Setting facts for masters
set_fact: ansible_hostname="{% for thishost in groups['masters'] %}{% if inventory_hostname == thishost %}master{{ counter }}{% endif %}{% set counter = counter + 1 %}{% endfor %}"
when: "'masters' in group_names"
- name: Setting node(s) hostname
hostname: name="{% for thishost in groups['nodes'] %}{% if inventory_hostname == thishost %}node{{ counter }}.{{ dns_domain }}{% endif %}{% set counter = counter + 1 %}{% endfor %}"
when: "'nodes' in group_names"
- name: Setting facts for nodes
set_fact: ansible_hostname="{% for thishost in groups['nodes'] %}{% if inventory_hostname == thishost %}node{{ counter }}{% endif %}{% set counter = counter + 1 %}{% endfor %}"
when: "'nodes' in group_names"
- name: "Templating records"
become: false
template:
src: "{{ role_path }}/templates/records.template.yaml"
dest: "/tmp/records.yaml"
force: yes
delegate_to: localhost
- name: "Updating hostname facts"
setup: filter=ansible_hostname
|