Hi,
I’m trying to add instances to an ELB, I may be looking at this the wrong way.
I have X number of instances, running ElasticSearch for example.
I want to create an ELB, and add (register) all the instance ids, with my “elasticsearch” tag, to that ELB.
Is the “ec2_elb” module designed to “register a single instance id to a list of ELBs, at the instance creation time”, as opposed to, “register a list of instance ids, to a single ELB, at any stage”?
So, what I am trying to to:-
- create ec2 instances
- install elasticsearch on all “tag:Name=elasticsearch”
- create ELB
- get list of all instance ids with “tag:Name=elasticsearch”
- register this list with ELB
- name: add instances to LB
ec2_elb:
instance_id: “{{ item }}”
ec2_elbs: “{{ my_elb_name }}”
state: present
with_items: my_es_instances.stdout_lines
TASK: [elb | debug var=my_es_instances] ***************************************
ok: [localhost] => {
“my_es_instances”: {
“changed”: true,
“cmd”: “ec2-describe-instances --hide-tags --region eu-west-1 -F ‘tag:Name=elasticsearch’ | grep INSTANCE | awk ‘{print $2}’”,
“delta”: “0:00:01.477150”,
“end”: “2015-03-06 17:27:25.737070”,
“invocation”: {
“module_args”: “ec2-describe-instances --hide-tags --region eu-west-1 -F ‘tag:Name=elasticsearch’ | grep INSTANCE | awk ‘{print $2}’”,
“module_name”: “shell”
},
“rc”: 0,
“start”: “2015-03-06 17:27:24.259920”,
“stderr”: “”,
“stdout”: “i-123456\ni-abcdef”,
“stdout_lines”: [
“i-123456”,
“i-abcdef”
],
“warnings”:
}
}
Step 5 is where I’m stuck. Am I loosing my mind?
thanks
e