-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
elb_target_facts Fixes #39780 #43565
Conversation
@yaakov-github this PR contains the following merge commits: Please rebase your branch to remove these commits. |
Hi @yaakov-github, Thank you for the pullrequest, just so you are aware we have a dedicated Working Group for aws. |
registered ELBv2 target groups for a given instance id
The test
|
@Constantin007 @Constantin07 @Deepakkothandan @Etherdaemon @Java1Guy @Lujeni @Madhura-CSI @MichaelBaydoun @Sodki @adq @akazakov @alachaum @amir343 @anryko @bekelchik @bpennypacker @brandond @carsongee @chenl87 @defunctio @dennisconrad @dkhenry @fiunchinho @fivethreeo @flowerysong @garethr @gunzy83 @gurumaia @hsingh @hyperized @iiibrad @infectsoldier @j-carl @jarv @Java1Guy @jimbydamonk @jmenga @joelthompson @jonhadfield @jonmer85 @joshsouza @jsdalton @jsmartin @kaczynskid @leedm777 @linuxdynasty @loia @lwade @MichaelBaydoun @michaeljs1990 @minichate @mjschultz @mmochan @nadirollo @nand0p @naslanidis @nathanwebsterdotme @nerzhul @nickball @orthanc @piontas @pjodouin @prasadkatti @psykotox @pwnall @raags @rickmendes @roadmapper @ryansydnor @scicoin-project @scottanderson42 @shepdelacreme @silviud @slapula @steynovich @tastychutney @tedder @tgerla @timmahoney @tombamford @tsiganenok @viper233 @whiter @willricardo @wilvk @wimnat @zacblazic @zbal @zeekin @zimbatm As a maintainer of a module in the same namespace this new module has been submitted to, your vote counts for shipits. Please review this module and add |
Let's not use ansible_facts. Just return a dict containing instance_target_groups or something |
supports_check_mode=True, | ||
) | ||
|
||
if not HAS_BOTO3: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed with AnsibleAWSModule
"""Fetch all IPs associated with this instance so that we can determine | ||
whether or not an instance is in an IP-based target group""" | ||
try: | ||
ec2 = self.module.client( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't see the point of using a class if you're just going to create the client inside methods!
I'd create the ec2 and elbv2 clients at __init__
time and just use self.ec2 in the methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor style change needed, looks good otherwise.
""" | ||
|
||
RETURN = """ | ||
ec2_tgs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ec2_tags
AWSRetry) | ||
|
||
|
||
class Target: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These declarations need to be new-style classes like Target(object):
… return a fact, and use instance variables for the AWS connections. updating tests to go along with that
@ryansb will it be available for 2.6 future release or 2.7.0? |
2.7 is the targeted release for this. |
You can use it with 2.6 though: http://willthames.github.io/2017/12/12/using-updated-modules-with-stable-ansible.html |
SUMMARY
Fixes #39780
Adds an 'elb_target_facts' module which will gather a list of all target groups to which a given instance is registered, covering both IP and instance target groups. This is added to a fact called 'ec2_tgs', which can be used by a playbook to change deregister/reregister nodes to the target groups.
ISSUE TYPE
COMPONENT NAME
lib/ansible/modules/cloud/amazon/elb_target_facts.py
ANSIBLE VERSION
ADDITIONAL INFORMATION