Below is my script.
It runs and almost completes (it sets up lb, asg and lc in AWS) but times out with
"msg: Waited too long for new instances to become viable. Mon Nov 16 15:35:31 2015"
"Launching a new EC2 instance. Status Reason: The parameter SecurityGroup is not recognized. Launching EC2 instance failed."
I have tried looking for that message with only 2 hits in all of google so its not a common error.
---
- name: sets up site on a vm on aws
hosts: localhost
connection: local
gather_facts: false
roles:
- common
- awskeys
- awsvars
vars:
machine_type: t2.medium
site_prefix: pca
server_min_size: 1
server_max_size: 2
server_desired_size: 1
aws_site_security_groups: ['http/https', 'ssh' , 'smtp']
aws_elb_security_groups: ['http/https']
tasks:
- debug: var="{{ aws_region }}"
- name: create elastic load balancer
local_action:
module: ec2_elb_lb
name: "{{ site_prefix }}-elb"
state: present
security_group_ids: 'sg-577f9933' #http/s
region: "{{ aws_region }}"
zones:
- "{{ aws_region }}a"
listeners:
- protocol: http
load_balancer_port: 80
instance_port: 80
health_check:
ping_protocol: http # options are http, https, ssl, tcp
ping_port: 80
ping_path: "/" # not required for tcp or ssl
response_timeout: 5 # seconds
interval: 30 # seconds
unhealthy_threshold: 2
healthy_threshold: 10
- name: create launch config
ec2_lc:
name: "{{ site_prefix }}-lc"
image_id: "{{ aws_vm_image }}"
region: "{{ aws_region }}"
security_groups: ['http/https']
instance_type: "{{ machine_type }}"
key_name: BOB
assign_public_ip: yes
- name: create auto scaling group
ec2_asg:
name: "{{ site_prefix }}-asg"
launch_config_name: "{{ site_prefix }}-lc"
health_check_period: 60
health_check_type: ELB
replace_all_instances: yes
min_size: "{{ server_min_size }}"
max_size: "{{ server_max_size }}"
desired_capacity: "{{ server_desired_size }}"
region: "{{ aws_region }}"
load_balancers: "{{ site_prefix }}-elb"
#needed if public ip is required
vpc_zone_identifier:
- 'subnet-1448e94d'