|
|
|
@ -0,0 +1,740 @@
|
|
|
|
|
<h1><center>Ansible之Setup模块</center></h1>
|
|
|
|
|
|
|
|
|
|
------
|
|
|
|
|
|
|
|
|
|
**作者:行癫(盗版必究)**
|
|
|
|
|
|
|
|
|
|
## 一:所有参数
|
|
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
10.0.0.111 | SUCCESS => {
|
|
|
|
|
"ansible_facts": {
|
|
|
|
|
"ansible_all_ipv4_addresses": [
|
|
|
|
|
"10.0.0.111"
|
|
|
|
|
],
|
|
|
|
|
"ansible_all_ipv6_addresses": [
|
|
|
|
|
"fe80::a1d7:aadb:3ae3:bbb9"
|
|
|
|
|
],
|
|
|
|
|
"ansible_apparmor": {
|
|
|
|
|
"status": "disabled"
|
|
|
|
|
},
|
|
|
|
|
"ansible_architecture": "x86_64",
|
|
|
|
|
"ansible_bios_date": "11/12/2020",
|
|
|
|
|
"ansible_bios_version": "6.00",
|
|
|
|
|
"ansible_cmdline": {
|
|
|
|
|
"BOOT_IMAGE": "/vmlinuz-3.10.0-693.el7.x86_64",
|
|
|
|
|
"LANG": "en_US.UTF-8",
|
|
|
|
|
"quiet": true,
|
|
|
|
|
"rd.lvm.lv": "centos/root",
|
|
|
|
|
"rhgb": true,
|
|
|
|
|
"ro": true,
|
|
|
|
|
"root": "/dev/mapper/centos-root"
|
|
|
|
|
},
|
|
|
|
|
"ansible_date_time": {
|
|
|
|
|
"date": "2023-03-02",
|
|
|
|
|
"day": "02",
|
|
|
|
|
"epoch": "1677768313",
|
|
|
|
|
"hour": "22",
|
|
|
|
|
"iso8601": "2023-03-02T14:45:13Z",
|
|
|
|
|
"iso8601_basic": "20230302T224513178165",
|
|
|
|
|
"iso8601_basic_short": "20230302T224513",
|
|
|
|
|
"iso8601_micro": "2023-03-02T14:45:13.178165Z",
|
|
|
|
|
"minute": "45",
|
|
|
|
|
"month": "03",
|
|
|
|
|
"second": "13",
|
|
|
|
|
"time": "22:45:13",
|
|
|
|
|
"tz": "CST",
|
|
|
|
|
"tz_offset": "+0800",
|
|
|
|
|
"weekday": "Thursday",
|
|
|
|
|
"weekday_number": "4",
|
|
|
|
|
"weeknumber": "09",
|
|
|
|
|
"year": "2023"
|
|
|
|
|
},
|
|
|
|
|
"ansible_default_ipv4": {
|
|
|
|
|
"address": "10.0.0.111",
|
|
|
|
|
"alias": "ens33",
|
|
|
|
|
"broadcast": "10.0.0.255",
|
|
|
|
|
"gateway": "10.0.0.2",
|
|
|
|
|
"interface": "ens33",
|
|
|
|
|
"macaddress": "00:0c:29:0d:1c:29",
|
|
|
|
|
"mtu": 1500,
|
|
|
|
|
"netmask": "255.255.255.0",
|
|
|
|
|
"network": "10.0.0.0",
|
|
|
|
|
"type": "ether"
|
|
|
|
|
},
|
|
|
|
|
"ansible_default_ipv6": {},
|
|
|
|
|
"ansible_device_links": {
|
|
|
|
|
"ids": {
|
|
|
|
|
"dm-0": [
|
|
|
|
|
"dm-name-centos-root",
|
|
|
|
|
"dm-uuid-LVM-jtnKDeIbgg03hClVGR4QFsF0xdtxSolvn3Yfi9VBej4wXITukpJCMpFT914kP7cH"
|
|
|
|
|
],
|
|
|
|
|
"sda2": [
|
|
|
|
|
"lvm-pv-uuid-vWNEKk-udkQ-vl1K-YJck-9KMY-D13P-eAoAnR"
|
|
|
|
|
],
|
|
|
|
|
"sr0": [
|
|
|
|
|
"ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"labels": {
|
|
|
|
|
"sr0": [
|
|
|
|
|
"CentOS\\x207\\x20x86_64"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"masters": {
|
|
|
|
|
"sda2": [
|
|
|
|
|
"dm-0"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"uuids": {
|
|
|
|
|
"dm-0": [
|
|
|
|
|
"d0261be2-3486-4ff1-8563-8360393cfeb4"
|
|
|
|
|
],
|
|
|
|
|
"sda1": [
|
|
|
|
|
"bdfa051f-b5a8-4713-9bee-440b49233372"
|
|
|
|
|
],
|
|
|
|
|
"sr0": [
|
|
|
|
|
"2017-09-05-14-14-50-00"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"ansible_devices": {
|
|
|
|
|
"dm-0": {
|
|
|
|
|
"holders": [],
|
|
|
|
|
"host": "",
|
|
|
|
|
"links": {
|
|
|
|
|
"ids": [
|
|
|
|
|
"dm-name-centos-root",
|
|
|
|
|
"dm-uuid-LVM-jtnKDeIbgg03hClVGR4QFsF0xdtxSolvn3Yfi9VBej4wXITukpJCMpFT914kP7cH"
|
|
|
|
|
],
|
|
|
|
|
"labels": [],
|
|
|
|
|
"masters": [],
|
|
|
|
|
"uuids": [
|
|
|
|
|
"d0261be2-3486-4ff1-8563-8360393cfeb4"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"model": null,
|
|
|
|
|
"partitions": {},
|
|
|
|
|
"removable": "0",
|
|
|
|
|
"rotational": "1",
|
|
|
|
|
"sas_address": null,
|
|
|
|
|
"sas_device_handle": null,
|
|
|
|
|
"scheduler_mode": "",
|
|
|
|
|
"sectors": "82853888",
|
|
|
|
|
"sectorsize": "512",
|
|
|
|
|
"size": "39.51 GB",
|
|
|
|
|
"support_discard": "0",
|
|
|
|
|
"vendor": null,
|
|
|
|
|
"virtual": 1
|
|
|
|
|
},
|
|
|
|
|
"sda": {
|
|
|
|
|
"holders": [],
|
|
|
|
|
"host": "",
|
|
|
|
|
"links": {
|
|
|
|
|
"ids": [],
|
|
|
|
|
"labels": [],
|
|
|
|
|
"masters": [],
|
|
|
|
|
"uuids": []
|
|
|
|
|
},
|
|
|
|
|
"model": "VMware Virtual S",
|
|
|
|
|
"partitions": {
|
|
|
|
|
"sda1": {
|
|
|
|
|
"holders": [],
|
|
|
|
|
"links": {
|
|
|
|
|
"ids": [],
|
|
|
|
|
"labels": [],
|
|
|
|
|
"masters": [],
|
|
|
|
|
"uuids": [
|
|
|
|
|
"bdfa051f-b5a8-4713-9bee-440b49233372"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"sectors": "1024000",
|
|
|
|
|
"sectorsize": 512,
|
|
|
|
|
"size": "500.00 MB",
|
|
|
|
|
"start": "2048",
|
|
|
|
|
"uuid": "bdfa051f-b5a8-4713-9bee-440b49233372"
|
|
|
|
|
},
|
|
|
|
|
"sda2": {
|
|
|
|
|
"holders": [
|
|
|
|
|
"centos-root"
|
|
|
|
|
],
|
|
|
|
|
"links": {
|
|
|
|
|
"ids": [
|
|
|
|
|
"lvm-pv-uuid-vWNEKk-udkQ-vl1K-YJck-9KMY-D13P-eAoAnR"
|
|
|
|
|
],
|
|
|
|
|
"labels": [],
|
|
|
|
|
"masters": [
|
|
|
|
|
"dm-0"
|
|
|
|
|
],
|
|
|
|
|
"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": "deadline",
|
|
|
|
|
"sectors": "83886080",
|
|
|
|
|
"sectorsize": "512",
|
|
|
|
|
"size": "40.00 GB",
|
|
|
|
|
"support_discard": "0",
|
|
|
|
|
"vendor": "VMware,",
|
|
|
|
|
"virtual": 1
|
|
|
|
|
},
|
|
|
|
|
"sr0": {
|
|
|
|
|
"holders": [],
|
|
|
|
|
"host": "",
|
|
|
|
|
"links": {
|
|
|
|
|
"ids": [
|
|
|
|
|
"ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001"
|
|
|
|
|
],
|
|
|
|
|
"labels": [
|
|
|
|
|
"CentOS\\x207\\x20x86_64"
|
|
|
|
|
],
|
|
|
|
|
"masters": [],
|
|
|
|
|
"uuids": [
|
|
|
|
|
"2017-09-05-14-14-50-00"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"model": "VMware IDE CDR10",
|
|
|
|
|
"partitions": {},
|
|
|
|
|
"removable": "1",
|
|
|
|
|
"rotational": "1",
|
|
|
|
|
"sas_address": null,
|
|
|
|
|
"sas_device_handle": null,
|
|
|
|
|
"scheduler_mode": "cfq",
|
|
|
|
|
"sectors": "1622016",
|
|
|
|
|
"sectorsize": "2048",
|
|
|
|
|
"size": "792.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": "7",
|
|
|
|
|
"ansible_distribution_release": "Core",
|
|
|
|
|
"ansible_distribution_version": "7.4",
|
|
|
|
|
"ansible_dns": {
|
|
|
|
|
"nameservers": [
|
|
|
|
|
"10.0.0.2"
|
|
|
|
|
],
|
|
|
|
|
"search": [
|
|
|
|
|
"localdomain"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"ansible_domain": "",
|
|
|
|
|
"ansible_effective_group_id": 0,
|
|
|
|
|
"ansible_effective_user_id": 0,
|
|
|
|
|
"ansible_ens33": {
|
|
|
|
|
"active": true,
|
|
|
|
|
"device": "ens33",
|
|
|
|
|
"features": {
|
|
|
|
|
"busy_poll": "off [fixed]",
|
|
|
|
|
"fcoe_mtu": "off [fixed]",
|
|
|
|
|
"generic_receive_offload": "on",
|
|
|
|
|
"generic_segmentation_offload": "on",
|
|
|
|
|
"highdma": "off [fixed]",
|
|
|
|
|
"hw_tc_offload": "off [fixed]",
|
|
|
|
|
"l2_fwd_offload": "off [fixed]",
|
|
|
|
|
"large_receive_offload": "off [fixed]",
|
|
|
|
|
"loopback": "off [fixed]",
|
|
|
|
|
"netns_local": "off [fixed]",
|
|
|
|
|
"ntuple_filters": "off [fixed]",
|
|
|
|
|
"receive_hashing": "off [fixed]",
|
|
|
|
|
"rx_all": "off",
|
|
|
|
|
"rx_checksumming": "off",
|
|
|
|
|
"rx_fcs": "off",
|
|
|
|
|
"rx_vlan_filter": "on [fixed]",
|
|
|
|
|
"rx_vlan_offload": "on",
|
|
|
|
|
"rx_vlan_stag_filter": "off [fixed]",
|
|
|
|
|
"rx_vlan_stag_hw_parse": "off [fixed]",
|
|
|
|
|
"scatter_gather": "on",
|
|
|
|
|
"tcp_segmentation_offload": "on",
|
|
|
|
|
"tx_checksum_fcoe_crc": "off [fixed]",
|
|
|
|
|
"tx_checksum_ip_generic": "on",
|
|
|
|
|
"tx_checksum_ipv4": "off [fixed]",
|
|
|
|
|
"tx_checksum_ipv6": "off [fixed]",
|
|
|
|
|
"tx_checksum_sctp": "off [fixed]",
|
|
|
|
|
"tx_checksumming": "on",
|
|
|
|
|
"tx_fcoe_segmentation": "off [fixed]",
|
|
|
|
|
"tx_gre_csum_segmentation": "off [fixed]",
|
|
|
|
|
"tx_gre_segmentation": "off [fixed]",
|
|
|
|
|
"tx_gso_partial": "off [fixed]",
|
|
|
|
|
"tx_gso_robust": "off [fixed]",
|
|
|
|
|
"tx_ipip_segmentation": "off [fixed]",
|
|
|
|
|
"tx_lockless": "off [fixed]",
|
|
|
|
|
"tx_mpls_segmentation": "off [fixed]",
|
|
|
|
|
"tx_nocache_copy": "off",
|
|
|
|
|
"tx_scatter_gather": "on",
|
|
|
|
|
"tx_scatter_gather_fraglist": "off [fixed]",
|
|
|
|
|
"tx_sctp_segmentation": "off [fixed]",
|
|
|
|
|
"tx_sit_segmentation": "off [fixed]",
|
|
|
|
|
"tx_tcp6_segmentation": "off [fixed]",
|
|
|
|
|
"tx_tcp_ecn_segmentation": "off [fixed]",
|
|
|
|
|
"tx_tcp_mangleid_segmentation": "off",
|
|
|
|
|
"tx_tcp_segmentation": "on",
|
|
|
|
|
"tx_udp_tnl_csum_segmentation": "off [fixed]",
|
|
|
|
|
"tx_udp_tnl_segmentation": "off [fixed]",
|
|
|
|
|
"tx_vlan_offload": "on [fixed]",
|
|
|
|
|
"tx_vlan_stag_hw_insert": "off [fixed]",
|
|
|
|
|
"udp_fragmentation_offload": "off [fixed]",
|
|
|
|
|
"vlan_challenged": "off [fixed]"
|
|
|
|
|
},
|
|
|
|
|
"hw_timestamp_filters": [],
|
|
|
|
|
"ipv4": {
|
|
|
|
|
"address": "10.0.0.111",
|
|
|
|
|
"broadcast": "10.0.0.255",
|
|
|
|
|
"netmask": "255.255.255.0",
|
|
|
|
|
"network": "10.0.0.0"
|
|
|
|
|
},
|
|
|
|
|
"ipv6": [
|
|
|
|
|
{
|
|
|
|
|
"address": "fe80::a1d7:aadb:3ae3:bbb9",
|
|
|
|
|
"prefix": "64",
|
|
|
|
|
"scope": "link"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"macaddress": "00:0c:29:0d:1c:29",
|
|
|
|
|
"module": "e1000",
|
|
|
|
|
"mtu": 1500,
|
|
|
|
|
"pciid": "0000:02:01.0",
|
|
|
|
|
"promisc": false,
|
|
|
|
|
"speed": 1000,
|
|
|
|
|
"timestamping": [
|
|
|
|
|
"tx_software",
|
|
|
|
|
"rx_software",
|
|
|
|
|
"software"
|
|
|
|
|
],
|
|
|
|
|
"type": "ether"
|
|
|
|
|
},
|
|
|
|
|
"ansible_env": {
|
|
|
|
|
"HOME": "/root",
|
|
|
|
|
"LANG": "en_US.UTF-8",
|
|
|
|
|
"LESSOPEN": "||/usr/bin/lesspipe.sh %s",
|
|
|
|
|
"LOGNAME": "root",
|
|
|
|
|
"LS_COLORS": "rs=0:di=38;5;27:ln=38;5;51:mh=44;38;5;15:pi=40;38;5;11:so=38;5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;9:mi=05;48;5;232;38;5;15:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:ex=38;5;34:*.tar=38;5;9:*.tgz=38;5;9:*.arc=38;5;9:*.arj=38;5;9:*.taz=38;5;9:*.lha=38;5;9:*.lz4=38;5;9:*.lzh=38;5;9:*.lzma=38;5;9:*.tlz=38;5;9:*.txz=38;5;9:*.tzo=38;5;9:*.t7z=38;5;9:*.zip=38;5;9:*.z=38;5;9:*.Z=38;5;9:*.dz=38;5;9:*.gz=38;5;9:*.lrz=38;5;9:*.lz=38;5;9:*.lzo=38;5;9:*.xz=38;5;9:*.bz2=38;5;9:*.bz=38;5;9:*.tbz=38;5;9:*.tbz2=38;5;9:*.tz=38;5;9:*.deb=38;5;9:*.rpm=38;5;9:*.jar=38;5;9:*.war=38;5;9:*.ear=38;5;9:*.sar=38;5;9:*.rar=38;5;9:*.alz=38;5;9:*.ace=38;5;9:*.zoo=38;5;9:*.cpio=38;5;9:*.7z=38;5;9:*.rz=38;5;9:*.cab=38;5;9:*.jpg=38;5;13:*.jpeg=38;5;13:*.gif=38;5;13:*.bmp=38;5;13:*.pbm=38;5;13:*.pgm=38;5;13:*.ppm=38;5;13:*.tga=38;5;13:*.xbm=38;5;13:*.xpm=38;5;13:*.tif=38;5;13:*.tiff=38;5;13:*.png=38;5;13:*.svg=38;5;13:*.svgz=38;5;13:*.mng=38;5;13:*.pcx=38;5;13:*.mov=38;5;13:*.mpg=38;5;13:*.mpeg=38;5;13:*.m2v=38;5;13:*.mkv=38;5;13:*.webm=38;5;13:*.ogm=38;5;13:*.mp4=38;5;13:*.m4v=38;5;13:*.mp4v=38;5;13:*.vob=38;5;13:*.qt=38;5;13:*.nuv=38;5;13:*.wmv=38;5;13:*.asf=38;5;13:*.rm=38;5;13:*.rmvb=38;5;13:*.flc=38;5;13:*.avi=38;5;13:*.fli=38;5;13:*.flv=38;5;13:*.gl=38;5;13:*.dl=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.axv=38;5;13:*.anx=38;5;13:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.mid=38;5;45:*.midi=38;5;45:*.mka=38;5;45:*.mp3=38;5;45:*.mpc=38;5;45:*.ogg=38;5;45:*.ra=38;5;45:*.wav=38;5;45:*.axa=38;5;45:*.oga=38;5;45:*.spx=38;5;45:*.xspf=38;5;45:",
|
|
|
|
|
"MAIL": "/var/mail/root",
|
|
|
|
|
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin",
|
|
|
|
|
"PWD": "/root",
|
|
|
|
|
"SHELL": "/bin/bash",
|
|
|
|
|
"SHLVL": "2",
|
|
|
|
|
"SSH_CLIENT": "10.0.0.110 51406 22",
|
|
|
|
|
"SSH_CONNECTION": "10.0.0.110 51406 10.0.0.111 22",
|
|
|
|
|
"SSH_TTY": "/dev/pts/1",
|
|
|
|
|
"TERM": "xterm-256color",
|
|
|
|
|
"USER": "root",
|
|
|
|
|
"XDG_RUNTIME_DIR": "/run/user/0",
|
|
|
|
|
"XDG_SESSION_ID": "15",
|
|
|
|
|
"_": "/usr/bin/python"
|
|
|
|
|
},
|
|
|
|
|
"ansible_fibre_channel_wwn": [],
|
|
|
|
|
"ansible_fips": false,
|
|
|
|
|
"ansible_form_factor": "Other",
|
|
|
|
|
"ansible_fqdn": "xingdian",
|
|
|
|
|
"ansible_hostname": "xingdian",
|
|
|
|
|
"ansible_hostnqn": "",
|
|
|
|
|
"ansible_interfaces": [
|
|
|
|
|
"lo",
|
|
|
|
|
"ens33"
|
|
|
|
|
],
|
|
|
|
|
"ansible_is_chroot": false,
|
|
|
|
|
"ansible_iscsi_iqn": "",
|
|
|
|
|
"ansible_kernel": "3.10.0-693.el7.x86_64",
|
|
|
|
|
"ansible_kernel_version": "#1 SMP Tue Aug 22 21:09:27 UTC 2017",
|
|
|
|
|
"ansible_lo": {
|
|
|
|
|
"active": true,
|
|
|
|
|
"device": "lo",
|
|
|
|
|
"features": {
|
|
|
|
|
"busy_poll": "off [fixed]",
|
|
|
|
|
"fcoe_mtu": "off [fixed]",
|
|
|
|
|
"generic_receive_offload": "on",
|
|
|
|
|
"generic_segmentation_offload": "on",
|
|
|
|
|
"highdma": "on [fixed]",
|
|
|
|
|
"hw_tc_offload": "off [fixed]",
|
|
|
|
|
"l2_fwd_offload": "off [fixed]",
|
|
|
|
|
"large_receive_offload": "off [fixed]",
|
|
|
|
|
"loopback": "on [fixed]",
|
|
|
|
|
"netns_local": "on [fixed]",
|
|
|
|
|
"ntuple_filters": "off [fixed]",
|
|
|
|
|
"receive_hashing": "off [fixed]",
|
|
|
|
|
"rx_all": "off [fixed]",
|
|
|
|
|
"rx_checksumming": "on [fixed]",
|
|
|
|
|
"rx_fcs": "off [fixed]",
|
|
|
|
|
"rx_vlan_filter": "off [fixed]",
|
|
|
|
|
"rx_vlan_offload": "off [fixed]",
|
|
|
|
|
"rx_vlan_stag_filter": "off [fixed]",
|
|
|
|
|
"rx_vlan_stag_hw_parse": "off [fixed]",
|
|
|
|
|
"scatter_gather": "on",
|
|
|
|
|
"tcp_segmentation_offload": "on",
|
|
|
|
|
"tx_checksum_fcoe_crc": "off [fixed]",
|
|
|
|
|
"tx_checksum_ip_generic": "on [fixed]",
|
|
|
|
|
"tx_checksum_ipv4": "off [fixed]",
|
|
|
|
|
"tx_checksum_ipv6": "off [fixed]",
|
|
|
|
|
"tx_checksum_sctp": "on [fixed]",
|
|
|
|
|
"tx_checksumming": "on",
|
|
|
|
|
"tx_fcoe_segmentation": "off [fixed]",
|
|
|
|
|
"tx_gre_csum_segmentation": "off [fixed]",
|
|
|
|
|
"tx_gre_segmentation": "off [fixed]",
|
|
|
|
|
"tx_gso_partial": "off [fixed]",
|
|
|
|
|
"tx_gso_robust": "off [fixed]",
|
|
|
|
|
"tx_ipip_segmentation": "off [fixed]",
|
|
|
|
|
"tx_lockless": "on [fixed]",
|
|
|
|
|
"tx_mpls_segmentation": "off [fixed]",
|
|
|
|
|
"tx_nocache_copy": "off [fixed]",
|
|
|
|
|
"tx_scatter_gather": "on [fixed]",
|
|
|
|
|
"tx_scatter_gather_fraglist": "on [fixed]",
|
|
|
|
|
"tx_sctp_segmentation": "on",
|
|
|
|
|
"tx_sit_segmentation": "off [fixed]",
|
|
|
|
|
"tx_tcp6_segmentation": "on",
|
|
|
|
|
"tx_tcp_ecn_segmentation": "on",
|
|
|
|
|
"tx_tcp_mangleid_segmentation": "on",
|
|
|
|
|
"tx_tcp_segmentation": "on",
|
|
|
|
|
"tx_udp_tnl_csum_segmentation": "off [fixed]",
|
|
|
|
|
"tx_udp_tnl_segmentation": "off [fixed]",
|
|
|
|
|
"tx_vlan_offload": "off [fixed]",
|
|
|
|
|
"tx_vlan_stag_hw_insert": "off [fixed]",
|
|
|
|
|
"udp_fragmentation_offload": "on",
|
|
|
|
|
"vlan_challenged": "on [fixed]"
|
|
|
|
|
},
|
|
|
|
|
"hw_timestamp_filters": [],
|
|
|
|
|
"ipv4": {
|
|
|
|
|
"address": "127.0.0.1",
|
|
|
|
|
"broadcast": "",
|
|
|
|
|
"netmask": "255.0.0.0",
|
|
|
|
|
"network": "127.0.0.0"
|
|
|
|
|
},
|
|
|
|
|
"ipv6": [
|
|
|
|
|
{
|
|
|
|
|
"address": "::1",
|
|
|
|
|
"prefix": "128",
|
|
|
|
|
"scope": "host"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"mtu": 65536,
|
|
|
|
|
"promisc": false,
|
|
|
|
|
"timestamping": [
|
|
|
|
|
"rx_software",
|
|
|
|
|
"software"
|
|
|
|
|
],
|
|
|
|
|
"type": "loopback"
|
|
|
|
|
},
|
|
|
|
|
"ansible_local": {},
|
|
|
|
|
"ansible_lsb": {},
|
|
|
|
|
"ansible_lvm": {
|
|
|
|
|
"lvs": {
|
|
|
|
|
"root": {
|
|
|
|
|
"size_g": "39.51",
|
|
|
|
|
"vg": "centos"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"pvs": {
|
|
|
|
|
"/dev/sda2": {
|
|
|
|
|
"free_g": "0",
|
|
|
|
|
"size_g": "39.51",
|
|
|
|
|
"vg": "centos"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"vgs": {
|
|
|
|
|
"centos": {
|
|
|
|
|
"free_g": "0",
|
|
|
|
|
"num_lvs": "1",
|
|
|
|
|
"num_pvs": "1",
|
|
|
|
|
"size_g": "39.51"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"ansible_machine": "x86_64",
|
|
|
|
|
"ansible_machine_id": "b2553b2f1ad64a88a81a775b55de0eb3",
|
|
|
|
|
"ansible_memfree_mb": 1754,
|
|
|
|
|
"ansible_memory_mb": {
|
|
|
|
|
"nocache": {
|
|
|
|
|
"free": 1833,
|
|
|
|
|
"used": 151
|
|
|
|
|
},
|
|
|
|
|
"real": {
|
|
|
|
|
"free": 1754,
|
|
|
|
|
"total": 1984,
|
|
|
|
|
"used": 230
|
|
|
|
|
},
|
|
|
|
|
"swap": {
|
|
|
|
|
"cached": 0,
|
|
|
|
|
"free": 0,
|
|
|
|
|
"total": 0,
|
|
|
|
|
"used": 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"ansible_memtotal_mb": 1984,
|
|
|
|
|
"ansible_mounts": [
|
|
|
|
|
{
|
|
|
|
|
"block_available": 97092,
|
|
|
|
|
"block_size": 4096,
|
|
|
|
|
"block_total": 127145,
|
|
|
|
|
"block_used": 30053,
|
|
|
|
|
"device": "/dev/sda1",
|
|
|
|
|
"fstype": "xfs",
|
|
|
|
|
"inode_available": 255673,
|
|
|
|
|
"inode_total": 256000,
|
|
|
|
|
"inode_used": 327,
|
|
|
|
|
"mount": "/boot",
|
|
|
|
|
"options": "rw,relatime,attr2,inode64,noquota",
|
|
|
|
|
"size_available": 397688832,
|
|
|
|
|
"size_total": 520785920,
|
|
|
|
|
"uuid": "bdfa051f-b5a8-4713-9bee-440b49233372"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"block_available": 9998628,
|
|
|
|
|
"block_size": 4096,
|
|
|
|
|
"block_total": 10351679,
|
|
|
|
|
"block_used": 353051,
|
|
|
|
|
"device": "/dev/mapper/centos-root",
|
|
|
|
|
"fstype": "xfs",
|
|
|
|
|
"inode_available": 20687486,
|
|
|
|
|
"inode_total": 20713472,
|
|
|
|
|
"inode_used": 25986,
|
|
|
|
|
"mount": "/",
|
|
|
|
|
"options": "rw,relatime,attr2,inode64,noquota",
|
|
|
|
|
"size_available": 40954380288,
|
|
|
|
|
"size_total": 42400477184,
|
|
|
|
|
"uuid": "d0261be2-3486-4ff1-8563-8360393cfeb4"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"ansible_nodename": "xingdian",
|
|
|
|
|
"ansible_os_family": "RedHat",
|
|
|
|
|
"ansible_pkg_mgr": "yum",
|
|
|
|
|
"ansible_proc_cmdline": {
|
|
|
|
|
"BOOT_IMAGE": "/vmlinuz-3.10.0-693.el7.x86_64",
|
|
|
|
|
"LANG": "en_US.UTF-8",
|
|
|
|
|
"quiet": true,
|
|
|
|
|
"rd.lvm.lv": "centos/root",
|
|
|
|
|
"rhgb": true,
|
|
|
|
|
"ro": true,
|
|
|
|
|
"root": "/dev/mapper/centos-root"
|
|
|
|
|
},
|
|
|
|
|
"ansible_processor": [
|
|
|
|
|
"0",
|
|
|
|
|
"GenuineIntel",
|
|
|
|
|
"11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz"
|
|
|
|
|
],
|
|
|
|
|
"ansible_processor_cores": 1,
|
|
|
|
|
"ansible_processor_count": 1,
|
|
|
|
|
"ansible_processor_threads_per_core": 1,
|
|
|
|
|
"ansible_processor_vcpus": 1,
|
|
|
|
|
"ansible_product_name": "VMware Virtual Platform",
|
|
|
|
|
"ansible_product_serial": "VMware-56 4d 77 c3 38 eb b5 44-f9 c5 f5 a9 0c 0d 1c 29",
|
|
|
|
|
"ansible_product_uuid": "C3774D56-EB38-44B5-F9C5-F5A90C0D1C29",
|
|
|
|
|
"ansible_product_version": "None",
|
|
|
|
|
"ansible_python": {
|
|
|
|
|
"executable": "/usr/bin/python",
|
|
|
|
|
"has_sslcontext": true,
|
|
|
|
|
"type": "CPython",
|
|
|
|
|
"version": {
|
|
|
|
|
"major": 2,
|
|
|
|
|
"micro": 5,
|
|
|
|
|
"minor": 7,
|
|
|
|
|
"releaselevel": "final",
|
|
|
|
|
"serial": 0
|
|
|
|
|
},
|
|
|
|
|
"version_info": [
|
|
|
|
|
2,
|
|
|
|
|
7,
|
|
|
|
|
5,
|
|
|
|
|
"final",
|
|
|
|
|
0
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"ansible_python_version": "2.7.5",
|
|
|
|
|
"ansible_real_group_id": 0,
|
|
|
|
|
"ansible_real_user_id": 0,
|
|
|
|
|
"ansible_selinux": {
|
|
|
|
|
"status": "disabled"
|
|
|
|
|
},
|
|
|
|
|
"ansible_selinux_python_present": true,
|
|
|
|
|
"ansible_service_mgr": "systemd",
|
|
|
|
|
"ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFWlYnYAyylfiZr2C9xiHsT8i2ao+RY8CY+z6wJEBQxdtg+/VHmxYOejdPKrq94IjLU00x5Iu096aQ5XdNyDUs4=",
|
|
|
|
|
"ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAIPHn7/QapryKV1IenlFdQngIQed+y9YyziwtVYnBflG9",
|
|
|
|
|
"ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABAQCso6OpQ9TsQ/2ihnVLtUpqK4y1hjR9WyHqKQFcqH7TN9TDxuyB+gPfN1IzC25IoUb8mp9zIiLNqg8epsNbKFj9l3WQUtx3fcSXqIcZdWeTWkltxz0DxSr0xQd+odYwQ+ppH5gFjvTnJNcVJhqfMLAdQjLFjSrZfvF28qUyTGj8HJC7qGneM9ECLQwQ+ZQ6qvjaXMpgUR4p9JsOdSeicGD3mZwIsvScfhHq011V/2ZCQAgCuUlO/Z6+Xbzc27ZPyu4wkZYWM+DyZEXi0cvO5WYV+tst8uwdBQhSaQi8T5Vu7eUitdoFBC9vTFjZiR39dxEHy2nlkTnJWZ9ChLY08iLf",
|
|
|
|
|
"ansible_swapfree_mb": 0,
|
|
|
|
|
"ansible_swaptotal_mb": 0,
|
|
|
|
|
"ansible_system": "Linux",
|
|
|
|
|
"ansible_system_capabilities": [
|
|
|
|
|
"cap_chown",
|
|
|
|
|
"cap_dac_override",
|
|
|
|
|
"cap_dac_read_search",
|
|
|
|
|
"cap_fowner",
|
|
|
|
|
"cap_fsetid",
|
|
|
|
|
"cap_kill",
|
|
|
|
|
"cap_setgid",
|
|
|
|
|
"cap_setuid",
|
|
|
|
|
"cap_setpcap",
|
|
|
|
|
"cap_linux_immutable",
|
|
|
|
|
"cap_net_bind_service",
|
|
|
|
|
"cap_net_broadcast",
|
|
|
|
|
"cap_net_admin",
|
|
|
|
|
"cap_net_raw",
|
|
|
|
|
"cap_ipc_lock",
|
|
|
|
|
"cap_ipc_owner",
|
|
|
|
|
"cap_sys_module",
|
|
|
|
|
"cap_sys_rawio",
|
|
|
|
|
"cap_sys_chroot",
|
|
|
|
|
"cap_sys_ptrace",
|
|
|
|
|
"cap_sys_pacct",
|
|
|
|
|
"cap_sys_admin",
|
|
|
|
|
"cap_sys_boot",
|
|
|
|
|
"cap_sys_nice",
|
|
|
|
|
"cap_sys_resource",
|
|
|
|
|
"cap_sys_time",
|
|
|
|
|
"cap_sys_tty_config",
|
|
|
|
|
"cap_mknod",
|
|
|
|
|
"cap_lease",
|
|
|
|
|
"cap_audit_write",
|
|
|
|
|
"cap_audit_control",
|
|
|
|
|
"cap_setfcap",
|
|
|
|
|
"cap_mac_override",
|
|
|
|
|
"cap_mac_admin",
|
|
|
|
|
"cap_syslog",
|
|
|
|
|
"35",
|
|
|
|
|
"36+ep"
|
|
|
|
|
],
|
|
|
|
|
"ansible_system_capabilities_enforced": "True",
|
|
|
|
|
"ansible_system_vendor": "VMware, Inc.",
|
|
|
|
|
"ansible_uptime_seconds": 3024,
|
|
|
|
|
"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",
|
|
|
|
|
"discovered_interpreter_python": "/usr/bin/python",
|
|
|
|
|
"gather_subset": [
|
|
|
|
|
"all"
|
|
|
|
|
],
|
|
|
|
|
"module_setup": true
|
|
|
|
|
},
|
|
|
|
|
"changed": false
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 二:使用Setup
|
|
|
|
|
|
|
|
|
|
#### 1.案例一
|
|
|
|
|
|
|
|
|
|
使用“ansible_fqdn”获取主机名称和域名
|
|
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
[root@xingdian ansible]# cat test.yml
|
|
|
|
|
- name: test a playbook
|
|
|
|
|
hosts: web
|
|
|
|
|
tasks:
|
|
|
|
|
- name: hostname
|
|
|
|
|
debug:
|
|
|
|
|
msg: "{{ ansible_fqdn }}"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
运行剧本
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
[root@xingdian ansible]# ansible-playbook test.yml
|
|
|
|
|
[WARNING]: Could not match supplied host pattern, ignoring: node1
|
|
|
|
|
|
|
|
|
|
PLAY [test a playbook] ****************************************************************************************************************************************
|
|
|
|
|
skipping: no hosts matched
|
|
|
|
|
|
|
|
|
|
PLAY RECAP ****************************************************************************************************************************************************
|
|
|
|
|
|
|
|
|
|
[root@xingdian ansible]# vim test.yml
|
|
|
|
|
[root@xingdian ansible]# ansible-playbook test.yml
|
|
|
|
|
|
|
|
|
|
PLAY [test a playbook] ****************************************************************************************************************************************
|
|
|
|
|
|
|
|
|
|
TASK [Gathering Facts] ****************************************************************************************************************************************
|
|
|
|
|
ok: [10.0.0.111]
|
|
|
|
|
|
|
|
|
|
TASK [hostname] ***********************************************************************************************************************************************
|
|
|
|
|
ok: [10.0.0.111] => {
|
|
|
|
|
"msg": "xingdian"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PLAY RECAP ****************************************************************************************************************************************************
|
|
|
|
|
10.0.0.111 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### 2.案例二
|
|
|
|
|
|
|
|
|
|
使用“ansible_ens33.ipv4.address”获取指定网卡IP地址
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
[root@xingdian ansible]# cat test.yml
|
|
|
|
|
- name: test a playbook
|
|
|
|
|
hosts: web
|
|
|
|
|
tasks:
|
|
|
|
|
- name: hostname
|
|
|
|
|
debug:
|
|
|
|
|
msg: "{{ ansible_ens33.ipv4.address }}"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
运行剧本
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
[root@xingdian ansible]# ansible-playbook test.yml
|
|
|
|
|
|
|
|
|
|
PLAY [test a playbook] ****************************************************************************************************************************************
|
|
|
|
|
|
|
|
|
|
TASK [Gathering Facts] ****************************************************************************************************************************************
|
|
|
|
|
ok: [10.0.0.111]
|
|
|
|
|
|
|
|
|
|
TASK [hostname] ***********************************************************************************************************************************************
|
|
|
|
|
ok: [10.0.0.111] => {
|
|
|
|
|
"msg": "10.0.0.111"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PLAY RECAP ****************************************************************************************************************************************************
|
|
|
|
|
10.0.0.111 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### 3.案例三
|
|
|
|
|
|
|
|
|
|
使用“ansible_devices.sda.partitions.sda2.size”获取磁盘容量
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
[root@xingdian ansible]# cat test.yml
|
|
|
|
|
- name: test a playbook
|
|
|
|
|
hosts: web
|
|
|
|
|
tasks:
|
|
|
|
|
- name: hostname
|
|
|
|
|
debug:
|
|
|
|
|
msg: "{{ ansible_devices.sda.partitions.sda2.size }}"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
运行剧本
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
[root@xingdian ansible]# ansible-playbook test.yml
|
|
|
|
|
|
|
|
|
|
PLAY [test a playbook] ****************************************************************************************************************************************
|
|
|
|
|
|
|
|
|
|
TASK [Gathering Facts] ****************************************************************************************************************************************
|
|
|
|
|
ok: [10.0.0.111]
|
|
|
|
|
|
|
|
|
|
TASK [hostname] ***********************************************************************************************************************************************
|
|
|
|
|
ok: [10.0.0.111] => {
|
|
|
|
|
"msg": "39.51 GB"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PLAY RECAP ****************************************************************************************************************************************************
|
|
|
|
|
10.0.0.111 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
|
|
|
|
|
```
|
|
|
|
|
|