Ansible 1.9.4, AWS Auto scaling "Launching a new EC2 instance. Status Reason: The parameter SecurityGroup is not recognized. "

549 views
Skip to first unread message

Adrian Black

unread,
Nov 16, 2015, 10:44:46 AM11/16/15
to Ansible Project
Im trying to do an auto scaling group in AWS

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"

Under AWS "Activity History" on Auto Scaling Group i get

"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. 

Anything im doing wrong in the below or any idea about the message?

Thanks


---
 - 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'


Adrian Black

unread,
Nov 16, 2015, 12:35:36 PM11/16/15
to Ansible Project

I think the issue was

security_groups: ['http/https'] on ec2_lc


Changed to use ids though doco isnt very clear on this in either wording "A list of security groups into which instances should be found" or example ['group1', 'group2']
http://docs.ansible.com/ansible/ec2_lc_module.html
Reply all
Reply to author
Forward
0 new messages