Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 088b3c7

Browse files
committed
Merge pull request analytically#14 from gjhenrique/multiple_interfaces
Add support for dynamic network interface
2 parents 755bd02 + d75497d commit 088b3c7

File tree

10 files changed

+19
-18
lines changed

10 files changed

+19
-18
lines changed

group_vars/all

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ mtu: 9216
1111
# mandrill_api_key: your_api_key
1212

1313
# Upgrade kernel to 3.13, much improved epoll performance
14-
upgrade_kernel: no
14+
upgrade_kernel: no
15+
network_interface: eth0

roles/cdh_hadoop_config/templates/hadoop-metrics2.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@
3535
*.sink.ganglia.dmax=jvm.metrics.threadsBlocked=70,jvm.metrics.memHeapUsedM=40
3636

3737
# journalnodes
38-
journalnode.sink.ganglia.servers={% for host in groups['namenodes'] %}{{ hostvars[host]['ansible_default_ipv4']['address'] }}:8649{% if not loop.last %},{% endif %}{% endfor %}
38+
journalnode.sink.ganglia.servers={% for host in groups['namenodes'] %}{{ hostvars[host]["ansible_" + network_interface]["ipv4"]['address'] }}:8649{% if not loop.last %},{% endif %}{% endfor %}
3939

4040
# namenodes
41-
namenode.sink.ganglia.servers={% for host in groups['namenodes'] %}{{ hostvars[host]['ansible_default_ipv4']['address'] }}:8649{% if not loop.last %},{% endif %}{% endfor %}
41+
namenode.sink.ganglia.servers={% for host in groups['namenodes'] %}{{ hostvars[host]["ansible_" + network_interface]["ipv4"]['address'] }}:8649{% if not loop.last %},{% endif %}{% endfor %}
4242

4343
# datanodes
44-
datanode.sink.ganglia.servers={% for host in groups['namenodes'] %}{{ hostvars[host]['ansible_default_ipv4']['address'] }}:8649{% if not loop.last %},{% endif %}{% endfor %}
44+
datanode.sink.ganglia.servers={% for host in groups['namenodes'] %}{{ hostvars[host]["ansible_" + network_interface]["ipv4"]['address'] }}:8649{% if not loop.last %},{% endif %}{% endfor %}
4545

4646
# jobtrackers
47-
jobtracker.sink.ganglia.servers={% for host in groups['namenodes'] %}{{ hostvars[host]['ansible_default_ipv4']['address'] }}:8649{% if not loop.last %},{% endif %}{% endfor %}
47+
jobtracker.sink.ganglia.servers={% for host in groups['namenodes'] %}{{ hostvars[host]["ansible_" + network_interface]["ipv4"]['address'] }}:8649{% if not loop.last %},{% endif %}{% endfor %}
4848

4949
# tasktrackers
50-
tasktracker.sink.ganglia.servers={% for host in groups['namenodes'] %}{{ hostvars[host]['ansible_default_ipv4']['address'] }}:8649{% if not loop.last %},{% endif %}{% endfor %}
50+
tasktracker.sink.ganglia.servers={% for host in groups['namenodes'] %}{{ hostvars[host]["ansible_" + network_interface]["ipv4"]['address'] }}:8649{% if not loop.last %},{% endif %}{% endfor %}
5151

5252
# maptasks
53-
maptask.sink.ganglia.servers={% for host in groups['namenodes'] %}{{ hostvars[host]['ansible_default_ipv4']['address'] }}:8649{% if not loop.last %},{% endif %}{% endfor %}
53+
maptask.sink.ganglia.servers={% for host in groups['namenodes'] %}{{ hostvars[host]["ansible_" + network_interface]["ipv4"]['address'] }}:8649{% if not loop.last %},{% endif %}{% endfor %}
5454

