First, the demand
Online machine more, before using Excel statistics once, with ansible batch execution script, and then according to the display information, hand input to Excel, efficiency can imagine. Other departments to view the host information, not the first time to provide, so, just think, can be displayed in a static page, placed in the Apache Htdoc directory. After finding a ansible-cmdb, it is good to solve the problem!
Second, ansible Configuration management database
Ansible-cmdb will collect the output and convert it to a static HTML overview page containing system configuration information, which supports multiple templates (HTML, txt_table, CSV, JSON output, markdown) and extended information through custom data collection, For each host display group, host variable, find the basis.
Third, step together
1. Installation
# RPM-IVH ansible-cmdb-1.12-2.noarch.rpm
2. Generate output file for host
#mkdir out#ansible-m Setup--tree out/all
3. Generate CMDB Overview page
Ansible-cmdb-i/etc/ansible/hosts out/> overview.html
Note that this/etc/ansible/hosts, in fact, you can customize, like mine, is differentiated by business, such as
[cust.megacorp]
db1.dev.megacorp.com dtap=dev comment="Old database server"
db2.dev.megacorp.com dtap=dev comment="New database server"
test.megacorp.com dtap=test
acc.megacorp.com dtap=acc comment="24/7 support"
megacorp.com dtap=prod comment="Hosting by Foo" ext_id="SRV_10029"
[os.redhat]
megacorp.com
acc.megacorp.com
test.megacorp.com
db2.dev.megacorp.com
[os.debian]
db1.dev.megacorp.com
4, put the overview.html under Apache HTODC directory
# SCP./overview.html/usr/local/apache2/htdocs/zabbix/
Here, in the 3rd step, scheduled crontab to perform the task
5. Page display
6, interested, can download the original code to see
This article is from the "Scattered People" blog, please be sure to keep this source http://zouqingyun.blog.51cto.com/782246/1750827
Use Ansible-cmdb to count host configuration information and display it on a Web page