That's what I'm doing:
- name: Add machine to elb
local_action:
module: ec2_elb
aws_access_key: "{{lookup('env', 'AWS_ACCESS_KEY')}}"
aws_secret_key: "{{lookup('env', 'AWS_SECRET_KEY')}}"
region: "{{ansible_ec2_placement_region}}"
instance_id: "{{ ansible_ec2_instance_id }}"
ec2_elbs: "{{elb_name}}"
state: present
The biggest problem was access and private keys. The ec2_elb module does not seem to use environment variables or read ~ / .boto, so I had to pass them manually.
Variables ansible_ec2_*are available if you use the ec2_facts module. You can fill in these parameters yourself.
source
share