CMDB与自动化部署的联动

无论是chef、ansible等自动化部署工具,还是市场上的一些商用自动化部署平台都可以在运维中与CMDB联动:

  • 自动化部署工作通常是通过部署在被管理机上的agent进行,所以通过agent可以获取主机的配置数据,当然具体的自动化部署软件的不同,获取的配置数据是不同的(文章最后是通过ansible获取centos6.5的配置数据文件),这些数据可以被取出发送到CMDB库中进行更新。
  • 自动化部署工作在部署之前需要获取主机列表、操作系统版本及补丁情况、应用软件、应用端口。。。等,只有符合部署条件的主机才能进行部署工作,这些检查工作可以借助CMDB的数据进行,检查结束后进行部署,部署完毕后,将部署的内容对CMDB的相关内容进行更新,以保证CMDB的准确性。

通过ansible获取的centos6.5的配置信息文件:
CentOS6.5-1 | SUCCESS => {
"ansible_facts": {
"ansible_all_ipv4_addresses": [
"10.1.1.76"
],
"ansible_all_ipv6_addresses": [
"fe80::250:56ff:feb6:c581"
],
"ansible_apparmor": {
"status": "disabled"
},
"ansible_architecture": "x86_64",
"ansible_bios_date": "07/03/2018",
"ansible_bios_version": "6.00",
"ansible_cmdline": {
"KEYBOARDTYPE": "pc",
"KEYTABLE": "us",
"LANG": "zh_CN.UTF-8",
"crashkernel": "128M",
"quiet": true,
"rd_LVM_LV": "VolGroup/lv_root",
"rd_NO_DM": true,
"rd_NO_LUKS": true,
"rd_NO_MD": true,
"rhgb": true,
"ro": true,
"root": "/dev/mapper/VolGroup-lv_root"
},
"ansible_date_time": {
"date": "2019-07-26",
"day": "26",
"epoch": "1564125003",
"hour": "15",
"iso8601": "2019-07-26T07:10:03Z",
"iso8601_basic": "20190726T151003742185",
"iso8601_basic_short": "20190726T151003",
"iso8601_micro": "2019-07-26T07:10:03.742355Z",
"minute": "10",
"month": "07",
"second": "03",
"time": "15:10:03",
"tz": "CST",
"tz_offset": "+0800",
"weekday": "星期五",
"weekday_number": "5",
"weeknumber": "29",
"year": "2019"
},
"ansible_default_ipv4": {
"address": "10.1.1.76", #IP地址
"alias": "eth0", #网卡eth0
"broadcast": "10.1.255.255",
"gateway": "10.1.1.1", #网关
"interface": "eth0",
"macaddress": "00:50:56:b6:c5:81", #MAC地址
"mtu": 1500,
"netmask": "255.255.0.0", #子网掩码
"network": "10.1.0.0", #网段
"type": "ether" #网卡类型
},
"ansible_default_ipv6": {},
"ansible_device_links": {
"ids": {
"dm-0": [
"dm-name-VolGroup-lv_root", #VolGroup 逻辑卷组 lv_root 逻辑卷
"dm-uuid-LVM-oYjEjhlM0ixGVg319svf9MCTH8g2a8fHd2GVtBmsxLem0Fi2FrBFZvcScTNM6u7O"
],
"dm-1": [
"dm-name-VolGroup-lv_swap", #lv_swap 逻辑卷
"dm-uuid-LVM-oYjEjhlM0ixGVg319svf9MCTH8g2a8fHoijUT8A3ZKYo2hfbeLZxxGjMqQT13HSA"
]
},
"labels": {},
"masters": {
"sda2": [ #dm-0和dm-1使用的sda2这个物理盘
"dm-0",
"dm-1"
]
},
"uuids": {
"dm-0": [
"0ecd4fa7-a6fd-49f3-ab4f-ff10acc426b0"
],
"dm-1": [
"e59f27d4-c1a5-47bb-ad49-e893448b8053"
],
"sda1": [
"37907382-32f8-444c-bb05-2b1c9c26e68d"
]
}
},
"ansible_devices": {
"dm-0": {
"holders": [],
"host": "",
"links": {
"ids": [
"dm-name-VolGroup-lv_root",
"dm-uuid-LVM-oYjEjhlM0ixGVg319svf9MCTH8g2a8fHd2GVtBmsxLem0Fi2FrBFZvcScTNM6u7O"
],
"labels": [],
"masters": [],
"uuids": [
"0ecd4fa7-a6fd-49f3-ab4f-ff10acc426b0"
]
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "74727424",
"sectorsize": "512",
"size": "35.63 GB", #逻辑卷的大小
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"dm-1": {
"holders": [],
"host": "",
"links": {
"ids": [
"dm-name-VolGroup-lv_swap",
"dm-uuid-LVM-oYjEjhlM0ixGVg319svf9MCTH8g2a8fHoijUT8A3ZKYo2hfbeLZxxGjMqQT13HSA"
],
"labels": [],
"masters": [],
"uuids": [
"e59f27d4-c1a5-47bb-ad49-e893448b8053"
]
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "8126464",
"sectorsize": "512",
"size": "3.88 GB", #逻辑卷的大小
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"loop0": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "0",
"sectorsize": "512",
"size": "0.00 Bytes",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"loop1": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "0",
"sectorsize": "512",
"size": "0.00 Bytes",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"loop2": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "0",
"sectorsize": "512",
"size": "0.00 Bytes",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"loop3": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "0",
"sectorsize": "512",
"size": "0.00 Bytes",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"loop4": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "0",
"sectorsize": "512",
"size": "0.00 Bytes",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"loop5": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "0",
"sectorsize": "512",
"size": "0.00 Bytes",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"loop6": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "0",
"sectorsize": "512",
"size": "0.00 Bytes",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"loop7": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "0",
"sectorsize": "512",
"size": "0.00 Bytes",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram0": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram1": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram10": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram11": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram12": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram13": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram14": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram15": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram2": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram3": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram4": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram5": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram6": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram7": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram8": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"ram9": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "32768",
"sectorsize": "512",
"size": "16.00 MB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"sda": { #硬盘
"holders": [],
"host": "SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)", #SCSI硬盘
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": "Virtual disk", #类型是虚拟硬盘
"partitions": { #磁盘分区
"sda1": { #磁盘分区sda1
"holders": [],
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": [
"37907382-32f8-444c-bb05-2b1c9c26e68d"
]
},
"sectors": "1024000",
"sectorsize": 512,
"size": "500.00 MB", #分区大小
"start": "2048",
"uuid": "37907382-32f8-444c-bb05-2b1c9c26e68d"
},
"sda2": { #磁盘分区sda2
"holders": [
"VolGroup-lv_root",
"VolGroup-lv_swap"
],
"links": {
"ids": [],
"labels": [],
"masters": [
"dm-0",
"dm-1"
],
"uuids": []
},
"sectors": "82860032",
"sectorsize": 512,
"size": "39.51 GB", #分区大小
"start": "1026048",
"uuid": null
}
},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "cfq",
"sectors": "83886080",
"sectorsize": "512",
"size": "40.00 GB", #sda磁盘整体大小
"support_discard": "0",
"vendor": "VMware",
"virtual": 1
},
"sr0": {
"holders": [],
"host": "IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": "VMware IDE CDR00",
"partitions": {},
"removable": "1",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "cfq",
"sectors": "2097151",
"sectorsize": "512",
"size": "1024.00 MB",
"support_discard": "0",
"vendor": "NECVMWar",
"virtual": 1
}
},
"ansible_distribution": "CentOS", #操作系统类型
"ansible_distribution_file_parsed": true,
"ansible_distribution_file_path": "/etc/redhat-release",
"ansible_distribution_file_variety": "RedHat",
"ansible_distribution_major_version": "6",
"ansible_distribution_release": "Final", #版本号
"ansible_distribution_version": "6.5", #版本号
"ansible_dns": {
"nameservers": [
"114.114.114.114", #DNS设置
"10.1.20.10"
]
},
"ansible_domain": "localdomain", #域名
"ansible_effective_group_id": 0,
"ansible_effective_user_id": 0,
"ansible_env": { #下面是系统的环境变量
"CVS_RSH": "ssh",
"G_BROKEN_FILENAMES": "1",
"HOME": "/root",
"LANG": "zh_CN.UTF-8",
"LESSOPEN": "|/usr/bin/lesspipe.sh %s",
"LOGNAME": "root",
"MAIL": "/var/mail/root",
"PATH": "/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin",
"PWD": "/root",
"QTDIR": "/usr/lib64/qt-3.3",
"QTINC": "/usr/lib64/qt-3.3/include",
"QTLIB": "/usr/lib64/qt-3.3/lib",
"SHELL": "/bin/bash",
"SHLVL": "2",
"SSH_ASKPASS": "/usr/libexec/openssh/gnome-ssh-askpass",
"SSH_CLIENT": "10.1.50.1 55018 22",
"SSH_CONNECTION": "10.1.50.1 55018 10.1.1.76 22",
"SSHTTY": "/dev/pts/1",
"TERM": "xterm-256color",
"USER": "root",
"
": "/usr/bin/python"
},
"ansible_eth0": { #网卡eth0
"active": true,
"device": "eth0",
"features": {
"generic_receive_offload": "off",
"generic_segmentation_offload": "on",
"large_receive_offload": "on",
"ntuple_filters": "off",
"receive_hashing": "on",
"rx_checksumming": "on",
"rx_vlan_offload": "on",
"scatter_gather": "on",
"tcp_segmentation_offload": "on",
"tx_checksumming": "on",
"tx_vlan_offload": "on",
"udp_fragmentation_offload": "off"
},
"hw_timestamp_filters": [],
"ipv4": {
"address": "10.1.1.76", #IP地址
"broadcast": "10.1.255.255",
"netmask": "255.255.0.0",
"network": "10.1.0.0"
},
"ipv6": [
{
"address": "fe80::250:56ff:feb6:c581",
"prefix": "64",
"scope": "link"
}
],
"macaddress": "00:50:56:b6:c5:81",
"module": "vmxnet3",
"mtu": 1500,
"pciid": "0000:03:00.0",
"promisc": false,
"speed": 10000, #网卡速率:千兆网卡
"timestamping": [
"rx_software",
"software"
],
"type": "ether" #以太网卡
},
"ansible_fips": false,
"ansible_form_factor": "Other",
"ansible_fqdn": "localhost.localdomain",
"ansible_hostname": "localhost",
"ansible_interfaces": [
"lo",
"eth0"
],
"ansible_is_chroot": false,
"ansible_iscsi_iqn": "",
"ansible_kernel": "2.6.32-431.el6.x86_64", #系统内核版本
"ansible_lo": {
"active": true,
"device": "lo",
"features": {
"generic_receive_offload": "off",
"generic_segmentation_offload": "on",
"large_receive_offload": "off",
"ntuple_filters": "off",
"receive_hashing": "off",
"rx_checksumming": "on",
"rx_vlan_offload": "off",
"scatter_gather": "on",
"tcp_segmentation_offload": "off",
"tx_checksumming": "on",
"tx_vlan_offload": "off",
"udp_fragmentation_offload": "off"
},
"hw_timestamp_filters": [],
"ipv4": {
"address": "127.0.0.1",
"broadcast": "host",
"netmask": "255.0.0.0",
"network": "127.0.0.0"
},
"ipv6": [
{
"address": "::1",
"prefix": "128",
"scope": "host"
}
],
"mtu": 16436,
"promisc": false,
"timestamping": [
"rx_software",
"software"
],
"type": "loopback"
},
"ansible_local": {},
"ansible_lsb": {
"codename": "Final",
"description": "CentOS release 6.5 (Final)", #操作系统版本
"id": "CentOS",
"major_release": "6",
"release": "6.5"
},
"ansible_lvm": {
"lvs": {
"lv_root": { #逻辑卷
"size_g": "35.63", #大小
"vg": "VolGroup" #属于那个卷组
},
"lv_swap": { #逻辑卷
"size_g": "3.88", #大小
"vg": "VolGroup" #属于那个卷组
}
},
"pvs": {
"/dev/sda2": { #物理磁盘分区sda2
"free_g": "0",
"size_g": "39.51", #大小
"vg": "VolGroup" #为那个卷组提供空间
}
},
"vgs": {
"VolGroup": { #逻辑卷组
"free_g": "0",
"num_lvs": "2",
"num_pvs": "1",
"size_g": "39.51" #大小
}
}
},
"ansible_machine": "x86_64",
"ansible_machine_id": "025b4a571952d9e659802a6f00000018",
"ansible_memfree_mb": 3231,
"ansible_memory_mb": {
"nocache": {
"free": 3585,
"used": 233
},
"real": {
"free": 3231,
"total": 3818,
"used": 587
},
"swap": {
"cached": 0,
"free": 3967,
"total": 3967,
"used": 0
}
},
"ansible_memtotal_mb": 3818,
"ansible_mounts": [ #文件系统挂载
{
"block_available": 7710786,
"block_size": 4096,
"block_total": 9194162,
"block_used": 1483376,
"device": "/dev/mapper/VolGroup-lv_root", #挂在那个设备上
"fstype": "ext4", #文件系统类型
"inode_available": 2230976,
"inode_total": 2338336,
"inode_used": 107360,
"mount": "/", #挂载点
"options": "rw",
"size_available": 31583379456,
"size_total": 37659287552, #文件系统大小
"uuid": "0ecd4fa7-a6fd-49f3-ab4f-ff10acc426b0"
},
{
"block_available": 430347,
"block_size": 1024,
"block_total": 495844,
"block_used": 65497,
"device": "/dev/sda1", #挂在那个设备上
"fstype": "ext4", #文件系统类型
"inode_available": 127977,
"inode_total": 128016,
"inode_used": 39,
"mount": "/boot", #挂载点
"options": "rw",
"size_available": 440675328,
"size_total": 507744256, #大小
"uuid": "37907382-32f8-444c-bb05-2b1c9c26e68d"
}
],
"ansible_nodename": "localhost.localdomain", #主机名
"ansible_os_family": "RedHat",
"ansible_pkg_mgr": "yum",
"ansible_processor": [ #运行虚拟机的CPU情况
"0",
"GenuineIntel",
"Intel(R) Xeon(R) CPU E5-2603 v3 @ 1.60GHz",
"1",
"GenuineIntel",
"Intel(R) Xeon(R) CPU E5-2603 v3 @ 1.60GHz",
"2",
"GenuineIntel",
"Intel(R) Xeon(R) CPU E5-2603 v3 @ 1.60GHz",
"3",
"GenuineIntel",
"Intel(R) Xeon(R) CPU E5-2603 v3 @ 1.60GHz"
],
"ansible_processor_cores": 4,
"ansible_processor_count": 1,
"ansible_processor_threads_per_core": 1,
"ansible_processor_vcpus": 4, #虚拟机是4vcpu
"ansible_product_name": "VMware Virtual Platform",
"ansible_product_serial": "VMware-42 36 8d 53 a0 37 9a 8f-e0 46 d1 36 f4 a7 30 02",
"ansible_product_uuid": "42368D53-A037-9A8F-E046-D136F4A73002",
"ansible_product_version": "None",
"ansible_python": {
"executable": "/usr/bin/python",
"has_sslcontext": false,
"type": "CPython",
"version": {
"major": 2,
"micro": 6,
"minor": 6,
"releaselevel": "final",
"serial": 0
},
"version_info": [
2,
6,
6,
"final",
0
]
},
"ansible_python_version": "2.6.6", #python版本
"ansible_real_group_id": 0,
"ansible_real_user_id": 0,
"ansible_selinux": {
"status": "disabled"
},
"ansible_selinux_python_present": true, #selinux设置
"ansible_service_mgr": "upstart",
"ansible_ssh_host_key_dsa_public": "AAAAB3NzaC1kc3MAAACBAKAQdjweEMgrY9Y4YBfBhVJfIfLfzC5AQ52xwQRNxDlK5NnElf0InAjL62s60B2uHZe9FuTyeC9Vre8dSkYlkEjnbIhmLiYpbbUr45L4Ua/WuGQLa/Yny0nuXVvVKX6QZ8P6Vdz+t5s+cj7F4z1dfoLD0X1pQwlZWyMBERmvYy1BAAAAFQCYJH/HLh3WLzGUaxq0tK3WYO0fKQAAAIAFaTLbN/DhfETHQxE53KAt2yOxj7WGP2W9WapO5iAvu1VrbQVdk5FvtErqL4XdHhXp11il59YsAqmZNwErGwOiWd7XKrypQaHHla1UMTP4I95jMzU9MoeFGa94Idc9oVAQ8mkowXsDi5B52VM0SNXDE1IOQx+zM7t78CC74ob6tQAAAIBBY00a0gSvVsBNEoVC2HVTAwxl+7Ps+rBGQKIVStRpKkJkcdp/2bu1HCu4q8VPQ584/UJdca/1QnrBluCS8kdXkvALhwofFCXAv/UjNLbid/BiAbRffMjfNw0SS8xs/yke//66PIVmpcXhd8gbV9K7NhETG3MRm0M6zXcPxcjpAQ==",
"ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAABIwAAAQEAtlRzXU4cBd+TT26Nz3UMLjat3K7p2pKU+gntWHHSY2oX7KaX58Gl8y9OgEOicL9dqh7Y5fn/YEiEX/A/x4ZAgCveZBX9Qf259xVIw52FmPgszIRc8ymFhBxEbJDfTKKn2jNb+0SzzNseaPhCJUcNRej+FCnDuRKLZYexipQDVFHJBkON0NWg0VKTZpNgDyPbSsYg0Gf2EGhZi+g/snV0Q8Q3n9kI9dHK9xCdS4cBYM8acZoOJP/ybi1dwUZd62lf8bKItACkW0AvL7CpHXfPIL7s8uz88zkJBmHXmLSiTbwH1cZoP5kT1TG5JqN34aFiWvlkpw11s/6gDdd3S7PKmQ==",
"ansible_swapfree_mb": 3967,
"ansible_swaptotal_mb": 3967,
"ansible_system": "Linux",
"ansible_system_capabilities": [],
"ansible_system_capabilities_enforced": "False",
"ansible_system_vendor": "VMware, Inc.", #机器的提供商
"ansible_uptime_seconds": 851823,
"ansible_user_dir": "/root",
"ansible_user_gecos": "root",
"ansible_user_gid": 0,
"ansible_user_id": "root",
"ansible_user_shell": "/bin/bash",
"ansible_user_uid": 0,
"ansible_userspace_architecture": "x86_64",
"ansible_userspace_bits": "64",
"ansible_virtualization_role": "guest",
"ansible_virtualization_type": "VMware",
"gather_subset": [
"all"
],
"module_setup": true
},
"changed": false
}

原文地址:https://blog.51cto.com/031028/2425291

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


----name:setpublickeyonremotehosts&setreomtehostssudoersfilehosts:all#此脚本要求所有的主机root用户密码相同become:noremote_user:rootvars:-remoteuser:user1:rhcetasks:-name:setsecondarygroupforrhce
环境准备#cat/etcedhat-releaseCentOSLinuxrelease7.9.2009(Core)#pythonPython3.7.11(default,Jul312022,16:12:35)[GCC4.8.520150623(RedHat4.8.5-44)]onlinuxType"help","copyright","credits"or"li
准备好环境,在安装之前请先了解openshift提供的ansible有大量的安装选项文档地址:https://docs.okd.io/latest/install/configuring_inventory_file.html1、配置/etc/ansible/hosts 
Ansible:运维工作:系统安装(物理机、虚拟机)-->程序包安装、配置、服务启动-->批量操作-->程序发布-->监控OSProvisioning:物理机:PXE、Cobbler虚拟机:ImageTemplatesConfigration:puppet(ruby)saltstack(python)chefcfengineCommandand
ansible与salt对比相同都是为了同时在多台机器上执行相同的命令都是python开发不同agent(saltstack需要安装、ansible不需要)配置(salt配置麻烦,ansible基本不用配置)学习路线(salt比较陡峭,ansible比较平缓)第三方工具(salt比较少)开源社区的对接(salt比较少)现有用户(salt还是an
[root@node1playbook]#catnginx.yml-hosts:test\\主机组,要和nginx.yml在同一个目录下remote_user:root\\远端执行任务的用户tasks:\\任务-name:installhttpd\\任务描述command:yum-yinstallhttpd\\调用ansible的command模块安装httpd-na
一直不知道这个模块到底在哪,并且也挺想搞清楚官方那些模块到底在哪个目录下。1.使用grep-rl"copy.py"/usr/lib/python2.7/site-packages/ansible(这个目录是专门放ansible源码目录的)然后找到是/usr/lib/python2.7/site-packages/ansible/modules/files/copy.py这个文件,这里需要
ansile作为去除安装agent的自动化工具,通过ssh协议的简单功能强大的自动化工作。在ansile使用的过程中,有三种用途1、ansible自行一次性任务,即执行命令如:ansible10.59.87.11-mping*ansible"dev-hdp"-mcopy-a"src=oot/HfHadoopHiveUdf.jardest=/data1/opt/cloudera/par
ansible-playbook(1) Ansible组成部分InventoryModulesAdHocCommandsplaybooksplaybooks:Tasks:任务,即调用的模块完成的某操作variables:变量Templates:模版Roles:角色 基本结构:-host:webserverremote_user:tasks:
报错:[root@jenkins~]#ansiblego_activity-mcron-a"name='log_clear'minute=0hour=2job=find/home/golanger/log/-typef-name'log$(date+\%d-d-1day)'-delete"ERROR!thistask'cron'hasextraparams,wh
一、测试环境说明1、系统:rhel6.92、ip地址:20.20.20.24/2420.20.20.41/2420.20.20.42/243、以下操作使用root身份进行,也可以使用具有sudo权限的用户进行相关操作二、环境准备1、关闭iptables防火墙、selinux#/etc/init.d/iptablesstop#
ansible常用模块安装:依赖于epel源yuminstallansible-y配置文件:/etc/ansible/ansible.cfgInvertoory:/etc/ansible/hosts 如何查看模块帮助:ansible-doc-lansible-doc-sMODULE_NAME` ansible命令应用基础:语法:ansible<host-pattern>[options]-fforks
copycopy模块是将ansible管理主机上的文件拷贝上远程主机中,与fetch相反,如果目标路径不存在,则自动创建,如果src的目录带“/”则复制该目录下的所有东西,如果src的目录不带“/”则连同该目录一起复制到目标路径;常用模块src参数:用于指定需要copy的文件或目录
9.YAML9.1简介(1)YAML是一个可读性高的用来表达资料序列的格式。(2)YAML参考了其它多种语言。包括:XML、C语言、python、perl以及电子邮件格式的RFC2822等。ClarkEvans在2001年首次发表了这种语言。(3)YAML不是XML,在开发这种语言时,YAML的意思其实是:yetanothermarkuplanguage,9.2特性(1)YA
了解ansibleansible批量在远程主机上执行命令ansible主要是为了进行操作多个主机而进行的#!/bin/envpython文件中直接指向python文件#!/bin/base 指行脚本一.ansible第一步.下载epel源wget-O/etc/yum.repos.d/epel.repohttp://mirrors.aliyun.comepo/epel-7.repo
背景:在私有云环境下,遇到要开通某个项目,则需要快速的响应创建虚拟机,并且做一些基础的配置。为了提高效率以及减少手工犯错的概率,一般会采取ansible批量部署,但是使用ansible的前提是预先配置好免密。在密码一致的场景中,可以使用expect优化做免密的过程解决方案:1.
简单例子1:vars定义变量-hosts:allremote_user:rootvars:-package:nginx-service:nginx tasks:-name:installnginxpackage yum:name={{package}}state=latest-name:installconfigurationfileforhttpd copy:src=/etcginxginx
 ansible自动化运维工具的介绍      ansible结构特性:            模块化,调用特定的模块,完成特定的任务;        基于Python语言实现,由Paramiko、PyYAML和Jinja2三个关键模块;        部署简单,agentless        主从模
---恢复内容开始---Templates:模版 cat/etc/ansible/hosts  cattemplatesginx.conf.j2 -hosts:testremote_user:rootvars:-package:httpd-service:httpdtasks:-name:installnginxpackage yum:name={{package}}state=la
1、配置资源清单inventory文件[root@test1~]#cat>/etc/ansible/hosts<<EOF[k8s]192.168.0.92ansible_ssh_port=22ansible_ssh_user=k8sansible_ssh_pass='123'ansible_become_pass='123456'EOF解释:ansible_ssh_pass='123'