반응형
ㅁ when_dict
- name: dict example hosts: localhost vars: users: alice: name: Alice phone: 123-456 bob: name: bob name phone: 678-910
tasks: - name: user.key is value debug: msg: " {{ item.key }} is {{item.value.name}} {{item.value.phone}} " with_dict: "{{ users }}"
|
- dictionary : key:value.형태의 자료
users (dictionary) 라면,
alice(key) : name: Alice (value) phone: 123-456(value)
bob(key) : name: bob name(value) phone: 678-910(value)
- 실행결과
TASK [user.key is value] ***************************************************************************************************************************
MSG:
bob is bob name 678-910
MSG:
alice is Alice 123-456
반응형
'프로그래밍 > ansbie_YAML' 카테고리의 다른 글
ansible 조건문 (when) (0) | 2018.11.28 |
---|---|
진자2(jinja2) 변수 확장 (0) | 2018.11.28 |
register 예제 (0) | 2018.11.27 |