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
cc4c7012
Commit
cc4c7012
authored
Feb 06, 2015
by
Arnoud Vermeer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make a COLLINS['SOMETHING'] variable instead of ATTRIBS['0']['SOMETHING']
parent
8f06ba2b
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 @
cc4c7012
...
...
@@ -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
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>
...
...
@@ -305,6 +307,8 @@ class CollinsInventory(object):
else
:
ip_index
=
self
.
ip_address_index
asset
[
'COLLINS'
]
=
{}
# Attempts to locate the asset's primary identifier (hostname or IP address),
# which will be used to index the asset throughout the Ansible inventory.
if
self
.
prefer_hostnames
and
self
.
_asset_has_attribute
(
asset
,
'HOSTNAME'
):
...
...
@@ -332,8 +336,8 @@ class CollinsInventory(object):
if
'ATTRIBS'
in
asset
:
for
attrib_block
in
asset
[
'ATTRIBS'
]
.
keys
():
for
attrib
in
asset
[
'ATTRIBS'
][
attrib_block
]
.
keys
():
a
ttrib_key
=
self
.
to_safe
(
'
%
s-
%
s'
%
(
attrib
,
asset
[
'ATTRIBS'
][
attrib_block
][
attrib
]))
a
sset
[
'COLLINS'
][
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
)
# 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