차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
ansible_summary [2018/09/05 02:16] – [Inventory files] koovansible_summary [2018/10/04 02:25] (현재) koov
줄 22: 줄 22:
 ==== Speial sections: ==== ==== Speial sections: ====
  
-  * [foo:children]: new group foo contaning all members if included groups +  * ''<nowiki>[foo:children]</nowiki>'': new group foo contaning all members if included groups 
-  * [foo:vars]: variable definitions for all members of group foo+  * ''<nowiki>[foo:vars]</nowiki>'': variable definitions for all members of group foo
  
 ==== Variable files: ==== ==== Variable files: ====
  
-YAML; given inventory file at .../hosts:+YAML; given inventory file at ''.../hosts'':
  
-  * ...group_vars/foo: variable definitions for all members of group foo +  * ''...group_vars/foo'': variable definitions for all members of group foo 
-  * ...host_vars/foo.example.com: variable definitions for foo.example.com +  * ''...host_vars/foo.example.com'': variable definitions for foo.example.com
-  * +
 ==== Behavorial inventory parameters: ==== ==== Behavorial inventory parameters: ====
   * ansible_ssh_host   * ansible_ssh_host
줄 137: 줄 136:
  
 ==== Substitution examples: ==== ==== Substitution examples: ====
-  * {{ var }} +  * ''<nowiki>{{ var }}</nowiki>'' 
-  * {{ var["key1"]["key2"]}} +  * ''<nowiki>{{ var["key1"]["key2"]}}</nowiki>'' 
-  * {{ var.key1.key2 }} +  * ''<nowiki>{{ var.key1.key2 }}</nowiki>'' 
-  * {{ list[0] }}+  * ''<nowiki>{{ list[0] }}</nowiki>''
  
 ==== Souces: ==== ==== Souces: ====
  
   * Highest priority:   * Highest priority:
-    * --extra-vars on the command line+    * ''<nowiki>--extra-vars</nowiki>'' on the command line
   * General:   * General:
-    * vars component of a playbook +    * ''vars'' component of a playbook 
-    * From files referenced by vars_file in a playbook+    * From files referenced by ''vars_file'' in a playbook
     * From included files (incl. roles)     * From included files (incl. roles)
     * Paameters passed to includes     * Paameters passed to includes
     * Facts (see below)     * Facts (see below)
-    * Any /etc/ansible/facts.d/filename.fact on managed machines (sets variables with `ansible_local.filename. prefix) +    * Any ''/etc/ansible/facts.d/filename.fact'' on managed machines (sets variables with `ansible_local.filename. prefix) 
-    * register: in tasks+    * ''register'': in tasks
  
   * Lower priority:   * Lower priority:
줄 161: 줄 160:
  
 ==== Built-in: ==== ==== Built-in: ====
-  * hostvars (e.g. hostvars[other.example.com][...]) +  * ''hostvars'' (e.g. hostvars[other.example.com][...]) 
-  * group_names (groups containing current host) +  * ''group_names'' (groups containing current host) 
-  * groups (all groups and hosts in the inventory) +  * ''groups'' (all groups and hosts in the inventory) 
-  * inventory_hostname (current host as in inventory) +  * ''inventory_hostname'' (current host as in inventory) 
-  * inventory_hostname_short (first component of inventory_hostname) +  * ''inventory_hostname_short'' (first component of inventory_hostname) 
-  * play_hosts (hostnames in scope for current play) +  * ''play_hosts'' (hostnames in scope for current play) 
-  * inventory_dir (location of the inventory) +  * ''inventory_dir'' (location of the inventory) 
-  * inventoty_file (name of the inventory)+  * ''inventoty_file'' (name of the inventory)
  
 ==== Facts: ==== ==== Facts: ====
줄 203: 줄 202:
  
 ===== Filters ===== ===== Filters =====
