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
Add module cpm_status for WTI device management #42970
Conversation
The test
The test
|
The test
|
The test
|
Hi everyone, I know this module is a bit difficult to test/comment/approve because it applies our company produced networking equipment, I setup a community accessible unit if anyone would like to try this module. The excerpt from my /etc/ansible/hosts file and a sample playbook are below. (From /etc/ansible/hosts file)
# ansible-playbook ./getver.yml
- name: Get Device Firmware version
connection: local
hosts: wti_demo
gather_facts: false
tasks:
- set_fact: use_https=True
when: use_https is undefined
- name: run Get Device Firmware version
cpm_status:
cpm_action: "firmware"
cpm_url: "{{ansible_host}}"
cpm_username: "{{ansible_user}}"
cpm_password: "{{ansible_pw}}"
use_https: "{{use_https}}"
register: testout
- name: dump test output
debug:
msg: "{{ testout.data }}" |
@mattsene Please email service@wti.com for the user module, we can't post here until the cpm_status module is approved, since time is tight, we have a few people testing it outside this scope, just to test our basic premise. Please note the experimental user module could and WILL change at any time. |
@vientiane Please email service@wti.com for your experimental user module questions until we post it on the github site. The answer to your question: the minimum length is 5 characters with a maximum length of 32. All WTI Ansible modules will use our RESTful API which is documented here |
Hi @samdoran , hope your time off was awesome. When you get caught up can you peek at my comments about your change request about the common options. Thanks Ken |
@syncpak The latest version of this lookup works nicely. The output it returns is looks correct now.
No, that wouldn't be appropriate. If you set The docs section needs to be updated to add any ini and env settings, if desired. |
EXAMPLES = """ | ||
# Get temperature | ||
- name: run Get Device Temperature | ||
debug: msg="{{ lookup('cpm_status', |
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.
Can you change the examples to use YAML rather than k=v
shorthand?
- debug:
var: lookup('cpm_status',
'temperature',
validate_certs=true,
use_https=true,
cpm_url='rest.wti.com',
cpm_username='rest',
cpm_password='restfulpassword')
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.
hi @samdoran , absolutely, could you point us to an lookup example that we could pattern this after ? I am having a little trouble
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.
The example I gave is a pretty good. I don't think we have any examples of using the lookup across multiple lines. There are quite a few examples that need to me updated to use YAML rather than k=v
, which is confusing.
You can look at consul_kv.py
or onepassword.py
for examples.
Thanks @samdoran i believe i was way over thinking things. New Examples checked in. |
Can the Temperature return be switched from Fahrenheit to Celsius |
@dmobergIT that can be defined in the box on the system level. Via the Ansible lookup module, only one or the other will be displayed, depending on the setting in the WTI box itself. |
Hi @samdoran, are we good ? Thanks |
@syncpak Yup, looks good. Did you want to update the documentation to leverage environment variables and/or config file settings? |
@samdoran , I think we are good. All our parameters (unfortunately or fortunately depending on who you talk to) are per a unit basis, nothing globally can be assumed. Our parameters cpm_url, cpm_username, cpm_password, use_https, validate_certs can't be globally set because usually our customers have varying uses and configurations. |
from ansible.plugins.lookup import LookupBase | ||
from ansible.module_utils._text import to_text, to_bytes | ||
from ansible.module_utils.six.moves.urllib.error import HTTPError, URLError | ||
from ansible.module_utils._text import to_text, to_native |
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.
Combine this import with line 114.
…vious ansible.module_utils._text import line
@samdoran i made the changes but an getting goofy errors when github is doing the checks. The First time i was getting an "unstable" warning, now i am getting some docker errors. I only made that change merging redundant lines and the code still runs when i do my check against it. |
@syncpak That is "trouble in the cloud" as they say. The failures are unrelated to your changes. I re-ran the one remaining failing test to see if it passes. |
Integration test failures are unrelated to this change. Merging. |
@sandoran thanks, i was getting paranoid. |
SUMMARY
Added Western Telematic Inc. (WTI) module allowing communication with WTI OOB and PDU devices via RESTful calls and http/https
Add module cpm_status for WTI device management
ISSUE TYPE
COMPONENT NAME
cpm_status
ANSIBLE VERSION
ADDITIONAL INFORMATION