Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
b1ccda00
Commit
b1ccda00
authored
Oct 12, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1311 from dagwieers/hpilo_facts-cleanup
hpilo_facts: Various clean ups in documentation and code
parents
1487b6a1
5612cce4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
51 deletions
+33
-51
library/hpilo_facts
+33
-51
No files found.
library/hpilo_facts
View file @
b1ccda00
...
@@ -37,51 +37,45 @@ options:
...
@@ -37,51 +37,45 @@ options:
login:
login:
description:
description:
- The login name to authenticate to the HP iLO interface.
- The login name to authenticate to the HP iLO interface.
required: false
default: Administrator
default: Administrator
password:
password:
description:
description:
- The password to authenticate to the HP iLO interface.
- The password to authenticate to the HP iLO interface.
required: false
default: admin
default: admin
match:
description:
- An optional string to match against the iLO server name.
- This is a safety measure to prevent accidentally using the wrong
HP iLO interface with dire consequences.
required: false
examples:
examples:
- code: |
- description: Task to gather facts from a HP iLO interface only if the system is an HP server
local_action: hpilo_facts host=$ilo_address login=$ilo_login password=$ilo_password match=$inventory_hostname_short
code: |
only_if: "'$cmdb_hwmodel'.startswith('HP ')
- local_action: hpilo_facts host=$ilo_address login=$ilo_login password=$ilo_password
description: Task to gather facts from a HP iLO interface only if the system is an HP server
only_if: "'$cmdb_hwmodel'.startswith('HP ')
- description: Typical output of HP iLO_facts for a physical system
- local_action: fail msg="CMDB serial ($cmdb_serialno) does not match hardware serial ($hw_system_serial) !"
code: |
only_if: "'$cmdb_serialno' != '$hw_system_serial'"
- hw_bios_date: "05/05/2011"
- description: Typical output of HP iLO_facts for a physical system
hw_bios_version: "P68"
code: |
hw_eth0:
- hw_bios_date: "05/05/2011"
- macaddress: "00:11:22:33:44:55"
hw_bios_version: "P68"
macaddress_dash: "00-11-22-33-44-55"
hw_eth0:
hw_eth1:
- macaddress: "00:11:22:33:44:55"
- macaddress: "00:11:22:33:44:57"
macaddress_dash: "00-11-22-33-44-55"
macaddress_dash: "00-11-22-33-44-57"
hw_eth1:
hw_eth2:
- macaddress: "00:11:22:33:44:57"
- macaddress: "00:11:22:33:44:5A"
macaddress_dash: "00-11-22-33-44-57"
macaddress_dash: "00-11-22-33-44-5A"
hw_eth2:
hw_eth3:
- macaddress: "00:11:22:33:44:5A"
- macaddress: "00:11:22:33:44:5C"
macaddress_dash: "00-11-22-33-44-5A"
macaddress_dash: "00-11-22-33-44-5C"
hw_eth3:
hw_eth_ilo:
- macaddress: "00:11:22:33:44:5C"
- macaddress: "00:11:22:33:44:BA"
macaddress_dash: "00-11-22-33-44-5C"
macaddress_dash: "00-11-22-33-44-BA"
hw_eth_ilo:
hw_product_name: "ProLiant DL360 G7"
- macaddress: "00:11:22:33:44:BA"
hw_product_uuid: "ef50bac8-2845-40ff-81d9-675315501dac"
macaddress_dash: "00-11-22-33-44-BA"
hw_system_serial: "ABC12345D6"
hw_product_name: "ProLiant DL360 G7"
hw_uuid: "123456ABC78901D2"
hw_product_uuid: "ef50bac8-2845-40ff-81d9-675315501dac"
hw_system_serial: "ABC12345D6"
hw_uuid: "123456ABC78901D2"
notes:
notes:
- This module ought to be run from a system that can access the HP iLO
- This module ought to be run from a system that can access the HP iLO
interface directly, either by using
C(local_action)
or
interface directly, either by using
local_action
or
C(using delegate)
_to.
using delegate
_to.
'''
'''
import
sys
import
sys
...
@@ -92,7 +86,7 @@ except ImportError:
...
@@ -92,7 +86,7 @@ except ImportError:
print
"failed=True msg='hpilo python module unavailable'"
print
"failed=True msg='hpilo python module unavailable'"
sys
.
exit
(
1
)
sys
.
exit
(
1
)
#
##
Surpress warnings from hpilo
# Surpress warnings from hpilo
warnings
.
simplefilter
(
'ignore'
)
warnings
.
simplefilter
(
'ignore'
)
def
main
():
def
main
():
...
@@ -102,27 +96,15 @@ def main():
...
@@ -102,27 +96,15 @@ def main():
host
=
dict
(
required
=
True
),
host
=
dict
(
required
=
True
),
login
=
dict
(
default
=
'Administrator'
),
login
=
dict
(
default
=
'Administrator'
),
password
=
dict
(
default
=
'admin'
),
password
=
dict
(
default
=
'admin'
),
match
=
dict
(
default
=
None
),
)
)
)
)
host
=
module
.
params
.
get
(
'host'
)
host
=
module
.
params
.
get
(
'host'
)
login
=
module
.
params
.
get
(
'login'
)
login
=
module
.
params
.
get
(
'login'
)
password
=
module
.
params
.
get
(
'password'
)
password
=
module
.
params
.
get
(
'password'
)
match
=
module
.
params
.
get
(
'match'
)
ilo
=
hpilo
.
Ilo
(
host
,
login
=
login
,
password
=
password
)
ilo
=
hpilo
.
Ilo
(
host
,
login
=
login
,
password
=
password
)
# If match=string is provided, only reboot server if iLO name matches 'string'
if
match
!=
None
:
try
:
server_name
=
ilo
.
get_server_name
()
except
Exception
,
e
:
module
.
fail_json
(
rc
=
1
,
msg
=
'Failed to connect to
%
s:
%
s'
%
(
host
,
e
.
message
))
if
not
server_name
.
lower
()
.
startswith
(
match
.
lower
()):
module
.
fail_json
(
rc
=
1
,
msg
=
'The iLO server name
\'
%
s
\'
does not match
\'
%
s
\'
'
%
(
server_name
,
match
))
# TODO: Count number of CPUs, DIMMs and total memory
# TODO: Count number of CPUs, DIMMs and total memory
data
=
ilo
.
get_host_data
()
data
=
ilo
.
get_host_data
()
facts
=
{
facts
=
{
...
@@ -135,7 +117,7 @@ def main():
...
@@ -135,7 +117,7 @@ def main():
facts
[
'hw_bios_date'
]
=
entry
[
'Date'
]
facts
[
'hw_bios_date'
]
=
entry
[
'Date'
]
elif
entry
[
'type'
]
==
1
:
# System Information
elif
entry
[
'type'
]
==
1
:
# System Information
facts
[
'hw_uuid'
]
=
entry
[
'UUID'
]
facts
[
'hw_uuid'
]
=
entry
[
'UUID'
]
facts
[
'hw_system_serial'
]
=
entry
[
'Serial Number'
]
facts
[
'hw_system_serial'
]
=
entry
[
'Serial Number'
]
.
rstrip
()
facts
[
'hw_product_name'
]
=
entry
[
'Product Name'
]
facts
[
'hw_product_name'
]
=
entry
[
'Product Name'
]
facts
[
'hw_product_uuid'
]
=
entry
[
'cUUID'
]
facts
[
'hw_product_uuid'
]
=
entry
[
'cUUID'
]
elif
entry
[
'type'
]
==
209
:
# Embedded NIC MAC Assignment
elif
entry
[
'type'
]
==
209
:
# Embedded NIC MAC Assignment
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment