# 内置变量 Parameter Description ansible_ssh_host hostname to connect to for a given host ansible_ssh_port ssh port to connect to for a given host ansible_ssh_user ssh user to connect as for a given host ansible_ssh_pass ssh password to connect as for a given host ansible_ssh_private_key_file ssh private key file to connect as for a given host ansible_connection connection type to use for a given host (e.g. local) ansible_python_interpreter python interpreter to use ansible_*_interpreter interpreter to use #配置主机 [sh_dev] 106.54.66.104 [sh_test] 49.234.220.191 [sho] 10.104.142.2 [sh_gr] 10.104.10.92 # 变量整合(了解即可) [test2] 106.54.66.104 49.234.220.191 10.104.142.2 10.104.10.92 [test2:vars] ansible_ssh_pass="123456" # 个别主机如果没有分发公钥可以使用密码 10.104.43.0 ansible_ssh_user=root ansible_ssh_port=22 ansible_ssh_pass='1' [ngx1] 10.104.242.140 ansible_ssh_private_key_file=~/.ssh/www # 组整合 [test:children] sh_dev sh_test sh_gr