inventory
- 작업 대상 서버와 변수 파일을 저장
- ini, yaml 파일로 설정
inventory - hosts
- all : 모든 호스트(서버) 정보. 여기에 우선 모든 호스트 정보를 줘야지만 ansible로 관리가 됨.
- children : 그룹별 호스트 정보, 작업 단위별로 설정
- 비슷한 패턴의 호스트가 많을 경우 범위를 사용해서 나열 가능 (www[01:50].example.com)
- IP 직접 설정도 가능
# ini
a.example.com
b.example.com
c.example.com
d.example.com
[web]
a.example.com
b.example.com
[db]
c.example.com
d.example.com
# yaml
all:
hosts:
a.example.com
b.example.com
c.example.com
d.example.com
children:
web:
hosts:
a.example.com
b.example.com
db:
hosts:
c.example.com
d.example.com
# ini
[webservers]
www[01:50:2].example.com
# yaml
webservers:
hosts:
www[01:50:2].example.com: