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
f8104df4
Commit
f8104df4
authored
Aug 28, 2014
by
Daniel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected VM metadata obtention between Abiquo versions
parent
984d5512
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
4 deletions
+34
-4
plugins/inventory/abiquo.ini
+28
-3
plugins/inventory/abiquo.py
+6
-1
No files found.
plugins/inventory/abiquo.ini
View file @
f8104df4
# Ansible external inventory script settings for Abiquo
#
# Define an Abiquo user with access to Abiquo API which will be used to
# perform required queries to obtain infromation to generate the Ansible
# inventory output.
#
[auth]
apiuser
=
admin
apipass
=
xabiquo
# Specify Abiquo API version in major.minor format and the access URI to
# API endpoint. Tested versions are: 2.6 , 3.0 and 3.1
# To confirm that your box haves access to Abiquo API you can perform a
# curl command, replacing with suitable values, similar to this:
# curl -X GET https://192.168.2.100/api/login -u admin:xabiquo
#
[api]
uri
=
http://192.168.2.211:80/api
version
=
3.0
uri
=
https://192.168.2.100/api
# You probably won't need to modify login preferences, but just in case
login_path
=
/login
login_type
=
application/vnd.abiquo.user+json
# To avoid performing excessive calls to Abiquo API you can define a
# cache for the plugin output. Within the time defined in seconds, latest
# output will be reused. After that time, the cache will be refreshed.
#
[cache]
cache_max_age
=
30
cache_dir
=
/var/tmp
cache_dir
=
/tmp
[defaults]
# Depending in your Abiquo environment, you may want to use only public IP
# addresses (if using public cloud providers) or also private IP addresses.
# You can set this with public_ip_only configuration.
public_ip_only
=
false
# default_net_interface only is used if public_ip_only = false
# If public_ip_only is set to false, you can choose default nic to obtain
# IP address to define the host.
default_net_interface
=
nic0
# Only deployed VM are
added to output
# Only deployed VM are
displayed in the plugin output.
deployed_only
=
true
# Define if VM metadata is obtained from Abiquo API.
get_metadata
=
false
plugins/inventory/abiquo.py
View file @
f8104df4
...
...
@@ -167,7 +167,12 @@ def generate_inv_from_api(enterprise_entity,config):
meta_entity
=
next
(
link
for
link
in
(
vmcollection
[
'links'
])
if
(
link
[
'rel'
]
==
'metadata'
))
try
:
metadata
=
api_get
(
meta_entity
,
config
)
inventory
[
'_meta'
][
'hostvars'
][
vm_nic
]
=
metadata
[
'metadata'
][
'metadata'
]
if
(
config
.
getfloat
(
"api"
,
"version"
)
>=
3.0
):
vm_metadata
=
metadata
[
'metadata'
]
else
:
vm_metadata
=
metadata
[
'metadata'
][
'metadata'
]
if
not
vm_metadata
is
None
:
inventory
[
'_meta'
][
'hostvars'
][
vm_nic
]
=
vm_metadata
except
Exception
,
e
:
pass
...
...
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