5555
# reducetasks
56-
reducetask.sink.ganglia.servers={% for host in groups['namenodes'] %}{{ hostvars[host]['ansible_default_ipv4']['address'] }}:8649{% if not loop.last %},{% endif %}{% endfor %}
56+
reducetask.sink.ganglia.servers={% for host in groups['namenodes'] %}{{ hostvars[host]["ansible_" + network_interface]["ipv4"]['address'] }}:8649{% if not loop.last %},{% endif %}{% endfor %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
{% for host in groups['datanodes'] %}{{ hostvars[host]['ansible_default_ipv4']['address'] }}
1+
{% for host in groups['datanodes'] %}{{ hostvars[host]["ansible_" + network_interface]["ipv4"]['address'] }}
22
{% endfor %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
{% for host in groups['regionservers'] %}{{ hostvars[host]['ansible_default_ipv4']['address'] }}
1+
{% for host in groups['regionservers'] %}{{ hostvars[host]["ansible_" + network_interface]["ipv4"]['address'] }}
22
{% endfor %}

roles/common/templates/hosts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
127.0.0.1 localhost
44

55
{% for host in groups['all'] %}
6-
{{ hostvars[host]["ansible_default_ipv4"]["address"] }} {{ hostvars[host]["ansible_fqdn"] }} {{ hostvars[host]["ansible_hostname"] }}
6+
{{ hostvars[host]["ansible_" + network_interface]["ipv4"]["address"] }} {{ hostvars[host]["ansible_fqdn"] }} {{ hostvars[host]["ansible_hostname"] }}
77
{% endfor %}

roles/ganglia_metad/templates/gmetad.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# data_source "my grid" 50 1.3.4.7:8655 grid.org:8651 grid-backup.org:8651
4141
# data_source "another source" 1.3.4.7:8655 1.3.4.8
4242

43-
data_source "Hadoop" {{ hostvars[groups["masters"][0]]["ansible_default_ipv4"]["address"] }} {{ hostvars[groups["masters"][1]]["ansible_default_ipv4"]["address"] }}
43+
data_source "Hadoop" {{ hostvars[groups["masters"][0]]["ansible_" + network_interface]["ipv4"]["address"] }} {{ hostvars[groups["masters"][1]]["ansible_" + network_interface]["ipv4"]["address"] }}
4444

4545
#
4646
# Round-Robin Archives

roles/ganglia_monitor/templates/gmond.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ host {
3636
also have each node send the same information to more than one place for redundancy. */
3737

3838
udp_send_channel {
39-
host = {{ hostvars[groups["masters"][0]]["ansible_default_ipv4"]["address"] }}
39+
host = {{ hostvars[groups["masters"][0]]["ansible_" + network_interface]["ipv4"]["address"] }}
4040
port = {{ ganglia_udp_send|default('8649') }}
4141
}
4242

4343
udp_send_channel {
44-
host = {{ hostvars[groups["masters"][1]]["ansible_default_ipv4"]["address"] }}
44+
host = {{ hostvars[groups["masters"][1]]["ansible_" + network_interface]["ipv4"]["address"] }}
4545
port = {{ ganglia_udp_accept|default('8649') }}
4646
}
4747

roles/smokeping/templates/Targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ title = {{ group|replace("_", " ")|title }}
2121
{% for host in groups[group] %}
2222
+++ {{ hostvars[host]['ansible_hostname'] }}
2323
menu = {{ hostvars[host]['ansible_hostname'] }}
24-
title = {{ group|replace("_", " ")|title }} {{ hostvars[host]['ansible_hostname'] }} at {{ hostvars[host]['ansible_default_ipv4']['address'] }}
24+
title = {{ group|replace("_", " ")|title }} {{ hostvars[host]['ansible_hostname'] }} at {{ hostvars[host]["ansible_" + network_interface]["ipv4"]['address'] }}
2525
host = {{ hostvars[host]['ansible_fqdn'] }}
2626
alerts = bigloss,someloss,startloss,rttdetect,hostdown
2727
{% endfor %}

roles/td_agent/templates/td-agent.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
type elasticsearch
2222
logstash_format true
2323
{% if groups["elasticsearch"]|length == 1 %}
24-
host {{ hostvars[groups["elasticsearch"][0]]["ansible_default_ipv4"]["address"] }}
24+
host {{ hostvars[groups["elasticsearch"][0]]["ansible_" + network_interface]["ipv4"]["address"] }}
2525
port {{ elasticsearch_port }}
2626
{% else %}
27-
hosts {% for host in groups['elasticsearch'] %}{{ hostvars[host]["ansible_default_ipv4"]["address"] }}:{{ elasticsearch_port }}{% if not loop.last %},{% endif %}{% endfor %}
27+
hosts {% for host in groups['elasticsearch'] %}{{ hostvars[host]["ansible_" + network_interface]["ipv4"]["address"] }}:{{ elasticsearch_port }}{% if not loop.last %},{% endif %}{% endfor %}
2828
{% endif %}
2929

3030
</match>

site.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
sudo_user: hdfs
9898
tasks:
9999
- name: wait for the first namenode to come online
100-
wait_for: host={{ hostvars[groups['namenodes'][0]]['ansible_default_ipv4']['address'] }} port=50070
100+
wait_for: host={{ hostvars[groups['namenodes'][0]]["ansible_" + network_interface]["ipv4"]['address'] }} port=50070
101101
tags:
102102
- hadoop
103103
- hbase

0 commit comments

Comments
 (0)