Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ec2_asg: add detach_instances feature #649

Closed
1 task done
dstan88 opened this issue Jul 19, 2021 · 4 comments
Closed
1 task done

ec2_asg: add detach_instances feature #649

dstan88 opened this issue Jul 19, 2021 · 4 comments
Assignees
Labels
feature This issue/PR relates to a feature request has_pr module module plugins plugin (any type)

Comments

@dstan88
Copy link

dstan88 commented Jul 19, 2021

Summary

Add 'detach_instances' feature that will not terminate the instance(s) after being replaced in the AutoScalingGroup****

Issue Type

Feature Idea

Component Name

ec2_asg

Additional Information

    # Custom check for detaching the EC2 Instance from Autoscaling Group
    if detach_instances:
        instance_to_detach = replace_instances
        changed = False
        for instance_id in instance_to_detach:
            if instance_id in instances:
                changed = True
                detach_asg_instance(connection, instance_id, group_name, False)
                wait_for_new_inst(connection, group_name, wait_timeout, desired_capacity, 'viable_instances')
                wait_for_elb(connection, group_name)
                wait_for_target_group(connection, group_name)

        return(changed, props)

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module module needs_triage plugins plugin (any type) labels Jul 19, 2021
@alinabuzachis
Copy link
Contributor

Hi @dstan88, thank you for this feature idea. Would you be willing to work on this?

@markuman markuman mentioned this issue Feb 1, 2022
1 task
@mandar242 mandar242 self-assigned this Feb 9, 2022
softwarefactory-project-zuul bot pushed a commit that referenced this issue Feb 26, 2022
ec2_asg: Add functionality to detach specified instances from ASG 

SUMMARY

Adds feature to detach specified instances from a AutoScalingGroup rather than terminating them directly.
Detached instances are not terminated and can be managed independently.

Implements #649
ISSUE TYPE


Feature Pull Request

COMPONENT NAME

ec2_asg
ADDITIONAL INFORMATION


Makes use of
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/autoscaling.html#AutoScaling.Client.detach_instances

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Mandar Kulkarni <mandar242@gmail.com>
Reviewed-by: Jill R <None>
Reviewed-by: Joseph Torcasso <None>
@mandar242
Copy link
Contributor

Closing the issue as #933 is merged and resolves this issue.

alinabuzachis pushed a commit to alinabuzachis/community.aws that referenced this issue Mar 11, 2022
…sible-collections#933)

ec2_asg: Add functionality to detach specified instances from ASG 

SUMMARY

Adds feature to detach specified instances from a AutoScalingGroup rather than terminating them directly.
Detached instances are not terminated and can be managed independently.

Implements ansible-collections#649
ISSUE TYPE


Feature Pull Request

COMPONENT NAME

ec2_asg
ADDITIONAL INFORMATION


Makes use of
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/autoscaling.html#AutoScaling.Client.detach_instances

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Mandar Kulkarni <mandar242@gmail.com>
Reviewed-by: Jill R <None>
Reviewed-by: Joseph Torcasso <None>
alinabuzachis pushed a commit to alinabuzachis/community.aws that referenced this issue May 25, 2022
…s#649)

Splitup core.py and move non-EC2 code from ec2.py

SUMMARY
Many of the functions in ec2.py were there primarily as a quirk of the AWS utility code living solely in ec2.py at the time it was written (no other aws utility code existed at the time). Since it isn't specific to the EC2 service, split it out.
Similarly, the core.py code came from a time when we were in with the rest of the Ansible code, so it became a general dumping ground.  We don't need to worry about collisions with non-AWS module_util code now, let's break it apart to avoid potential circular dependencies.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
plugins/module_utils/ec2.py
plugins/module_utils/core.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request has_pr module module plugins plugin (any type)
Projects
None yet
Development

No branches or pull requests

4 participants