diff --git a/playbook/install-datanode.yml b/playbook/install-datanode.yml index 44dad300b0f9a326f0b961ddda8808bb62939034..d5f94ba4ac616dfc96b77c8766b2efe3ee217b34 100644 --- a/playbook/install-datanode.yml +++ b/playbook/install-datanode.yml @@ -4,4 +4,5 @@ roles: - common + - hosts-file - hadoop-common \ No newline at end of file diff --git a/playbook/install-namenode.yml b/playbook/install-namenode.yml index 8ce252f57818a92283d6d92f1345c683831921b1..23ac001ecd7a5e6cfd7db0aae1958be1d2159aba 100644 --- a/playbook/install-namenode.yml +++ b/playbook/install-namenode.yml @@ -4,4 +4,5 @@ roles: - common + - hosts-file - hadoop-common \ No newline at end of file diff --git a/playbook/roles/hosts-file/tasks/main.yml b/playbook/roles/hosts-file/tasks/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..65eb5f5e612e0aa5c7b54046c0559a1d4d2acc22 --- /dev/null +++ b/playbook/roles/hosts-file/tasks/main.yml @@ -0,0 +1,5 @@ +- name: build /etc/hosts with variables definition + become: yes + template: + src: templates/etc_hosts.j2 + dest: "/etc/hosts" \ No newline at end of file diff --git a/playbook/roles/hosts-file/templates/etc_hosts.j2 b/playbook/roles/hosts-file/templates/etc_hosts.j2 new file mode 100644 index 0000000000000000000000000000000000000000..5dd517cf525ec620bce2cd70d73b69033d041366 --- /dev/null +++ b/playbook/roles/hosts-file/templates/etc_hosts.j2 @@ -0,0 +1,3 @@ +{% for node in cluster %} +{{node.IP}} {{node.hostname}} +{% endfor %} \ No newline at end of file diff --git a/playbook/roles/hosts-file/vars/main.yml b/playbook/roles/hosts-file/vars/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..f74023cec1c533635031e6fe26661c30c37227f8 --- /dev/null +++ b/playbook/roles/hosts-file/vars/main.yml @@ -0,0 +1,7 @@ +cluster: + - hostname: namenode + IP: 10.0.0.10 + - hostname: datanode1 + IP: 10.0.0.11 + - hostname: datanode2 + IP: 10.0.0.12