Use Ansible-cmdb to count host configuration information and display it on a Web page

Source: Internet
Author: User



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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.