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

Module to gather F5 gtm facts #1765

Closed
wants to merge 2 commits into from
Closed

Conversation

perzizzle
Copy link

Issue Type:
  • New Module Pull Request
Plugin Name:

bigip_gtm_facts

Ansible Version:
ansible 1.9.2
Summary:

This module can be used to gather details about F5 GTM Wide Ips, Pools and Virtual Servers

Example output:
{
    "ansible_facts": {
        "wide_ip": {
            "/Common/test.example.com": {
                "lb_method": "LB_METHOD_ROUND_ROBIN",
                "pool": [{
                    "order": 0,
                    "pool_name": "/Common/MN-test.example.com",
                    "ratio": 1
                }, {
                    "order": 1,
                    "pool_name": "/Common/VA-test.example.com",
                    "ratio": 1
                }]
            }
        }
    },
    "changed": false
}

@perzizzle
Copy link
Author

@caphrim007 This is the module we talked about awhile back, it works in conjunction with bigip_gtm_wide_ip/pool/virtual_server and is modeled in large part on bigip_facts.

@caphrim007
Copy link
Contributor

alrighty, i'll have a look-see. Cursory glances suggest some improvements.

The output listed in the PR needs to be documented in a

RETURN = '''
'''

Block in the head of the file.

Also, there is an f5 file in the module_utils that should be used to get access to the bigip soap api as it includes cert validation. Also it can be used to include the f5_module_spec and then add arguments to that.

There are some examples for reference in this module here

https://github.com/F5Networks/f5-ansible/blob/master/library/bigip_partition.py

Lines 102 and 365.

Thanks!

@perzizzle
Copy link
Author

@caphrim007 Do you know of any modules that only return ansible_facts for a look at their RETURN string? bigip_facts doesn't seem to support this yet and the developing modules documentation doesn't provide much guidance. I committed an initial guess.

I'll update the module to use the helper methods shortly, those weren't available when I originally wrote this.

@caphrim007
Copy link
Contributor

@perzizzle the link I provided at line 365 has an example. It's enough to list the return key (ex. "wide_ip") and an example of the values of the key. For example http://docs.ansible.com/ansible/clc_group_module.html

@perzizzle
Copy link
Author

@caphrim007 I updated the module to use the f5 module_utils.

My confusion about the RETURN document string is whether or not I should use ansible_facts (which is the actual key that's returned) or wide_ip, virtual_server, and pools which are the items within ansible_facts. The sample string I provided would be the format returned if you did include=wide_ip.

@caphrim007
Copy link
Contributor

@perzizzle the latter. That key causes ansible to merge the facts you provide, as JP mentions here http://jpmens.net/2012/07/15/ansible-it-s-a-fact/

@caphrim007
Copy link
Contributor

@perzizzle here's a better example of a dictionary being documented

http://docs.ansible.com/ansible/stat_module.html

@perzizzle
Copy link
Author

@caphrim007 Alright took another shot at a the RETURN string. Do you know of way to see how it will be displayed in the documentation? It passes yamllint but it would be nice to see what it looks like after its been parsed and displayed.

@caphrim007
Copy link
Contributor

@perzizzle Yep, there is the ansible-doc command. You can run it on the existing stat module like so

ansible-doc stat

and see the RETURN section for details. For your module there you can run it and specify the module search path. For example, if your module is located in the current working directory's library/ directory, it might look like this

ansible-doc -M library/ bigip_gtm_facts

Hope that helps

@gregdek
Copy link
Contributor

gregdek commented Mar 2, 2016

Thanks @perzizzle for this new module. When this module receives 'shipit' comments from two community members and any 'needs_revision' comments have been resolved, we will mark for inclusion.

@gregdek
Copy link
Contributor

gregdek commented May 4, 2016

Thanks @perzizzle for this PR. This PR requires revisions, either because it fails to build or by reviewer request. Please make the suggested revisions. When you are done, please comment with text 'ready_for_review' and we will put this PR back into review.

[This message brought to you by your friendly Ansibull-bot.]

@perzizzle
Copy link
Author

I updated version added to pass the build, otherwise I think its ready. @caphrim007 @gregdek

- "Tested with manager and above account privilege level"

requirements:
- bigsuds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The requirements is just text, so you can make this clearer by doing

- "bigsuds >= 11.4"

@gundalow
Copy link
Contributor

I'll leave the functional review to the Networking experts.

PEP8 is showing a number of issues that it would be good to get addressed

pep8 -r --ignore=E501,E221,W291,W391,E302,E251,E203,W293,E231,E303,E201,E225,E261,E241,E402 bigip_gtm_facts.py 
bigip_gtm_facts.py:123:5: E301 expected 1 blank line, found 0
bigip_gtm_facts.py:152:9: E265 block comment should start with '# '
bigip_gtm_facts.py:155:5: E301 expected 1 blank line, found 0
bigip_gtm_facts.py:157:5: E301 expected 1 blank line, found 0
bigip_gtm_facts.py:159:5: E301 expected 1 blank line, found 0
bigip_gtm_facts.py:161:5: E265 block comment should start with '# '
bigip_gtm_facts.py:163:5: E265 block comment should start with '# '
bigip_gtm_facts.py:165:5: E301 expected 1 blank line, found 0
bigip_gtm_facts.py:219:45: E202 whitespace before '}'
bigip_gtm_facts.py:223:50: E202 whitespace before '}'

@gregdek
Copy link
Contributor

gregdek commented Jun 8, 2016

@perzizzle ping, any update here?

@gregdek gregdek removed the cloud label Jul 25, 2016
@perzizzle
Copy link
Author

@gregdek quick before the merge conflicts appear again :)

