ansible常用模組及引數(1)
ansible模組及引數(1)
[root@m01 ~]# cat /etc/ansible/ansible.cfg #inventory = /etc/ansible/hosts #主機列表配置檔案 #library = /usr/share/my_modules/ #庫檔案存放目錄 #remote_tmp = ~/.ansible/tmp #臨時py檔案存放在遠端主機目錄 #local_tmp = ~/.ansible/tmp #本機的臨時執行目錄 #forks = 5 #預設併發數 #sudo_user = root #預設sudo使用者 #ask_sudo_pass = True #每次執行是否詢問sudo的ssh密碼 #ask_pass = True #每次執行是否詢問ssh密碼 #remote_port = 22 #遠端主機埠 host_key_checking = False #跳過檢查主機指紋 log_path = /var/log/ansible.log #ansible日誌
Ansible Inventory
/etc/ansible/hosts
是ansible預設主機資產清單檔案,用於定義被管理主機的認證資訊, 例如ssh登入使用者名稱、密碼以及key相關資訊。Inventory檔案中填寫需要被管理的主機與主機組資訊。還可以自定義Inventory主機清單的位置,使用-i指定檔案位置即可
#批量檢視磁碟資訊 [root@m01 ~]# ansible web_group -m command -a 'df -h' -i ./hosts #批量檢視記憶體資訊 [root@m01 ~]# ansible web_group -m command -a 'free -m' -i ./hosts command # 執行shell命令(不支援管道等特殊字元) shell # 執行shell命令 scripts # 執行shell指令碼 yum_repository # 配置yum倉庫 yum # 安裝軟體 copy # 變更配置檔案 file # 建立目錄或檔案 service # 啟動與停止服務 mount # 掛載裝置 cron # 定時任務 get_url #下載軟體 firewalld #防火牆 selinux #selinux [root@m01 ~]# ansible-doc -l # 檢視所有模組說明 [root@m01 ~]# ansible-doc copy # 檢視指定模組方法 [root@m01 ~]# ansible-doc -s copy # 檢視指定模組引數
command
# 預設模組, 執行命令
[root@m01 ~]# ansible web_group -a "hostname"
shell
# 如果需要一些管道操作,則使用shell
[root@m01 ~]# ansible web_group -m shell -a "ps -ef|grep nginx" -f 50
script
# 編寫指令碼 [root@m01 ~]# vim /root/yum.sh #!/usr/bin/bash yum install -y vsftpd #在本地執行模組,等同於在遠端執行,不需要將指令碼檔案進行推送目標主機執行 [root@m01 ~]# ansible web_group -m script -a "/root/yum.sh"
yum
[root@m01 ~]# ansible web_group -m yum -a "name=httpd state=present"
name
httpd #指定要安裝的軟體包名稱
file:// #指定本地安裝路徑(yum localinstall 本地rpm包)
http:// #指定yum源(從遠端倉庫獲取rpm包)
state #指定使用yum的方法
installed,present #安裝軟體包
removed,absent #移除軟體包
latest #安裝最新軟體包
[root@m01 ~]# ansible-doc yum
exclude=kernel*,foo* #排除某些包
list=ansible #類似於yum list檢視是否可以安裝
disablerepo="epel,ol7_latest" #禁用指定的yum倉庫
download_only=true #只下載不安裝 yum install d
yum_repository
#新增yum倉庫
[root@m01 ~]# ansible web_group -m yum_repository -a "name=zls_epel description=EPEL baseurl=https://download.fedoraproject.org/pub/epel/$releasever/$basearch/" -i ./hosts
#倉庫名和配置檔名不同
[root@m01 ~]# ansible web_group -m yum_repository -a 'name=zls_epel description=EPEL file=test_zls baseurl=https://download.fedoraproject.org/pub/base/$releasever/$basearch/ gpgcheck=no' -i ./hosts
#新增mirrorlist
[root@m01 ~]# ansible web_group -m yum_repository -a 'name=zls_epel description=EPEL file=test_zls baseurl=https://download.fedoraproject.org/pub/base/$releasever/$basearch/ gpgcheck=no mirrorlist=http://mirrorlist.repoforge.org/el7/mirrors-rpmforge enabled=no' -i ./hosts
#刪除yum倉庫及檔案
[root@m01 ~]# ansible web_group -m yum_repository -a 'name=zls_epel file=test_zls state=absent' -i ./hosts
#開起gpgcheck
[root@m01 ~]# ansible web_group -m yum_repository -a 'name=zls_epel description=EPEL file=test_zls baseurl=https://download.fedoraproject.org/pub/base/$releasever/$basearch/ gpgcheck=yes gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7' -i ./hosts
name #指定倉庫名,如果沒有file則為倉庫檔名
baseurl #指定yum源
gpgcheck #指定檢查祕鑰
no
yes
enabled #是否啟用倉庫
no
yes
copy
# 推送檔案模組
[root@m01 ~]# ansible web_group -m copy -a "src=/etc/passwd dest=/tmp/zls.txt"
# 在推送覆蓋遠端端檔案前,對遠端已有檔案進行備份,按照時間資訊備份
[root@m01 ~]# ansible web_group -m copy -a "src=/etc/passwd dest=/tmp/zls.txt backup=yes"
# 直接向遠端檔案內寫入資料資訊,並且會覆蓋遠端檔案內原有資料資訊
[root@m01 ~]# ansible web_group -m copy -a "content='zls' dest=/tmp/zls.txt"
src #推送資料的原始檔資訊
dest #推送資料的目標路徑
backup #對推送傳輸過去的檔案,進行備份
content #直接批量在被管理端檔案中新增內容
group #將本地檔案推送到遠端,指定檔案屬組資訊
owner #將本地檔案推送到遠端,指定檔案屬主資訊
mode #將本地檔案推送到遠端,指定檔案許可權資訊
file
[root@m01 ~]# ansible web_group -m file -a "path=/tmp/zls_dir state=directory"
[root@m01 ~]# ansible web_group -m file -a "path=/tmp/zls_file state=touch mode=0555 owner=root group=root"
[root@m01 ~]# ansible web_group -m file -a "src=/tmp/zls_dir path=/tmp/zls_dir_link state=link"
[root@m01 ~]# ansible web_group -m file -a "path=/tmp/zls_dir state=directory owner=zls group=zls mode=0700 recurse=yes"
path #指定遠端主機目錄或檔案資訊
recurse #遞迴授權
state
directory #在遠端建立目錄
touch #在遠端建立檔案
link #link或hard表示建立連結檔案
absent #表示刪除檔案或目錄
mode #設定檔案或目錄許可權
owner #設定檔案或目錄屬主資訊
group #設定檔案或目錄屬組資訊
get_url
[root@m01 ~]# ansible web_group -m get_url -a 'url=https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-agent-3.4.0-1.el7.x86_64.rpm dest=/tmp mode=0644' -i ./hosts
url #指定下載地址
dest #指定下載的目錄
mode #指定許可權
checksum #校驗加密演算法
md5
sha256
service、systemd
#啟動crond並加入開機自啟
[root@m01 ~]# ansible web_group -m service -a "name=crond state=started enabled=yes"
#停止crond並刪除開機自啟
[root@m01 ~]# ansible web_group -m service -a "name=crond state=stoped enabled=no"
name # 定義要啟動服務的名稱
state # 指定服務狀態
started #啟動服務
stopped #停止服務
restarted #重啟服務
reloaded #過載服務
enabled #開機自啟
group
[root@m01 ~]# ansible web_group -m group -a "name=zls gid=888"
name #指定建立的組名
gid #指定組的gid
state
absent #移除遠端主機的組
present #建立遠端主機的組(預設)
user
#建立使用者指定uid和gid,不建立家目錄也不允許登陸
[root@m01 ~]# ansible web_group -m user -a "name=zls uid=888 group=888 shell=/sbin/nologin create_home=false"
#建立使用者並生成祕鑰對
[root@m01 ~]# ansible web_group -m user -a "name=zls uid=888 group=root shell=/bin/bash generate_ssh_key=yes ssh_key_bits=2048 ssh_key_file=.ssh/id_rsa" -i ./hosts
web01 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": true,
"comment": "",
"create_home": true,
"group": 0,
"home": "/home/zls",
"name": "zls",
"shell": "/bin/bash",
"ssh_fingerprint": "2048 SHA256:WEMHCpSjxxqFwlzrCk1FqrPqeq6N/SHxL1gFTSqHlGM ansible-generated on web01 (RSA)",
"ssh_key_file": "/home/zls/.ssh/id_rsa",
"ssh_public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRx+bCYGh4FqpKoPzyXrR8ef9GwoY6l6QEFQ0+XPynR22fd9Lbs1eUxWDm5aH4ZO8sPaI8a5xmj88Sipwl0FxlQTjD2X/vreZNEDbwFWrbZ24VvPkfPSSWBh5SxLH6pJt8pGQpPVWuLRMx6yOOxRB1hh9bGFzQNg5z8xqzeogTOoI7cxSFZVuUb5affNj8H5mCw2nAvblV+HNhRzbMlwr+9/EWcCWHDnlVYcELHXjpNJcyGB3VFOu1MPkmLaSTcaB73O0eRvZQkYMBePKJC44tvjHihGhvCk9rzh8qvzHxvMgoMD/+0uKAlIwEvOyfAczb7fxllU0rDtbyPtjbuLsR ansible-generated on web01",
"state": "present",
"system": false,
"uid": 888
}
web02 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": true,
"comment": "",
"create_home": true,
"group": 0,
"home": "/home/zls",
"name": "zls",
"shell": "/bin/bash",
"ssh_fingerprint": "2048 SHA256:IepfOosi2Xm8kfr4nOPAhG3fec6o8kpMnJ0/RwN+0F8 ansible-generated on web02 (RSA)",
"ssh_key_file": "/home/zls/.ssh/id_rsa",
"ssh_public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEcO9iDKg4X8ya/y9E0eDelAFMp/rxiDSzW31r+REawaQyF4oywcdIagpz0MTg2BeF2WdaYUmHmtmSTfSOMif26+R1FLcL9f9NYu3io/0388jukcTfyN02diXWgqoKtt4Gbm8Bq8sWE4tX/FSYl42fG6bX1AyDSMzzB7ERr2AD/Y9KuKt7cEXDinGjqTFEXw6+x1wBHpotkUisYiZCci+1Nx4YSznVRBveZTlpxMUYmKgwkUXQIt+RoOYzjgD++0md8O7lwJGgODZkahlrf2pOQnmpS4isLi9or4N+DVnqD+cXb/RjgJzPIJZYazgRY3vtAU9DDqm5i049x/VxEqFj ansible-generated on web02",
"state": "present",
"system": false,
"uid": 888
}
#將明文密碼進行hash加密,然後進行使用者建立
[root@m01 ~]# ansible web_group -m debug -a "msg={{ 'zls' | password_hash('sha512', 'salt') }}" -i ./hosts
web01 | SUCCESS => {
"msg": "$6$salt$gaWhNcZweYlKQcLU1CqyY/UbYqIeUffVz6ESj87aMNfMX.xYBx0Z.67wzLN/hkkxmNut7SvkksPZ2Zlrse98m/"
}
web02 | SUCCESS => {
"msg": "$6$salt$gaWhNcZweYlKQcLU1CqyY/UbYqIeUffVz6ESj87aMNfMX.xYBx0Z.67wzLN/hkkxmNut7SvkksPZ2Zlrse98m/"
}
#建立使用者
[root@m01 ~]# ansible web_group -m user -a 'name=zls1 password=$6$salt$gaWhNcZweYlKQcLU1CqyY/UbYqIeUffVz6ESj87aMNfMX.xYBx0Z.67wzLN/hkkxmNut7SvkksPZ2Zlrse98m/ create_home=true shell=/bin/bash' -i ./hosts
uid #指定使用者的uid
group #指定使用者組名稱
groups #指定附加組名稱
password #給使用者新增密碼(單引號)
shell #指定使用者登入shell
create_home #是否建立家目錄
cron
# 正常使用crond服務
[root@m01 ~]# crontab -l
* * * * * /bin/sh /server/scripts/yum.sh
# 使用ansible新增一條定時任務
[root@m01 ~]# ansible web_group -m cron -a "minute=* hour=* day=* month=* weekday=* job='/bin/sh /server/scripts/test.sh'"
[root@m01 ~]# ansible web_group -m cron -a "job='/bin/sh /server/scripts/test.sh'"
# 設定定時任務註釋資訊,防止重複,name設定
[root@m01 ~]# ansible web_group -m cron -a "name='cron01' job='/bin/sh /server/scripts/test.sh'"
# 刪除相應定時任務
[root@m01 ~]# ansible web_group -m cron -a "name='ansible cron02' minute=0 hour=0 job='/bin/sh /server/scripts/test.sh' state=absent"
# 註釋相應定時任務,使定時任務失效
[root@m01 scripts]# ansible web_group -m cron -a "name='ansible cron01' minute=0 hour=0 job='/bin/sh /server/scripts/test.sh' disabled=no"
mount
[root@m01 ~]# ansible web_group -m mount -a "src=172.16.1.31:/data path=/data fstype=nfs opts=defaults state=present"
[root@m01 ~]# ansible web01 -m mount -a "src=172.16.1.31:/data path=/data fstype=nfs opts=defaults state=mounted"
[root@m01 ~]# ansible web02 -m mount -a "src=172. 16.1.31:/data path=/data fstype=nfs opts=defaults state=unmounted"
[root@m01 ~]# ansible web -m mount -a "src=172.16.1.31:/data path=/data fstype=nfs opts=defaults state=absent"
present # 開機掛載,僅將掛載配置寫入/etc/fstab
mounted # 掛載裝置,並將配置寫入/etc/fstab
unmounted # 解除安裝裝置,不會清除/etc/fstab寫入的配置
absent # 解除安裝裝置,會清理/etc/fstab寫入的配置
selinux
#修改配置檔案關閉selinux,必須重啟
[root@m01 ~]# ansible web_group -m selinux -a 'state=disabled' -i ./hosts
[WARNING]: SELinux state temporarily changed from 'enforcing' to 'permissive'. State change will take effect next reboot.
web01 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": true,
"configfile": "/etc/selinux/config",
"msg": "Config SELinux state changed from 'enforcing' to 'disabled'",
"policy": "targeted",
"reboot_required": true,
"state": "disabled"
}
web02 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": true,
"configfile": "/etc/selinux/config",
"msg": "Config SELinux state changed from 'enforcing' to 'disabled'",
"policy": "targeted",
"reboot_required": true,
"state": "disabled"
}
#臨時關閉
[root@m01 ~]# ansible web_group -m shell -a 'setenforce 0' -i ./hosts
web02 | CHANGED | rc=0 >>
web01 | CHANGED | rc=0 >>
[root@m01 ~]# ansible web_group -m shell -a 'getenforce' -i ./hosts
web02 | CHANGED | rc=0 >>
Permissive
web01 | CHANGED | rc=0 >>
Permissive
firewalld
[root@m01 ~]# ansible web_group -m firewalld -a 'service=http permanent=yes state=enabled' -i ./hosts
[root@m01 ~]# ansible web_group -m firewalld -a "service=http immediate=yes permanent=yes state=enabled" -i ./hosts
[root@m01 ~]# ansible web_group -m firewalld -a "port=8080-8090/tcp immediate=yes permanent=yes state=enabled" -i ./hosts
service #指定開放或關閉的服務名稱
port #指定開放或關閉的埠
permanent #是否新增永久生效
state #開啟或者關閉
enabled
disabled
zone #指定配置某個區域
rich_rule #配置輔規則
masquerade #開啟地址偽裝
immediate #臨時生效
source #指定來源
setup
[root@m01 ~]# ansible web01 -m setup
web01 | SUCCESS => {
"ansible_facts": {
"ansible_all_ipv4_addresses": [
"10.0.0.7"
],
"ansible_all_ipv6_addresses": [
"fe80::20c:29ff:fef8:9880"
],
"ansible_apparmor": {
"status": "disabled"
},
"ansible_architecture": "x86_64",
"ansible_bios_date": "04/13/2018",
"ansible_bios_version": "6.00",
"ansible_cmdline": {
"BOOT_IMAGE": "/vmlinuz-3.10.0-862.el7.x86_64",
"LANG": "en_US.UTF-8",
"biosdevname": "0",
"net.ifnames": "0",
"quiet": true,
"rhgb": true,
"ro": true,
"root": "UUID=7348b9b1-f2a7-46c6-bede-4f22224dc168"
},
"ansible_date_time": {
"date": "2019-09-10",
"day": "10",
"epoch": "1568115243",
"hour": "19",
"iso8601": "2019-09-10T11:34:03Z",
"iso8601_basic": "20190910T193403218395",
"iso8601_basic_short": "20190910T193403",
"iso8601_micro": "2019-09-10T11:34:03.218468Z",
"minute": "34",
"month": "09",
"second": "03",
"time": "19:34:03",
"tz": "CST",
"tz_offset": "+0800",
"weekday": "星期二",
"weekday_number": "2",
"weeknumber": "36",
"year": "2019"
},
"ansible_default_ipv4": {
"address": "10.0.0.7",
"alias": "eth0",
"broadcast": "10.0.0.255",
"gateway": "10.0.0.2",
"interface": "eth0",
"macaddress": "00:0c:29:f8:98:80",
"mtu": 1500,
"netmask": "255.255.255.0",
"network": "10.0.0.0",
"type": "ether"
},
"ansible_default_ipv6": {},
"ansible_device_links": {
"ids": {
"sr0": [
"ata-VMware_Virtual_IDE_CDROM_Drive_00000000000000000001"
],
"sr1": [
"ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001"
]
},
"labels": {},
"masters": {},
"uuids": {
"sda1": [
"8e547355-994a-4bad-a941-da93f4f1cdfd"
],
"sda2": [
"9e4d046c-02cf-47bd-a4bf-1e8b5fa4bed5"
],
"sda3": [
"7348b9b1-f2a7-46c6-bede-4f22224dc168"
]
}
},
"ansible_devices": {
"sda": {
"holders": [],
"host": "SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": "VMware Virtual S",
"partitions": {
"sda1": {
"holders": [],
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": [
"8e547355-994a-4bad-a941-da93f4f1cdfd"
]
},
"sectors": "2097152",
"sectorsize": 512,
"size": "1.00 GB",
"start": "2048",
"uuid": "8e547355-994a-4bad-a941-da93f4f1cdfd"
},
"sda2": {
"holders": [],
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": [
"9e4d046c-02cf-47bd-a4bf-1e8b5fa4bed5"
]
},
"sectors": "2097152",
"sectorsize": 512,
"size": "1.00 GB",
"start": "2099200",
"uuid": "9e4d046c-02cf-47bd-a4bf-1e8b5fa4bed5"
},
"sda3": {
"holders": [],
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": [
"7348b9b1-f2a7-46c6-bede-4f22224dc168"
]
},
"sectors": "37746688",
"sectorsize": 512,
"size": "18.00 GB",
"start": "4196352",
"uuid": "7348b9b1-f2a7-46c6-bede-4f22224dc168"
}
},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "deadline",
"sectors": "41943040",
"sectorsize": "512",
"size": "20.00 GB",
"support_discard": "0",
"vendor": "VMware,",
"virtual": 1
},
"sr0": {
"holders": [],
"host": "IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)",
"links": {
"ids": [
"ata-VMware_Virtual_IDE_CDROM_Drive_00000000000000000001"
],
"labels": [],
"masters": [],
"uuids": []
},
"model": "VMware IDE CDR00",
"partitions": {},
"removable": "1",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "deadline",
"sectors": "2097151",
"sectorsize": "512",
"size": "1024.00 MB",
"support_discard": "0",
"vendor": "NECVMWar",
"virtual": 1
},
"sr1": {
"holders": [],
"host": "IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)",
"links": {
"ids": [
"ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001"
],
"labels": [],
"masters": [],
"uuids": []
},
"model": "VMware IDE CDR10",
"partitions": {},
"removable": "1",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "deadline",
"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": "7",
"ansible_distribution_release": "Core",
"ansible_distribution_version": "7.5",
"ansible_dns": {
"nameservers": [
"10.0.0.2"
]
},
"ansible_domain": "",
"ansible_effective_group_id": 0,
"ansible_effective_user_id": 0,
"ansible_env": {
"HOME": "/root",
"LANG": "zh_CN.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",
"SELINUX_LEVEL_REQUESTED": "",
"SELINUX_ROLE_REQUESTED": "",
"SELINUX_USE_CURRENT_RANGE": "",
"SHELL": "/bin/bash",
"SHLVL": "2",
"SSH_CLIENT": "10.0.0.51 53512 22",
"SSH_CONNECTION": "10.0.0.51 53512 10.0.0.7 22",
"SSH_TTY": "/dev/pts/1",
"TERM": "xterm-256color",
"USER": "root",
"XDG_RUNTIME_DIR": "/run/user/0",
"XDG_SESSION_ID": "87",
"_": "/usr/bin/python"
},
"ansible_eth0": {
"active": true,
"device": "eth0",
"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_udp_tunnel_port_offload": "off [fixed]",
"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_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.7",
"broadcast": "10.0.0.255",
"netmask": "255.255.255.0",
"network": "10.0.0.0"
},
"ipv6": [
{
"address": "fe80::20c:29ff:fef8:9880",
"prefix": "64",
"scope": "link"
}
],
"macaddress": "00:0c:29:f8:98:80",
"module": "e1000",
"mtu": 1500,
"pciid": "0000:02:01.0",
"promisc": false,
"speed": 1000,
"timestamping": [
"tx_software",
"rx_software",
"software"
],
"type": "ether"
},
"ansible_fibre_channel_wwn": [],
"ansible_fips": false,
"ansible_form_factor": "Other",
"ansible_fqdn": "web01",
"ansible_hostname": "web01",
"ansible_hostnqn": "",
"ansible_interfaces": [
"lo",
"eth0"
],
"ansible_is_chroot": false,
"ansible_iscsi_iqn": "",
"ansible_kernel": "3.10.0-862.el7.x86_64",
"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_udp_tunnel_port_offload": "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_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": "host",
"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_machine": "x86_64",
"ansible_machine_id": "c9d400bd3c1249bd81b2d49252985ab6",
"ansible_memfree_mb": 1068,
"ansible_memory_mb": {
"nocache": {
"free": 1622,
"used": 360
},
"real": {
"free": 1068,
"total": 1982,
"used": 914
},
"swap": {
"cached": 0,
"free": 1023,
"total": 1023,
"used": 0
}
},
"ansible_memtotal_mb": 1982,
"ansible_mounts": [
{
"block_available": 227935,
"block_size": 4096,
"block_total": 259584,
"block_used": 31649,
"device": "/dev/sda1",
"fstype": "xfs",
"inode_available": 523962,
"inode_total": 524288,
"inode_used": 326,
"mount": "/boot",
"options": "rw,seclabel,relatime,attr2,inode64,noquota",
"size_available": 933621760,
"size_total": 1063256064,
"uuid": "8e547355-994a-4bad-a941-da93f4f1cdfd"
},
{
"block_available": 69275,
"block_size": 262144,
"block_total": 73684,
"block_used": 4409,
"device": "10.0.0.31:/data",
"fstype": "nfs4",
"inode_available": 9409536,
"inode_total": 9436672,
"inode_used": 27136,
"mount": "/opt",
"options": "rw,relatime,vers=4.1,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.0.0.7,local_lock=none,addr=10.0.0.31",
"size_available": 18160025600,
"size_total": 19315818496,
"uuid": "N/A"
},
{
"block_available": 4354375,
"block_size": 4096,
"block_total": 4715776,
"block_used": 361401,
"device": "/dev/sda3",
"fstype": "xfs",
"inode_available": 9403419,
"inode_total": 9436672,
"inode_used": 33253,
"mount": "/",
"options": "rw,seclabel,relatime,attr2,inode64,noquota",
"size_available": 17835520000,
"size_total": 19315818496,
"uuid": "7348b9b1-f2a7-46c6-bede-4f22224dc168"
}
],
"ansible_nodename": "web01",
"ansible_os_family": "RedHat",
"ansible_pkg_mgr": "yum",
"ansible_proc_cmdline": {
"BOOT_IMAGE": "/vmlinuz-3.10.0-862.el7.x86_64",
"LANG": "en_US.UTF-8",
"biosdevname": "0",
"net.ifnames": "0",
"quiet": true,
"rhgb": true,
"ro": true,
"root": "UUID=7348b9b1-f2a7-46c6-bede-4f22224dc168"
},
"ansible_processor": [
"0",
"GenuineIntel",
"Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz"
],
"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 a5 a2 9d f3 51 25-4d 67 a8 58 f8 f8 98 80",
"ansible_product_uuid": "A2A54D56-F39D-2551-4D67-A858F8F89880",
"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": {
"config_mode": "disabled",
"mode": "permissive",
"policyvers": 31,
"status": "enabled",
"type": "targeted"
},
"ansible_selinux_python_present": true,
"ansible_service_mgr": "systemd",
"ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAiDBJtsjcCuaEVqC4e2tPeN3X7FbSfbWq4gDx65v5AX8yPzZcufMmv0yydrCvbkb3HhMGqVJ7oNMioQdyqiu8Q=",
"ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAIBVg0/vQDn4AFzoNyeGcB61Jr3a+Cv3hu36XOW+BAgv+",
"ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABAQC4PhQf/9RtL4kuFejVDjQoT8ng10Wdf5SA884Nu9l5wfrBLTVpKUusox5g4lU9+cuYicZiEYmasvxQbACsI90OybLUs26eUymRMtYQiS+N9Mfz0I+CLSssIEtUd5nplNoaPLM7dvgej1YxzLoz8mF6XkwhTLCd3nnye/YxuYYecGNZRCi2q6mkMYjO0HuHtqeSyoK+gPB2so7p7QrC3kcYbgblKfztDDUJ11tmYTBQJdDm7+ICztFjiwyWsnOvbItpOyI2M6neDkN8KCqoDwDYKCbXSbs6uamWkInlz03G9LGuIf+B/rhG6pmFVxG3Ac9h1tS5b6H2DJRMxQR+Vf5/",
"ansible_swapfree_mb": 1023,
"ansible_swaptotal_mb": 1023,
"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": 96743,
"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
}
獲取IP地址
[root@m01 ~]# ansible web01 -m setup -a 'filter=ansible_default_ipv4'
web01 | SUCCESS => {
"ansible_facts": {
"ansible_default_ipv4": {
"address": "10.0.0.7",
"alias": "eth0",
"broadcast": "10.0.0.255",
"gateway": "10.0.0.2",
"interface": "eth0",
"macaddress": "00:0c:29:f8:98:80",
"mtu": 1500,
"netmask": "255.255.255.0",
"network": "10.0.0.0",
"type": "ether"
},
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false
}
獲取主機名
[root@m01 ~]# ansible web01 -m setup -a 'filter=ansible_fqdn'
web01 | SUCCESS => {
"ansible_facts": {
"ansible_fqdn": "web01",
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false
}
獲取記憶體資訊
[root@m01 ~]# ansible web01 -m setup -a 'filter=ansible_memory_mb'
web01 | SUCCESS => {
"ansible_facts": {
"ansible_memory_mb": {
"nocache": {
"free": 1622,
"used": 360
},
"real": {
"free": 1068,
"total": 1982,
"used": 914
},
"swap": {
"cached": 0,
"free": 1023,
"total": 1023,
"used": 0
}
},
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false
}
獲取磁碟資訊
web01 | SUCCESS => {
"ansible_facts": {
"ansible_memory_mb": {
"nocache": {
"free": 1622,
"used": 360
},
"real": {
"free": 1068,
"total": 1982,
"used": 914
},
"swap": {
"cached": 0,
"free": 1023,
"total": 1023,
"used": 0
}
},
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false
}
[root@m01 ~]# ansible_devices^C
[root@m01 ~]# ansible web01 -m setup -a 'filter=ansible_devices'
web01 | SUCCESS => {
"ansible_facts": {
"ansible_devices": {
"sda": {
"holders": [],
"host": "SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": "VMware Virtual S",
"partitions": {
"sda1": {
"holders": [],
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": [
"8e547355-994a-4bad-a941-da93f4f1cdfd"
]
},
"sectors": "2097152",
"sectorsize": 512,
"size": "1.00 GB",
"start": "2048",
"uuid": "8e547355-994a-4bad-a941-da93f4f1cdfd"
},
"sda2": {
"holders": [],
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": [
"9e4d046c-02cf-47bd-a4bf-1e8b5fa4bed5"
]
},
"sectors": "2097152",
"sectorsize": 512,
"size": "1.00 GB",
"start": "2099200",
"uuid": "9e4d046c-02cf-47bd-a4bf-1e8b5fa4bed5"
},
"sda3": {
"holders": [],
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": [
"7348b9b1-f2a7-46c6-bede-4f22224dc168"
]
},
"sectors": "37746688",
"sectorsize": 512,
"size": "18.00 GB",
"start": "4196352",
"uuid": "7348b9b1-f2a7-46c6-bede-4f22224dc168"
}
},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "deadline",
"sectors": "41943040",
"sectorsize": "512",
"size": "20.00 GB",
"support_discard": "0",
"vendor": "VMware,",
"virtual": 1
},
"sr0": {
"holders": [],
"host": "IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)",
"links": {
"ids": [
"ata-VMware_Virtual_IDE_CDROM_Drive_00000000000000000001"
],
"labels": [],
"masters": [],
"uuids": []
},
"model": "VMware IDE CDR00",
"partitions": {},
"removable": "1",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "deadline",
"sectors": "2097151",
"sectorsize": "512",
"size": "1024.00 MB",
"support_discard": "0",
"vendor": "NECVMWar",
"virtual": 1
},
"sr1": {
"holders": [],
"host": "IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)",
"links": {
"ids": [
"ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001"
],
"labels": [],
"masters": [],
"uuids": []
},
"model": "VMware IDE CDR10",
"partitions": {},
"removable": "1",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "deadline",
"sectors": "2097151",
"sectorsize": "512",
"size": "1024.00 MB",
"support_discard": "0",
"vendor": "NECVMWar",
"virtual": 1
}
},
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false
}
其他資訊引數
ansible_all_ipv4_addresses:僅顯示ipv4的資訊。
ansible_devices:僅顯示磁碟裝置資訊。
ansible_distribution:顯示是什麼系統,例:centos,suse等。
ansible_distribution_major_version:顯示是系統主版本。
ansible_distribution_version:僅顯示系統版本。
ansible_machine:顯示系統型別,例:32位,還是64位。
ansible_eth0:僅顯示eth0的資訊。
ansible_hostname:僅顯示主機名。
ansible_kernel:僅顯示核心版本。
ansible_lvm:顯示lvm相關資訊。
ansible_memtotal_mb:顯示系統總記憶體。
ansible_memfree_mb:顯示可用系統記憶體。
ansible_memory_mb:詳細顯示記憶體情況。
ansible_swaptotal_mb:顯示總的swap記憶體。
ansible_swapfree_mb:顯示swap記憶體的可用記憶體。
ansible_mounts:顯示系統磁碟掛載情況。
ansible_processor:顯示cpu個數(具體顯示每個cpu的型號)。
ansible_processor_vcpus:顯示cpu個數(只顯示總的個數)。
inventory = /etc/ansible/hosts 這個是預設庫檔案位置,指令碼,或者存放可通訊主機的目錄
library = /usr/share/my_modules/ Ansible預設搜尋模組的位置
remote_tmp = $HOME/.ansible/tmp Ansible 通過遠端傳輸模組到遠端主機,然後遠端執行,執行後在清理現場.在有些場景下,你也許想使用預設路徑希望像更換補丁一樣使用
pattern = * 如果沒有提供“hosts”節點,這是playbook要通訊的預設主機組.預設值是對所有主機通訊
forks = 5 在與主機通訊時的預設並行程序數 ,預設是5d
poll_interval = 15 當具體的poll interval 沒有定義時,多少時間回查一下這些任務的狀態, 預設值是5秒
sudo_user = root sudo使用的預設使用者 ,預設是root
#ask_sudo_pass = True 用來控制Ansible playbook 在執行sudo之前是否詢問sudo密碼.預設為no
#ask_pass = True 控制Ansible playbook 是否會自動預設彈出密碼
transport = smart 通訊機制.預設 值為’smart’。如果本地系統支援 ControlPersist技術的話,將會使用(基於OpenSSH)‘ssh’,如果不支援講使用‘paramiko’.其他傳輸選項包括‘local’, ‘chroot’,’jail’等等
#remote_port = 22 遠端SSH埠。 預設是22
module_lang = C 模組和系統之間通訊的計算機語言,預設是C語言
gathering = implicit 控制預設facts收集(遠端系統變數). 預設值為’implicit’, 每一次play,facts都會被收集
#roles_path = /etc/ansible/roles roles 路徑指的是’roles/’下的額外目錄,用於playbook搜尋Ansible roles
host_key_checking = False 檢查主機金鑰
sudo_exe = sudo 如果在其他遠端主機上使用另一種方式執sudu操作.可以使用該引數進行更換
what flags to pass to sudo 傳遞sudo之外的引數
sudo_flags = -H
SSH timeout SSH超時時間
timeout = 10
remote_user = root 使用/usr/bin/ansible-playbook連結的預設使用者名稱,如果不指定,會使用當前登入的使用者名稱
log_path = /var/log/ansible.log 日誌檔案存放路徑
module_name = command ansible命令執行預設的模組
executable = /bin/sh 在sudo環境下產生一個shell互動介面. 使用者只在/bin/bash的或者sudo限制的一些場景中需要修改
hash_behaviour = replace 特定的優先順序覆蓋變數
jinja2_extensions = jinja2.ext.do,jinja2.ext.i18n 允許開啟Jinja2拓展模組
private_key_file = /path/to/file 私鑰檔案儲存位置
ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host} 這個設定可以告知使用者,Ansible修改了一個檔案,並且手動寫入的內容可能已經被覆蓋.
display_skipped_hosts = True 顯示任何跳過任務的狀態 ,預設是顯示
error_on_undefined_vars = False 如果所引用的變數名稱錯誤的話, 將會導致ansible在執行步驟上失敗
system_warnings = True 允許禁用系統執行ansible相關的潛在問題警告
deprecation_warnings = True 允許在ansible-playbook輸出結果中禁用“不建議使用”警告
command_warnings = False 當shell和命令列模組被預設模組簡化的時,Ansible 將預設發出警告
bin_ansible_callbacks = False 用來控制callback外掛是否在執行 /usr/bin/ansible 的時候被載入. 這個模組將用於命令列的日誌系統,發出通知等特性
nocows = 1 預設ansible可以呼叫一些cowsay的特性 開啟/禁用:0/1
nocolor = 1 輸出帶上顏色區別, 開啟/關閉:0/1