-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
- Loading branch information
1 parent
3336e95
commit 1af8bf4
Showing
3 changed files
with
57 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Gather facts with SNMP version 2 | ||
- name: Gathering basic snmp facts about the device | ||
snmp_facts: host={{ ansible_host }} version=v2c community={{ snmp_rocommunity }} | ||
connection: local | ||
|
||
# We assume that all the PSUs tested should be in good status, otherwise, fix the PSU manually | ||
- fail: | ||
msg: "PSU index {{ item.key }} operstatus is not OK" | ||
when: "{{ item.value.operstatus | int }} != 2" | ||
with_dict: "{{ snmp_psu }}" | ||
|
||
- name: Get the PSU count from command line | ||
shell: psuutil numpsus | ||
become: yes | ||
register: numpsus_out | ||
|
||
- fail: | ||
msg: "PSU counts mismatch" | ||
when: "{{ numpsus_out.stdout | int }} != {{ snmp_psu | length }}" |