欢迎光临散文网 会员登陆 & 注册

Ansible Inventory的构建和使用

2023-03-27 16:03 作者:每天输出五分钟  | 我要投稿

Inventory

What’s inventory?

a list of managed nodes, or hosts, that Ansible deploys and configures

Where’s inventory?

Option in config.cfg

Set file or directory name for option ‘inventory’

Environment Variable

ANSIBLE_INVENTORY

Option in command line

ansible all -m ping -i myInventory/prod.yml -i myInventory/test.yml

Target two inventory files

Inventory files must be in current directory, or use absolute path

How to build inventory?

Formats

INI

YAML

Groups

Default groups

all

ungrouped

Defined groups

Hosts in single defined group

Hosts in multiple defined groups

Parent/Children

Pattern for hosts

Add hosts as a range

numeric range

Specify a stride

alphabetic range


Ansible Inventory的构建和使用的评论 (共 条)

分享到微博请遵守国家法律