Skip to content
This repository was archived by the owner on Oct 30, 2018. It is now read-only.
This repository was archived by the owner on Oct 30, 2018. It is now read-only.

ec2_asg targets incorrect asg when attempting to roll over instances #193

@rglew

Description

@rglew
Issue Type:

BugFix Pull Request

Ansible Version:

ansible 1.8 (devel 1d04e4b)

Environment:

Replicated on Mac OS X 10.9 & Ubuntu 14.04 LTS (Host) Target (AWS EC2)

Summary:

When running the following play,

tasks:
    - name: Create a Launch Config
      local_action:
          module: ec2_lc
          image_id: "{{ ami2use }}"
          key_name: "{{ key_name }}"
          security_groups: "{{ security_group }}"
          instance_type: "{{ instance_type }}"
          assign_public_ip: yes 
          state: present
          region: "{{ region }}"
          name: LNCH_CFG_ANSBL_TST6
          instance_profile_name: "{{ iam_role }}"

    - name: Add new LC to ASG
      local_action:
        module: ec2_asg
        name: TST_ANSBL_ASG
        launch_config_name: LNCH_CFG_ANSBL_TST6
        health_check_period: 60
        health_check_type: EC2
        replace_all_instances: yes
        min_size: 1
        max_size: 5
        desired_capacity: 1
        region: "{{ region }}"
        vpc_zone_identifier: "{{ vpc_subnet_id }}"

The ASG specified by name is not used and instead it defaults to a different ASG (the first in the array returned?). This could be particularly nasty if that happens to be an ASG you need..

Steps To Reproduce:

Run the above play twice and update the LC name so it will attempt to cycle the images (or run against an ASG that has instances running with a different LC than the one specified.

Make sure you have multiple ASGs available (and none of them are important)

Expected Results:

The ASG should have cycled instances to use the new launch config

Actual Results:

In my case, the ASG that was targeted was a test ASG with max/min/desired set to 0. Play errorred out with the error message "Waited too for instances"

NOTE

I have actually determined the problem with the script - it's just a simple dev typo with parameter names. I am testing now and will send a pull request once I am happy its working correctly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions