Ansible 插件 实现cmdb功能

53人阅读 评论(0) 收藏 举报
分类:

https://github.com/fboender/ansible-cmdb

https://github-production-release-asset-2e65be.s3.amazonaws.com/37154906/83249f88-1f18-11e8-8532-373669cb8301?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20180415%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20180415T092430Z&X-Amz-Expires=300&X-Amz-Signature=f81d5fc69fcbb0d154e3b17bf69f43453ce27cabda25a04f5ce4fe1ec300f424&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B filename%3Dansible-cmdb-1.26.1.tar.gz&response-content-type=application%2Foctet-stream

tar -xvf ansible-cmdb-1.26.1.tar.gz 
cd ansible-cmdb-1.26.1/
make install
ansible -m setup --tree out/ all
ansible-cmdb out/ > overview.html


mysql数据库安装		
yum install mariadb-server mariadb -y
systemctl enable mariadb
systemctl start mariadb 

将数据库导入数据	
ansible-cmdb -t sql out > cmdb.sql
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| ansiblecmdb        |
| jumpserver         |
| mysql              |
| performance_schema |
+--------------------+
5 rows in set (0.00 sec)

MariaDB [(none)]> use ansiblecmdb
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [ansiblecmdb]> show tables;
+-----------------------+
| Tables_in_ansiblecmdb |
+-----------------------+
| hosts                 |
+-----------------------+
1 row in set (0.00 sec)

MariaDB [ansiblecmdb]> select * from hosts;
+--------------+------------------------+--------------+---------+------------+--------+-----------------------+---------------+----------------+-----------+-----------+------------------------------------------+-------+------+------------+-----------+
| name         | fqdn                   | main_ip      | os_name | os_version | system | kernel                | arch_hardware | arch_userspace | virt_type | virt_role | cpu_type                                 | vcpus | ram  | disk_total | disk_free |
+--------------+------------------------+--------------+---------+------------+--------+-----------------------+---------------+----------------+-----------+-----------+------------------------------------------+-------+------+------------+-----------+
| 172.16.8.248 | devops-jenkins-node248 | 172.16.8.248 | CentOS  | 7.4.1708   | Linux  | 3.10.0-693.el7.x86_64 | x86_64        | x86_64         | VMware    | guest     | Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz |     1 |    1 |       12.5 |       1.7 |
| 172.16.8.50  | devops-docker-node50   | 172.16.8.50  | CentOS  | 7.4.1708   | Linux  | 3.10.0-693.el7.x86_64 | x86_64        | x86_64         | VMware    | guest     | Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz |     2 |  1.8 |       12.5 |       3.7 |
| 172.16.8.246 | devops-gitlab-node246  | 172.16.8.246 | CentOS  | 7.4.1708   | Linux  | 3.10.0-693.el7.x86_64 | x86_64        | x86_64         | VMware    | guest     | Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz |     1 |  1.8 |       12.5 |       3.6 |
| 172.16.8.119 | devops-saltstack-node2 | 172.16.8.119 | CentOS  | 7.4.1708   | Linux  | 3.10.0-693.el7.x86_64 | x86_64        | x86_64         | VMware    | guest     | Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz |     1 |    1 |       12.5 |       1.7 |
| 172.16.8.118 | devops-saltstack-node1 | 172.16.8.118 | CentOS  | 7.4.1708   | Linux  | 3.10.0-693.el7.x86_64 | x86_64        | x86_64         | VMware    | guest     | Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz |     1 |    1 |       12.5 |       2.3 |
+--------------+------------------------+--------------+---------+------------+--------+-----------------------+---------------+----------------+-----------+-----------+------------------------------------------+-------+------+------------+-----------+
5 rows in set (0.00 sec)


将数据写入CSV文件
ansible-cmdb -t csv out > cmdb.csv

查看评论

Python 项目实战_cmdb Day15

-
  • 1970年01月01日 08:00

ansible小结(五)Dynamic Inventory

Ansible Inventory实际上是包含静态Inventory和动态Inventory两部分,静态Inventory指的是在文件/etc/ansible/hosts中指定的主机和组,Dynami...
  • weiguang1017
  • weiguang1017
  • 2016-11-01 18:53:23
  • 776

监控CMDB等全面方式

1.监控源:从层次上来分,大致可以分为三层,业务应用层、中间件层、基础设施层业务应用层主要包括应用软件、企业消息总线等中间件层包括数据库、缓存、配置中心、等各种系统软件基础设施层主要有物理机、虚拟机、...
  • gnicky
  • gnicky
  • 2017-03-03 15:44:25
  • 1426

CMDB在自动化运维中的应用实践

  • 2015年05月14日 14:19
  • 2.29MB
  • 下载

Python之路【第二十二篇】CMDB项目

浅谈ITIL TIL即IT基础架构库(Information Technology Infrastructure Library, ITIL,信息技术基础架构库)由英国政府部门CCTA(Central...
  • xiangxizhishi
  • xiangxizhishi
  • 2017-12-19 11:52:44
  • 285

CMDB 基础概念

1.什么是CMDB CMDB即配置管理数据库,通过识别、控制、维护,检查企业的IT资源,从而高效控制与管理不断变化的IT基础架构与IT服务,并为其它流程,例如事故管理、问题管理、变更管理、发布管理等...
  • afandaafandaafanda
  • afandaafandaafanda
  • 2015-09-26 22:54:40
  • 4831

jenkins插件之Ansible Plugin

本文重点说下在pipeline下的配置: pipeline { agent { label 'master' } options { timestamps() } ...
  • weiguang1017
  • weiguang1017
  • 2018-01-16 16:23:00
  • 200

CMDBuild安装及webservice接口的获取

最近项目组之前一直使用的OneCMDB出现了问题,在增删改数据时异常的慢,于是考虑是否可以优化OneCMDB,由于本人水平有限,对OneCMDB进行代码级别的优化暂时还有点难度。于是就对现有的其他开源...
  • bruce_6
  • bruce_6
  • 2015-07-07 17:05:29
  • 4179

ITIL & CMDB学习简介

1.ITIL的概念   ITIL, Information Technology Infrastructure Library,信息技术基础设施库。ITIL是全球IT服务管理领域中得到最广泛认可的方法...
  • wangjianno2
  • wangjianno2
  • 2016-08-06 22:43:56
  • 1422

Ansible扩展总结

Ansible简介Ansible是由Python开发的一个运维工具,因为工作需要接触到Ansible,经常会集成一些东西到Ansible,所以对Ansible的了解越来越多。那Ansible到底是什么...
  • mx472756841
  • mx472756841
  • 2016-12-26 15:21:33
  • 1882
    个人资料
    持之以恒
    等级:
    访问量: 68万+
    积分: 9695
    排名: 2317
    最新评论