group_vars/ # 群組變數 all.yml # 各環境共用的群組變數 production.yml # 正式環境的群組變數 staging.yml # 測試環境的群組變數 host_vars/ # 主機變數 hostname1.yml # here we assign variables to particular systems hostname2.yml
library/ # if any custom modules, put them here (optional) module_utils/ # if any custom module_utils to support modules, put them here (optional) filter_plugins/ # if any custom filter plugins, put them here (optional)
site.yml # master playbook webservers.yml # playbook for webserver tier dbservers.yml # playbook for dbserver tier
roles/ common/ # this hierarchy represents a "role" tasks/ # main.yml # <-- tasks file can include smaller files if warranted handlers/ # main.yml # <-- handlers file templates/ # <-- files for use with the template resource ntp.conf.j2 # <------- templates end in .j2 files/ # bar.txt # <-- files for use with the copy resource foo.sh # <-- script files for use with the script resource vars/ # main.yml # <-- variables associated with this role defaults/ # main.yml # <-- default lower priority variables for this role meta/ # main.yml # <-- role dependencies library/ # roles can also include custom modules module_utils/ # roles can also include custom module_utils lookup_plugins/ # or other types of plugins, like lookup in this case
webtier/ # same kind of structure as "common" was above, done for the webtier role monitoring/ # "" fooapp/ # ""
PLAYBOOK: initial.yml **************************************************************************************************************************************************** 1 plays in ./initial.yml
PLAY [Ansible Check] *****************************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************** task path: /ansible-demo/initial.yml:1 The authenticity of host '10.0.29.95 (10.0.29.95)' can't be established. ECDSA key fingerprint is SHA256:rfeIQ8KcFwSk24fnjYelPAb1wXFuL4Byok0hPXMzylQ. Are you sure you want to continue connecting (yes/no)?
依照官方文件Host Key Checking 你可以在設定檔 /etc/ansible/ansible.cfg or ~/.ansible.cfg 配置
PLAY [Ansible Check] *****************************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************** fatal: [eureka-01]: FAILED! => {"msg": "to use the 'ssh' connection type with passwords, you must install the sshpass program"}
PLAY [Ansible Check] *****************************************************************************************************************************************************