-  * {{ var | to_nice_json }} +  * <nowiki>{{ var | to_nice_json }}</nowiki> 
-  * {{ var | to_json }} +  * <nowiki>{{ var | to_json }}</nowiki> 
-  * {{ var | from_json }} +  * <nowiki>{{ var | from_json }}</nowiki> 
-  * {{ var | to_nice_yml }} +  * <nowiki>{{ var | to_nice_yml }}</nowiki> 
-  * {{ var | to_yml }} +  * <nowiki>{{ var | to_yml }}</nowiki> 
-  * {{ var | from_yml }} +  * <nowiki>{{ var | from_yml }}</nowiki> 
-  * {{ result | failed }} +  * <nowiki>{{ result | failed }}</nowiki> 
-  * {{ result | changed }} +  * <nowiki>{{ result | changed }}</nowiki> 
-  * {{ result | success }} +  * <nowiki>{{ result | success }}</nowiki> 
-  * {{ result | skipped }} +  * <nowiki>{{ result | skipped }}</nowiki> 
-  * {{ var | manditory }} +  * <nowiki>{{ var | manditory }}</nowiki> 
-  * {{ var | default(5) }} +  * <nowiki>{{ var | default(5) }}</nowiki> 
-  * {{ list1 | unique }} +  * <nowiki>{{ list1 | unique }}</nowiki> 
-  * {{ list1 | union(list2) }} +  * <nowiki>{{ list1 | union(list2) }}</nowiki> 
-  * {{ list1 | intersect(list2) }} +  * <nowiki>{{ list1 | intersect(list2) }}</nowiki> 
-  * {{ list1 | difference(list2) }} +  * <nowiki>{{ list1 | difference(list2) }}</nowiki> 
-  * {{ list1 | symmetric_difference(list2) }} +  * <nowiki>{{ list1 | symmetric_difference(list2) }}</nowiki> 
-  * {{ path | basename }} +  * <nowiki>{{ path | basename }}</nowiki> 
-  * {{ path | dirname }} +  * <nowiki>{{ path | dirname }}</nowiki> 
-  * {{ path | expanduser }} +  * <nowiki>{{ path | expanduser }}</nowiki> 
-  * {{ path | realpath }} +  * <nowiki>{{ path | realpath }}</nowiki> 
-  * {{ var | b64decode }} +  * <nowiki>{{ var | b64decode }}</nowiki> 
-  * {{ var | b64encode }} +  * <nowiki>{{ var | b64encode }}</nowiki> 
-  * {{ filename | md5 }} +  * <nowiki>{{ filename | md5 }}</nowiki> 
-  * {{ var | bool }} +  * <nowiki>{{ var | bool }}</nowiki> 
-  * {{ var | int }} +  * <nowiki>{{ var | int }}</nowiki> 
-  * {{ var | quote }} +  * <nowiki>{{ var | quote }}</nowiki> 
-  * {{ var | md5 }} +  * <nowiki>{{ var | md5 }}</nowiki> 
-  * {{ var | fileglob }} +  * <nowiki>{{ var | fileglob }}</nowiki> 
-  * {{ var | match }} +  * <nowiki>{{ var | match }}</nowiki> 
-  * {{ var | search }} +  * <nowiki>{{ var | search }}</nowiki> 
-  * {{ var | regex }}+  * <nowiki>{{ var | regex }}</nowiki>
  
 See also [[http://jinja.pocoo.org/docs/templates/#builtin-filters|default jinja2 filters]]. In YAML, values starting ''{'' must be quoted. See also [[http://jinja.pocoo.org/docs/templates/#builtin-filters|default jinja2 filters]]. In YAML, values starting ''{'' must be quoted.
줄 240: 줄 239:
 ===== Lookups ===== ===== Lookups =====
  
-  * {{ lookup('file', '/etc/foo.txt') }} +  * <nowiki>{{ lookup('file', '/etc/foo.txt') }}</nowiki> 
-  * {{ lookup('password', '/tmp/passwordfile chars=ascii') }} +  * <nowiki>{{ lookup('password', '/tmp/passwordfile chars=ascii') }}</nowiki> 
-  * {{ lookup('env','HOME') }} +  * <nowiki>{{ lookup('env','HOME') }}</nowiki> 
-  * {{ lookup('pipe','date') }} +  * <nowiki>{{ lookup('pipe','date') }}</nowiki> 
-  * {{ lookup('redis_kv', 'redis://localhost:6379,somekey') }} +  * <nowiki>{{ lookup('redis_kv', 'redis://localhost:6379,somekey') }}</nowiki> 
-  * {{ lookup('dnstxt', 'example.com') }} +  * <nowiki>{{ lookup('dnstxt', 'example.com') }}</nowiki> 
-  * {{ lookup('template', './some_template.j2') }}+  * <nowiki>{{ lookup('template', './some_template.j2') }}</nowiki>
  
 ===== Conditions ===== ===== Conditions =====
줄 252: 줄 251:
 ''when:'' ''when:''
  
-  * var == "Vaue", var >= 5, etc. +  * ''var == "Vaue"''''var >= 5'', etc. 
-  * var, where var coreces to boolean (yes, true, True, TRUE) +  * ''var'', where ''var'' coreces to boolean (yes, true, True, TRUE) 
-  * var is defined, var is not defined +  * ''var is defined''''var is not defined'' 
-  * <condition1> and <condition2> (also or?)+  * ''<nowiki><condition1> and <condition2></nowiki>'' (also or?)
  
 Combined with ''with_items'', the when statement is processed for each item. Combined with ''with_items'', the when statement is processed for each item.
줄 461: 줄 460:
 ==== First found: ==== ==== First found: ====
  
 +<WRAP prewrap>
 +<code yaml>
 - name: template a file - name: template a file
   template: src={{ item }} dest=/etc/myapp/foo.conf   template: src={{ item }} dest=/etc/myapp/foo.conf
줄 704: 줄 705:
 ==== ansible-pull ==== ==== ansible-pull ====
  
 +<WRAP prewrap>
 +<code bash>
 Usage: ansible-pull [options] [playbook.yml] Usage: ansible-pull [options] [playbook.yml]
  
  • ansible_summary.1536113770.txt.gz
  • 마지막으로 수정됨: 2018/09/05 02:16
  • 저자 koov