@caphrim007
Copy link
Contributor

I'll pull this and check it against my bigips here

@perzizzle
Copy link
Author

@caphrim007 There's been no changes I just pulled in the latest devel so that there weren't any merge conflicts.

@gundalow
Copy link
Contributor

gundalow commented Aug 3, 2016

Hi,

Just reviewing Networking PRs. What's the plan for this (who's doing what)?

@caphrim007
Copy link
Contributor

Hey @gundalow I think the ball is currently with me and reviewing it to make sure it is returning expected results. I can respond today

@gundalow
Copy link
Contributor

gundalow commented Aug 3, 2016

@caphrim007 That's great thanks. If there is anything for the Ansible Core Team to do feel free to add it to the Networking Meeting agenda (we have a meeting today) https://github.com/ansible/community/blob/master/MEETINGS.md


class F5(object):
def __init__(self, host, user, password, validate_certs, session=False):
self.api = bigip_api(host, user, password, validate_certs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

port needs to go here

@caphrim007
Copy link
Contributor

caphrim007 commented Aug 3, 2016

@gundalow and @perzizzle needs_review

- BIG-IP host
required: true
default: null
choices: []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to list empty parameters, so you can delete these lines

@gundalow
Copy link
Contributor

needs_revision

@gregdek
Copy link
Contributor

gregdek commented Aug 10, 2016

Thanks @perzizzle for this PR. This PR requires revisions, either because it fails to build or by reviewer request. Please make the suggested revisions. When you are done, please comment with text 'ready_for_review' and we will put this PR back into review.

[This message brought to you by your friendly Ansibull-bot.]

@gregdek
Copy link
Contributor

gregdek commented Aug 26, 2016

@perzizzle A friendly reminder: this pull request has been marked as needing your action. If you still believe that this PR applies, and you intend to address the issues with this PR, just let us know in the PR itself and we will keep it open pending your changes. When you do address the issues, please respond with ready_for_review in your comment, so that we can notify the maintainer.

[This message brought to you by your friendly Ansibull-bot.]

@gregdek
Copy link
Contributor

gregdek commented Sep 10, 2016

@perzizzle Another friendly reminder: this pull request has been marked as needing your action. If you still believe that this PR applies, and you intend to address the issues with this PR, just let us know in the PR itself and we will keep it open. If you have addressed the issues and believe it's ready for review, please comment with the text "ready_for_review". If we don't hear from you within another 14 days, we will close this pull request.

[This message brought to you by your friendly Ansibull-bot.]

@gundalow
Copy link
Contributor

Merge conflict in .travis.yml needs resolving (should be simple)

@gregdek
Copy link
Contributor

gregdek commented Sep 26, 2016

@perzizzle A friendly reminder: this pull request has been marked as needing your action. If you still believe that this PR applies, and you intend to address the issues with this PR, just let us know in the PR itself and we will keep it open pending your changes. When you do address the issues, please respond with ready_for_review in your comment, so that we can notify the maintainer.

[This message brought to you by your friendly Ansibull-bot.]

@perzizzle
Copy link
Author

@gregdek @gundalow @caphrim007 Has offered to usher this PR through the approval process.

@caphrim007
Copy link
Contributor

@gundalow @gregdek this can be closed for now. I will open a PR that supplies this functionality so that we don't need to be bugging others about it. Thanks!

@gundalow
Copy link
Contributor

Thabks again for working on this. Just for completeness once you raise the new PR please link to this one in the comments.

@caphrim007
Copy link
Contributor

@perzizzle here is the facts module that has been merged #3232

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants