๊ธฐ๋ณธ ์ธ๋ฒคํ ๋ฆฌ ํ์ผ: /etc/ansible/hosts
--> ๊ฑฐ์ ์ฌ์ฉํ์ง ์์
๊ธฐ๋ณธ ์์น์ ์๋ ์ธ๋ฒคํ ๋ฆฌ ํ์ผ ์๋๋ฉด: -i ์ต์
์ฌ์ฉ
ํฌ๋ฉง: ini, yaml
ini ํ์์ ์
key=value
[Section]
key=value
key
mail.example.com
[webservers]
foo.example.com
bar.example.com
three.example.com
[dbservers]
one.example.com
two.example.com
three.example.com
[ ]: ์ธ๋ฒคํ ๋ฆฌ ๊ทธ๋ฃน
all:
hosts:
mail.example.com:
children:
webservers:
hosts:
foo.example.com:
bar.example.com:
dbservers:
hosts:
one.example.com:
two.example.com:
three.example.com:
๐ก ์ธ๋ฒคํ ๋ฆฌ ์์ฑ์ ๊ฐ๊ฒฐํ๊ฒ
๊ทธ๋ฃน์ ํธ์คํธ๋ฅผ ๋ถ๋ฅ
- what
- where
- when
ํธ์คํธ์ ๋ฒ์
[webservers]
www[01:50].example.com
192.168.100.[10:19]
[webservers]
www[01:50].example.com A=100 B=200
192.168.100.[10:19]
[atlanta]
host1
host2
[atlanta:vars]
ntp_server=ntp.atlanta.example.com
proxy=proxy.atlanta.example.com
[atlanta]
host1
host2
[raleigh]
host2
host3
[southeast:children]
atlanta
raleigh
[usa:children]
southeast
ansible-inventory -i <INVENTORY_FILE> --graph
ansible-inventory -i <INVENTORY_FILE> --list
ansible-inventory -i <INVENTORY_FILE> --host <HOST>
ansible <HOST_PATTERN> -i <INVENTORY_FILE> --list-hosts
ANSIBLE_CONFIG (environment variable if set)touch /tmp/ans.cfg
export ANSIBLE_CONFIG=/tmp/ans.cfg
ansible --version
unset ANSIBLE_CONFIG
ansible --version
ansible.cfg (ํ์ฌ ์์
๋๋ ํ ๋ฆฌ)~/.ansible.cfg (ํ๋๋ ํ ๋ฆฌ)/etc/ansible/ansible.cfg : ๊ธฐ๋ณธ ์ค์ ํ์ผ