-
Notifications
You must be signed in to change notification settings - Fork 254
/
add_nodes_aws.yml
15 lines (14 loc) · 837 Bytes
/
add_nodes_aws.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
---
- set_fact: outer_loop="{{ item }}"
- name: Add nodes to hadoop-cluster and {{ outer_loop.host_group }} groups
add_host:
name: "{{ (outer_loop.public_ip|default(false)== true) | ternary(hostvars[local_loop].ec2_dns_name,hostvars[local_loop].ec2_private_dns_name) }}"
ansible_host: "{{ (outer_loop.public_ip|default(false)== true) | ternary(hostvars[local_loop].ec2_ip_address,hostvars[local_loop].ec2_private_ip_address) }}"
ansible_user: "{{ cloud_config.admin_username|default('root') }}"
ansible_ssh_private_key_file: "{{ cloud_config.ssh.privatekey }}"
ansible_become_user: root
groups: hadoop-cluster, {{ outer_loop.host_group }}
loop_control:
loop_var: local_loop
when: outer_loop.count > 0
with_items: "{{ groups[('tag_Group_'~cluster_name~'-'~outer_loop.host_group)|replace('-','_')] }}"