Inventory中的變量

Variables in Inventory
host variables
assign variable to one machine
group variables
apply variable to an entire group
Apply variable for groups of groups
A child group’s variables will override a parent group’s variables.
precedence
Child > Parent
parent group variables
child group variables
host variables
ASCII order, Last > Previous
variables files
File extensions
.yml .yaml. .json. or no file extension
File location
searching paths relative to the inventory file
Assuming inventory file
/etc/ansible/hosts
Variables files
/etc/ansible/host_vars/football.yml
/etc/ansible/group_vars/webservers.yml
/etc/ansible/group_vars/raleigh/db_settings
/etc/ansible/group_vars/raleigh/cluster_settings
Control how Ansible interacts with remote hosts
Host connection
General for all connections
Specific to the SSH connection
Privilege escalation
Remote host environment parameters
Non-SSH Connection