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
68d45122
Commit
68d45122
authored
Feb 09, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10175 from funzoneq/devel
Make collins attributes more accessible
parents
01d3dc2e
cc4c7012
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
plugins/inventory/collins.py
+7
-3
No files found.
plugins/inventory/collins.py
View file @
68d45122
...
@@ -41,7 +41,9 @@ that will be used instead of the configured values if they are set:
...
@@ -41,7 +41,9 @@ that will be used instead of the configured values if they are set:
If errors are encountered during operation, this script will return an exit code of
If errors are encountered during operation, this script will return an exit code of
255; otherwise, it will return an exit code of 0.
255; otherwise, it will return an exit code of 0.
Tested against Ansible 1.6.6 and Collins 1.2.4.
Collins attributes are accessable as variables in ansible via the COLLINS['attribute_name'].
Tested against Ansible 1.8.2 and Collins 1.3.0.
"""
"""
# (c) 2014, Steve Salevan <steve.salevan@gmail.com>
# (c) 2014, Steve Salevan <steve.salevan@gmail.com>
...
@@ -305,6 +307,8 @@ class CollinsInventory(object):
...
@@ -305,6 +307,8 @@ class CollinsInventory(object):
else
:
else
:
ip_index
=
self
.
ip_address_index
ip_index
=
self
.
ip_address_index
asset
[
'COLLINS'
]
=
{}
# Attempts to locate the asset's primary identifier (hostname or IP address),
# Attempts to locate the asset's primary identifier (hostname or IP address),
# which will be used to index the asset throughout the Ansible inventory.
# which will be used to index the asset throughout the Ansible inventory.
if
self
.
prefer_hostnames
and
self
.
_asset_has_attribute
(
asset
,
'HOSTNAME'
):
if
self
.
prefer_hostnames
and
self
.
_asset_has_attribute
(
asset
,
'HOSTNAME'
):
...
@@ -332,8 +336,8 @@ class CollinsInventory(object):
...
@@ -332,8 +336,8 @@ class CollinsInventory(object):
if
'ATTRIBS'
in
asset
:
if
'ATTRIBS'
in
asset
:
for
attrib_block
in
asset
[
'ATTRIBS'
]
.
keys
():
for
attrib_block
in
asset
[
'ATTRIBS'
]
.
keys
():
for
attrib
in
asset
[
'ATTRIBS'
][
attrib_block
]
.
keys
():
for
attrib
in
asset
[
'ATTRIBS'
][
attrib_block
]
.
keys
():
a
ttrib_key
=
self
.
to_safe
(
a
sset
[
'COLLINS'
][
attrib
]
=
asset
[
'ATTRIBS'
][
attrib_block
][
attrib
]
'
%
s-
%
s'
%
(
attrib
,
asset
[
'ATTRIBS'
][
attrib_block
][
attrib
]))
attrib_key
=
self
.
to_safe
(
'
%
s-
%
s'
%
(
attrib
,
asset
[
'ATTRIBS'
][
attrib_block
][
attrib
]))
self
.
push
(
self
.
inventory
,
attrib_key
,
asset_identifier
)
self
.
push
(
self
.
inventory
,
attrib_key
,
asset_identifier
)
# Indexes asset by all built-in Collins attributes.
# Indexes asset by all built-in Collins attributes.
...
...
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