fboender / ansible-cmdb Goto Github PK
View Code? Open in Web Editor NEWGenerate host overview from ansible fact gathering output
License: GNU General Public License v3.0
Generate host overview from ansible fact gathering output
License: GNU General Public License v3.0
I have used the extend example according to your README.md and specified both directories out/ and out_cust/ when generating the output. But the custom (software) variables didn't show up in the overview.html.
I'm trying to add in cmdb overview Citrix xenserver, Citrix xenserver by default has mounted iso
/opt/xensource/packages/iso/XenCenter.iso
56M 56M 0 100% /var/xen/xc-install
in ansible facts gathered it shows under ansible_mounts as
{
"device": "/opt/xensource/packages/iso/XenCenter.iso",.
"fstype": "iso9660",.
"mount": "/var/xen/xc-install",.
"options": "ro,loop=/dev/loop0",.
"size_available": 0,.
"size_total": 53665792,.
"uuid": "NA"
},.
It's not the only one mount point which has size_available 0.
Traceback (most recent call last):
File "/usr/local/bin/ansible-cmdb", line 134, in
sys.stdout.write(mytemplate.render(hosts=ansible.hosts))
File "/usr/lib/python2.7/site-packages/mako/template.py", line 443, in render
return runtime.render(self, self.callable, args, data)
File "/usr/lib/python2.7/site-packages/mako/runtime.py", line 783, in _render
**kwargs_for_callable(callable, data))
File "/usr/lib/python2.7/site-packages/mako/runtime.py", line 815, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/usr/lib/python2.7/site-packages/mako/runtime.py", line 841, in exec_template
callable(context, _args, *_kwargs)
File "_usr_local_lib_ansible_cmdb_html_fancy_tpl", line 184, in render_body
File "_usr_local_lib_ansible_cmdb_html_fancy_tpl", line 36, in col_disk_usage
File "_usr_local_lib_ansible_cmdb_html_fancy_tpl", line 607, in render_col_disk_usage
ZeroDivisionError: float division by zero
Dependencies on Ubuntu 12.02 are:
A variable REL_VERSION
has to be inserted into the Makefile with an arbitrary value?
Am I missing something?
It would be useful to have an automated testing and release setup so that the latest features can be tested more easily. I could help you set this up in Travis pretty easily.
The sorting arrows are not shown in the Host overview.
When hovering over the column headers of the html_fancy template's with the mouse, the cursor does not change. This makes it difficult to know that the headers can be clicked to sort the columns.
It would be nice to get info about vmware vm's even if they're powered off. I think this can be done through pyVmomi.
It would be helpful if the html_fancy template remembered which columns the user had enabled.
Both columns are sorted by ASCIIbetical order rather numerical order.
I have different servers with different RAM sizes and they are sorted in the following way.
1.0
15.7
2.0
31.6
4.0
8.0
Maybe alphanum can help? http://www.davekoelle.com/alphanum.html
I am getting the following error when trying to import all my hosts:
./ansible-cmdb test/ > overview.html
Traceback (most recent call last):
File "./ansible-cmdb", line 84, in
sys.stdout.write(mytemplate.render(hosts=ansible.hosts, **params))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 488629: ordinal not in range(128)
I tracked that down to an fstab definition containing the German umlaut "ü".
This is an example, the problem is in the "device" line.
{
"device": "//share/Prüfhinweise",
"fstype": "cifs",
"mount": "/home/pflegeanwendung/mounts/ake",
"options": "rw,relatime,vers=3.0,sec=ntlmssp,cache=strict,file_mode=0660,dir_mode=0770,nounix,mapposix,rsize=65536,wsize=65536,actimeo=1",
"size_available": 840464404480,
"size_total": 7696581394432,
"uuid": "NA"
},
Getting an error while trying to generate a report for any number of servers.
Same command is working on OSX without any issue.
ansible-cmdb -d out/
data_dir = /usr/lib/ansible-cmdb/ansiblecmdb/data
tpl_dir = /usr/lib/ansible-cmdb/ansiblecmdb/data/tpl
static_dir = /usr/lib/ansible-cmdb/ansiblecmdb/data/static
Parsing fact dir: out/
Reading host facts from out/test.server.com
template file = /usr/lib/ansible-cmdb/ansiblecmdb/data/tpl/html_fancy.tpl
Template params: {'lib_dir': '/usr/lib/ansible-cmdb/ansiblecmdb/data', 'version': '1.11', 'data_dir': '/usr/lib/ansible-cmdb/ansiblecmdb/data', 'log': <logging.RootLogger object at 0x2163210>, 'columns': None}
Rendering host overview for test.server.com
Traceback (most recent call last):
File "/usr/bin/ansible-cmdb", line 108, in <module>
out = mytemplate.render(hosts=ansible.hosts, **params)
File "/usr/lib/ansible-cmdb/mako/template.py", line 443, in render
return runtime._render(self, self.callable_, args, data)
File "/usr/lib/ansible-cmdb/mako/runtime.py", line 803, in _render
**_kwargs_for_callable(callable_, data))
File "/usr/lib/ansible-cmdb/mako/runtime.py", line 835, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/usr/lib/ansible-cmdb/mako/runtime.py", line 860, in _exec_template
callable_(context, *args, **kwargs)
File "/usr/lib/ansible-cmdb/ansiblecmdb/data/tpl/html_fancy.tpl", line 487, in render_body
<td>${col["func"](host)}</td>
File "/usr/lib/ansible-cmdb/ansiblecmdb/data/tpl/html_fancy.tpl", line 0, in col_mem_usage
File "/usr/lib/ansible-cmdb/ansiblecmdb/data/tpl/html_fancy.tpl", line 106, in render_col_mem_usage
<span style="display:none">${'%f' % (float(i["nocache"]["used"]) / i["real"]["total"])}</span>
TypeError: float() argument must be a string or a number
Whoops, it looks like something went wrong while rendering the template.
The reported error was: float() argument must be a string or a number
The output is probably not correct.
You can report a bug on the issue tracker:
https://github.com/fboender/ansible-cmdb/issues
Please include the debugging output (-d switch) in the report!
Additional infos
cat /etc/debian_version
7.9
ansible-cmdb --version
ansible-cmdb v1.11
ansible --version
ansible 2.1.0
configured module search path = library/
First, thanks for the awesome tool. I've been looking for a way to visualize my infrastructure for a while now. I love this idea.
On to the issue:
ansible allows "inventory" to point at a directory, it then parses all files in that directory to create the inventory list. As such, I've broken my hosts into a directory like so:
hosts/
hosts/development
hosts/test
hosts/staging
hosts/production
and in ansible.cfg, I have:
inventory = ./hosts
The problem is, ansible-cmdb doesn't allow me to specify -i as a directory, or multiple -i statements (one per file), thus the resulting html output is partial and incomplete.
feature request:
When you have hundreds of hosts in your inventory, the resulting overview gets really large.
There should be a possibility to collapse the host-information at the heading and maybe at the sub-headings, too.
There should be a setting to make the information auto-collapsed by default, maybe stored in a cookie or via cli-settings.
From the Ansible docs:
It is also possible to make groups of groups using the :children suffix. Just like above, you can apply variables using :vars:
http://docs.ansible.com/ansible/intro_inventory.html#groups-of-groups-and-group-variables
If a host belongs to a group of a group, this is currently not recognized.
You can try with this:
[group1]
localhost
[group_of_group:children]
group1
In this case, localhost
should belong to the groups group1
and group_of_groups
.
Got this error:
If you can, also include the hosts file and the facts file for the last host
that rendered properly ('Rendering host...' in the output. If these files must
remain confidential, you can send them to [email protected] instead.
(a2)➜ acmdb ansible-cmdb -d out/ > overview.html
data_dir = /usr/local/Cellar/ansible-cmdb/1.13/ansiblecmdb/data
tpl_dir = /usr/local/Cellar/ansible-cmdb/1.13/ansiblecmdb/data/tpl
static_dir = /usr/local/Cellar/ansible-cmdb/1.13/ansiblecmdb/data/static
Parsing fact dir: out/
Reading host facts from out/dcs.dc.drivescale.com
DELETED
Reading host facts from out/u40.r2.dc.drivescale.com
template file = /usr/local/Cellar/ansible-cmdb/1.13/ansiblecmdb/data/tpl/html_fancy.tpl
Template params: {'lib_dir': '/usr/local/Cellar/ansible-cmdb/1.13/ansiblecmdb/data', 'version': '1.13', 'data_dir': '/usr/local/Cellar/ansible-cmdb/1.13/ansiblecmdb/data', 'log': <logging.RootLogger object at 0x107a4ad50>, 'columns': None}
Rendering host overview for u14.r3.hq.drivescale.com
DELETED
Rendering host overview for u14s2x.r2.dc.drivescale.com
Traceback (most recent call last):
File "/usr/local/bin/ansible-cmdb", line 108, in <module>
out = mytemplate.render(hosts=ansible.hosts, **params)
File "/usr/local/Cellar/ansible-cmdb/1.13/mako/template.py", line 443, in render
return runtime._render(self, self.callable_, args, data)
File "/usr/local/Cellar/ansible-cmdb/1.13/mako/runtime.py", line 803, in _render
**_kwargs_for_callable(callable_, data))
File "/usr/local/Cellar/ansible-cmdb/1.13/mako/runtime.py", line 835, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/usr/local/Cellar/ansible-cmdb/1.13/mako/runtime.py", line 860, in _exec_template
callable_(context, *args, **kwargs)
File "/usr/local/Cellar/ansible-cmdb/1.13/ansiblecmdb/data/tpl/html_fancy.tpl", line 522, in render_body
<td>${col["func"](host)}</td>
File "/usr/local/Cellar/ansible-cmdb/1.13/ansiblecmdb/data/tpl/html_fancy.tpl", line 0, in col_cpu_type
File "/usr/local/Cellar/ansible-cmdb/1.13/ansiblecmdb/data/tpl/html_fancy.tpl", line 92, in render_col_cpu_type
${ cpu_type[-1] }
IndexError: list index out of range
Whoops, it looks like something went wrong while rendering the template.
The reported error was: list index out of range
I'm getting this error with the latest code from the repo. This is the first time I've tried generating a report for this data and, from the error, I can't tell what's causing this issue. I'm getting a similar error with yesterday's code, which also says "Error parsing: hosts: No JSON object could be decoded" before the traceback.
Traceback (most recent call last):
File "/usr/local/bin/ansible-cmdb", line 310, in <module>
sys.stdout.write(mytemplate.render(hosts=ansible.hosts, **params))
File "/usr/lib64/python2.6/site-packages/mako/template.py", line 443, in render
return runtime._render(self, self.callable_, args, data)
File "/usr/lib64/python2.6/site-packages/mako/runtime.py", line 803, in _render
**_kwargs_for_callable(callable_, data))
File "/usr/lib64/python2.6/site-packages/mako/runtime.py", line 835, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/usr/lib64/python2.6/site-packages/mako/runtime.py", line 860, in _exec_template
callable_(context, *args, **kwargs)
File "_usr_local_lib_ansible_cmdb_html_fancy_tpl", line 139, in render_body
File "_usr_local_lib_ansible_cmdb_html_fancy_tpl", line 39, in col_mem
File "_usr_local_lib_ansible_cmdb_html_fancy_tpl", line 313, in render_col_mem
TypeError: unsupported operand type(s) for /: 'unicode' and 'float'
I was hoping to use ansible-cmdb to get a visualization of my corporate environment, with the custom variables we use. However, when I try and use ansible-cmdb with our /etc/ansible/hosts inventory file, it bombs out pretty spectacularly.
$ wc -l /etc/ansible/hosts
1673 /etc/ansible/hosts
$ ansible-cmdb out/ -i /etc/ansible/hosts > cmdb.html
Traceback (most recent call last):
File "/usr/bin/ansible-cmdb", line 454, in
ansible = Ansible(args, options.inventory, options.fact_cache, debug=options.debug)
File "/usr/bin/ansible-cmdb", line 352, in init
self.parse_hosts_inventory(self.hosts_path)
File "/usr/bin/ansible-cmdb", line 373, in parse_hosts_inventory
hosts_parser = AnsibleHostsParser(hosts_contents)
File "/usr/bin/ansible-cmdb", line 66, in init
for hostname in self.get_distinct_hostnames():
File "/usr/bin/ansible-cmdb", line 206, in get_distinct_hostnames
hostnames.extend(self.group_get_hostnames(section['name']))
File "/usr/bin/ansible-cmdb", line 271, in group_get_hostnames
hostnames.extend(self.expand_hostdef(entry['name']))
File "/usr/bin/ansible-cmdb", line 314, in expand_hostdef
start, end = pattern.split(':')
ValueError: too many values to unpack
Any help on this would be appreciated. Thanks.
hosts with ip aliases shown like separate hosts,
for example, one host with four aliases will shown 4 times, but is has the same main ip and fqdn.
I have facter installed on most of my servers, and have a custom/local facter fact executable as well.
Ansible's setup module calls facter, and the resulting output of ansible -m setup includes my facter info with my custom fact.
In the out directory I create prior to invoking ansible-cmdb, the JSON in the files there includes both the standard and my custom facter_ facts.
AFAICT, ansible-cmdb isn't displaying these facts.
What can change/modify in order to include one/some/all of these additional facts?
a)
$ ansible --version
ansible 2.0.0.2
$ ansible-cmdb --version
ansible-cmdb v1.11
List of hosts:
$ ansible -i hosts all --list-hosts
hosts (3):
client01.example.com
client02.example.com
opensuse.example.com
b)
$ ansible-cmdb -d -i hosts cmdb/ > cmdb.html
data_dir = /usr/lib/ansible-cmdb/ansiblecmdb/data
tpl_dir = /usr/lib/ansible-cmdb/ansiblecmdb/data/tpl
static_dir = /usr/lib/ansible-cmdb/ansiblecmdb/data/static
Parsing fact dir: cmdb/
Reading host facts from cmdb/client02.example.com
Reading host facts from cmdb/opensuse.example.com
Reading host facts from cmdb/client01.example.com
Parsing host vars (dir): hosts
template file = /usr/lib/ansible-cmdb/ansiblecmdb/data/tpl/html_fancy.tpl
Template params: {'lib_dir': '/usr/lib/ansible-cmdb/ansiblecmdb/data', 'version': '1.11', 'data_dir': '/usr/lib/ansible-cmdb/ansiblecmdb/data', 'log': <logging.RootLogger object at 0x7f114ab72250>, 'columns': None}
Rendering host overview for opensuse.example.com
Rendering host overview for client02.example.com
Rendering host overview for client01.example.com
Traceback (most recent call last):
File "/usr/bin/ansible-cmdb", line 108, in
out = mytemplate.render(hosts=ansible.hosts, *_params)
File "/usr/lib/ansible-cmdb/mako/template.py", line 443, in render
return runtime.render(self, self.callable, args, data)
File "/usr/lib/ansible-cmdb/mako/runtime.py", line 803, in _render
*_kwargs_for_callable(callable, data))
File "/usr/lib/ansible-cmdb/mako/runtime.py", line 835, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/usr/lib/ansible-cmdb/mako/runtime.py", line 860, in exec_template
callable(context, _args, *_kwargs)
File "/usr/lib/ansible-cmdb/ansiblecmdb/data/tpl/html_fancy.tpl", line 487, in render_body
${col"func"}
File "/usr/lib/ansible-cmdb/ansiblecmdb/data/tpl/html_fancy.tpl", line 0, in col_dtap
File "/usr/lib/ansible-cmdb/ansiblecmdb/data/tpl/html_fancy.tpl", line 44, in render_col_dtap
${host['hostvars'].get('dtap', '')}
AttributeError: 'NoneType' object has no attribute 'get'
Whoops, it looks like something went wrong while rendering the template.
The reported error was: 'NoneType' object has no attribute 'get'
The output is probably not correct.
You can report a bug on the issue tracker:
https://github.com/fboender/ansible-cmdb/issues
Please include the debugging output (-d switch) in the report!
/data/ansible$
The Makefile does not have an install
target.
Hi,
It would be great if it would be possible to add the search terms to the URL. Example: https://cmdb/?search=xen%20x86_64
Bonus: have a URL clipboard copier at the side of the search box to get the URL with search terms.
Reference: http://papermashup.com/read-url-get-variables-withjavascript/
OpenBSD hosts are missing the following information:
Host overview
Host details: Network
When hosting the generated output on an internal system, access to internet resources like datatables.net or jquery ist not always possible or preferred.
The resources should be included in the program itself or there should be a option to use the resources locally.
Using this inventory file
Specifically the variable on line 84
openshift_master_identity_providers=[{'name': 'my_ldap_provider', 'challenge': 'true', 'login': 'true', 'kind': 'LDAPPasswordIdentityProvider', 'attributes': {'id': ['dn'], 'email': ['mail'], 'name': ['cn'], 'preferredUsername': ['uid']}, 'bindDN': '', 'bindPassword': '', 'ca': '', 'insecure': 'true', 'url': 'ldap://ldap.example.com:389/ou=people,o=example.com?uid'}]
And running like this
ansible-cmdb --inventory=hosts-test --debug -f fact-cache/ > cmdb/overview2.html
Produces this error
ansible-cmdb --inventory=hosts-test --debug -f fact-cache/ > cmdb/overview2.html
/usr/lib/python2.6/site-packages/pygments/plugin.py:39: UserWarning: Module mako was already imported from /usr/lib/ansible-cmdb/mako/__init__.py, but /usr/lib/python2.6/site-packages is being added to sys.path
import pkg_resources
data_dir = /usr/lib/ansible-cmdb/ansiblecmdb/data
tpl_dir = /usr/lib/ansible-cmdb/ansiblecmdb/data/tpl
static_dir = /usr/lib/ansible-cmdb/ansiblecmdb/data/static
Parsing fact dir: fact-cache/
Reading host facts from fact-cache/ose-ha-etcd-02.example.com
Reading host facts from fact-cache/ose-ha-master-03.example.com
Reading host facts from fact-cache/ose-ha-etcd-03.example.com
Reading host facts from fact-cache/ose-master-01.example.com
Reading host facts from fact-cache/ose-ha-node-06.example.com
Reading host facts from fact-cache/ose-ha-node-01.example.com
Reading host facts from fact-cache/ose-ha-node-03.example.com
Reading host facts from fact-cache/ose-node-02.example.com
Reading host facts from fact-cache/ose-ha-node-04.example.com
Reading host facts from fact-cache/ose-node-03.example.com
Reading host facts from fact-cache/ose-ha-etcd-01.example.com
Reading host facts from fact-cache/ose-ha-lb-01.example.com
Reading host facts from fact-cache/ose-ha-node-02.example.com
Reading host facts from fact-cache/ose-ha-node-05.example.com
Reading host facts from fact-cache/ose-node-01.example.com
Reading host facts from fact-cache/ose-ha-master-02.example.com
Reading host facts from fact-cache/ose-ha-master-01.example.com
Traceback (most recent call last):
File "/usr/bin/ansible-cmdb", line 82, in <module>
ansible = ansiblecmdb.Ansible(args, options.inventory, options.fact_cache, debug=options.debug)
File "/usr/lib/ansible-cmdb/ansiblecmdb/ansible.py", line 39, in __init__
self._handle_inventory(self.inventory_path)
File "/usr/lib/ansible-cmdb/ansiblecmdb/ansible.py", line 58, in _handle_inventory
self._parse_hosts_inventory(inventory_path)
File "/usr/lib/ansible-cmdb/ansiblecmdb/ansible.py", line 85, in _parse_hosts_inventory
hosts_parser = parser.HostsParser(hosts_contents)
File "/usr/lib/ansible-cmdb/ansiblecmdb/parser.py", line 44, in __init__
"Invalid hosts file?\n".format(str(e)))
ValueError: zero length field name in format
Hosts that are not in a group cause an error like this:
Traceback (most recent call last):
File "/usr/local/bin/ansible-cmdb", line 301, in <module>
ansible = Ansible(args, options.inventory)
File "/usr/local/bin/ansible-cmdb", line 29, in __init__
self.parse_hosts(self.hosts_file)
File "/usr/local/bin/ansible-cmdb", line 94, in parse_hosts
raw_groups[cur_group_type].setdefault(cur_group_name, []).append(line)
KeyError: None
How memory usage is measured?
One graph shows ( 7.6 / 9.8GiB ) but I type:
$ free -m
total used free shared buffers cached
That would be 364MB free.
I have a pretty large dynamic inventory file in JSON that contains lots of groups and variables.
When I added that to ansible-cmdb via the -i option, I get the following error:
Reading host facts from out/u40.r2.dc.drivescale.com
Traceback (most recent call last):
File "/usr/local/bin/ansible-cmdb", line 96, in <module>
ansible = ansiblecmdb.Ansible(args, options.inventory, options.fact_cache, debug=options.debug)
File "/usr/local/lib/ansible-cmdb/ansiblecmdb/ansible.py", line 39, in __init__
self._handle_inventory(self.inventory_path)
File "/usr/local/lib/ansible-cmdb/ansiblecmdb/ansible.py", line 62, in _handle_inventory
self._handle_inventory(os.path.join(inventory_path, fname))
File "/usr/local/lib/ansible-cmdb/ansiblecmdb/ansible.py", line 55, in _handle_inventory
self._parse_dyn_inventory(inventory_path)
File "/usr/local/lib/ansible-cmdb/ansiblecmdb/ansible.py", line 168, in _parse_dyn_inventory
dyninv_parser = parser.DynInvParser(stdout.decode('utf8'))
File "/usr/local/lib/ansible-cmdb/ansiblecmdb/parser.py", line 381, in __init__
self._parse_group(k, v)
File "/usr/local/lib/ansible-cmdb/ansiblecmdb/parser.py", line 404, in _parse_group
self._get_host(hostname)['hostvars'][var_key] = var_val
UnboundLocalError: local variable 'hostname' referenced before assignment
I will email you the file it was processing when this occurred.
It is entirely possible that the way I generate my dynamic inventory is causing this problem, although Ansible has been happily using it for months.
Exception thrown after put some chinese characters as host comment in my hosts file :
ansible-cmdb -i /home/ansible/hosts -d out/ > index.html
data_dir = /usr/lib/ansible-cmdb/ansiblecmdb/data
tpl_dir = /usr/lib/ansible-cmdb/ansiblecmdb/data/tpl
static_dir = /usr/lib/ansible-cmdb/ansiblecmdb/data/static
Params
------------------------------------------------------------
{'columns': None,
'data_dir': '/usr/lib/ansible-cmdb/ansiblecmdb/data',
'lib_dir': '/usr/lib/ansible-cmdb/ansiblecmdb/data',
'local_js': '1',
'version': '1.9'}
Hosts
------------------------------------------------------------
Traceback (most recent call last):
File "/usr/bin/ansible-cmdb", line 91, in <module>
sys.stdout.write(mytemplate.render(hosts=ansible.hosts, **params).encode('utf-8'))
File "/usr/lib/ansible-cmdb/mako/template.py", line 443, in render
return runtime._render(self, self.callable_, args, data)
File "/usr/lib/ansible-cmdb/mako/runtime.py", line 803, in _render
**_kwargs_for_callable(callable_, data))
File "/usr/lib/ansible-cmdb/mako/runtime.py", line 835, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/usr/lib/ansible-cmdb/mako/runtime.py", line 860, in _exec_template
callable_(context, *args, **kwargs)
File "_usr_lib_ansible_cmdb_ansiblecmdb_data_tpl_html_fancy_tpl", line 212, in render_body
File "_usr_lib_ansible_cmdb_ansiblecmdb_data_tpl_html_fancy_tpl", line 50, in col_comment
File "_usr_lib_ansible_cmdb_ansiblecmdb_data_tpl_html_fancy_tpl", line 650, in render_col_comment
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 0: ordinal not in range(128)
I have a new error when trying to render a new report with the current trunk code:
Traceback (most recent call last):
File "/usr/local/bin/ansible-cmdb", line 315, in <module>
sys.stdout.write(mytemplate.render(hosts=ansible.hosts, **params))
File "/usr/lib64/python2.6/site-packages/mako/template.py", line 443, in render
return runtime._render(self, self.callable_, args, data)
File "/usr/lib64/python2.6/site-packages/mako/runtime.py", line 803, in _render
**_kwargs_for_callable(callable_, data))
File "/usr/lib64/python2.6/site-packages/mako/runtime.py", line 835, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/usr/lib64/python2.6/site-packages/mako/runtime.py", line 860, in _exec_template
callable_(context, *args, **kwargs)
File "_usr_local_lib_ansible_cmdb_html_fancy_tpl", line 139, in render_body
File "_usr_local_lib_ansible_cmdb_html_fancy_tpl", line 35, in col_disk_usage
File "_usr_local_lib_ansible_cmdb_html_fancy_tpl", line 461, in render_col_disk_usage
KeyError: 'size_total'
When I grep the size_total values from the facts files, I don't see any issues other than a couple of hosts with values of zero. Let me know what info you may need to troubleshoot this issue.
Hi Ferry!
when trying to build a release with the Makefile, the git clean -i -d -x -f
fails because of missing -i
in my git version (1.7.9.5).
git -i
is interactive mode. Is this needed when building a release? I think make should run automatically.
Example output of a dynamic inventory script. Where IMAP is a group name, ipaddr a host variable and virt16.example.com a host.
{
"IMAP": {
"hosts": [
"virt16.example.com"
]
},
"_meta": {
"hostvars": {
"virt16.dte3.netsol.com": {
"ipaddr": "1.1.1.1"
}
}
}
}
If you have groups of groups, it will throw an error.
[haproxy:children]
lb
[lb:children]
lb-prod
lb-dev
[lb-prod]
lb1-prod
lb2-prod
[lb-dev]
lb1-dev
lb2-dev
when running ansible-cmdb with the -i flag, it will error on the haproxy:children section, with:
$ ansible-cmdb -i hosts/default out/ > output.html
Traceback (most recent call last):
File "/usr/bin/ansible-cmdb", line 290, in
ansible = Ansible(args, options.inventory)
File "/usr/bin/ansible-cmdb", line 29, in init
self.parse_hosts(self.hosts_file)
File "/usr/bin/ansible-cmdb", line 110, in parse_hosts
for hostname in normal_groups[apply_group_name]:
KeyError: 'lb'
Template that outputs CSV
The search box currently shows a "star" icon to the right of the search box. It can be used to link directly to the search results. However, the star icon does not properly convey this. It should be replaced by a link icon. The best way would be to include it directly as data in the stylesheet.
I guess, right now two templates exist, the fancy html template and the txt_table.
I think the different templates should be mentioned in the readme and maybe also in the cli-help.
Just noting this in case anyone else gets this issue.
If you are running on a MAC and have a .DS_STORE file in the output folder you will get the following error:
UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 3131: invalid start byte
The solution is to delete these files first.
Maybe ansible-cmdb could have an option to ignore files such as dotfiles.
Or maybe use http://asepsis.binaryage.com/ to stop creating them? - Not tried it yet but might be the solution?
thanks
You can specify hosts in the hosts-file the following way:
[test-hosts]
host[01:02]
See here for more info: http://docs.ansible.com/ansible/intro_inventory.html
In the generated overview, this host-pattern is not interpreted but instead shown as a single host (in red color), which does not exist.
Hey,
I started to use ansible-cmdb and I like what I see so far :)
There is one small error in the documentation, where you describe the how to install the rpm package on rhel/centos, the right should look like this:
sudo yum install ansible-cmdb*.rpm
I'm not quite sure if it's a good idea to just ignore partitions that are smaller than 1GB. Or, even worse, have < 1GB space left!
What was the intention behind the decision for that? Before I submit a PR to change that I'd like to understand why it is that way. :)
ansible-cmdb should check the ansible configuration to figure out the location of the default inventory path.
We chose to break our inventory out into multiple files as it's easier to manage and we can use a simple script that aggregates and builds lists from multiple sources.
Thus my ansible inventory is made up of approximately 60+ ini style files in a dir. When I pass that dir to -i, groups seems to only be populated with a single group that a given host is a member of, instead of all of them.
If i concatenate all of my inventory files into a single file, it works just fine with ansible-cmdb.
yum install ansible-cmdb*.rpm
Transaction check error:
file / from install of ansible-cmdb-1.2-2.noarch conflicts with file from package filesystem-2.4.30-3.8.amzn1.x86_64
file /usr/bin from install of ansible-cmdb-1.2-2.noarch conflicts with file from package filesystem-2.4.30-3.8.amzn1.x86_64
file /usr/lib from install of ansible-cmdb-1.2-2.noarch conflicts with file from package filesystem-2.4.30-3.8.amzn1.x86_64
Xenserver 6.5 inventory ansible_interfaces:
"ansible_interfaces": [
"eth0",.
"eth3",.
"lo",.
"ovs-system",.
"eth2",.
"vif1.0",.
"eth1",.
"xenbr5",.
"xenbr4",.
"eth5",.
"eth4",.
"xenbr1",.
"xenbr0",.
"xenbr3",.
"xenbr2"
],.
$ ansible-cmdb out/ > cmdb/overview.html
Traceback (most recent call last):
File "/usr/local/bin/ansible-cmdb", line 134, in
sys.stdout.write(mytemplate.render(hosts=ansible.hosts))
File "/usr/lib/python2.7/site-packages/mako/template.py", line 443, in render
return runtime.render(self, self.callable, args, data)
File "/usr/lib/python2.7/site-packages/mako/runtime.py", line 783, in _render
**kwargs_for_callable(callable, data))
File "/usr/lib/python2.7/site-packages/mako/runtime.py", line 815, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/usr/lib/python2.7/site-packages/mako/runtime.py", line 841, in exec_template
callable(context, _args, *_kwargs)
File "_usr_local_lib_ansible_cmdb_html_fancy_tpl", line 335, in render_body
KeyError: u'ansible_ovs-system'
if i remove ovs-system ansible-cmdb works
Running ansible-cmdb reports/ >report.html
results in the following error here:
$ ansible all_managed -m setup --tree reports/ >/dev/null
$ ansible-cmdb reports/ >report.html
Traceback (most recent call last):
File "/usr/local/bin/ansible-cmdb", line 632, in <module>
sys.stdout.write(mytemplate.render(hosts=ansible.hosts, **params))
File "/usr/local/Cellar/ansible-cmdb/1.6/mako/template.py", line 443, in render
return runtime._render(self, self.callable_, args, data)
File "/usr/local/Cellar/ansible-cmdb/1.6/mako/runtime.py", line 803, in _render
**_kwargs_for_callable(callable_, data))
File "/usr/local/Cellar/ansible-cmdb/1.6/mako/runtime.py", line 835, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/usr/local/Cellar/ansible-cmdb/1.6/mako/runtime.py", line 860, in _exec_template
callable_(context, *args, **kwargs)
File "_usr_local_Cellar_ansible_cmdb_1_6_html_fancy_tpl", line 277, in render_body
File "_usr_local_Cellar_ansible_cmdb_1_6_html_fancy_tpl", line 30, in r_dict
File "_usr_local_Cellar_ansible_cmdb_1_6_html_fancy_tpl", line 526, in render_r_dict
AttributeError: 'list' object has no attribute 'items'
make: *** [report.html] Error 1
How can I help to debug this?
Add a manual page
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.