diff options
| author | sirkubax <muszynski@so1.net> | 2018-01-01 21:21:39 +0100 | 
|---|---|---|
| committer | sirkubax <muszynski@so1.net> | 2018-01-01 21:21:39 +0100 | 
| commit | 91a81abb7de572b5fb595f641688b75144de5b75 (patch) | |
| tree | 7224c796ee1a0b58d5ce805f392934e95b8a7b86 | |
| parent | 4041b4c45db1796c3a8410211c6a355728b71c6a (diff) | |
update
| -rw-r--r-- | ansible.html.markdown | 15 | 
1 files changed, 12 insertions, 3 deletions
| diff --git a/ansible.html.markdown b/ansible.html.markdown index 4462cbbb..e4023e5a 100644 --- a/ansible.html.markdown +++ b/ansible.html.markdown @@ -239,7 +239,7 @@ query from:  ```bash  # read playbooks/lookup.yml -# run +# then run  (venv) user@host:~/ansible-for-learnXinYminutes$ ansible-playbook playbooks/lookup.yml  ``` @@ -257,7 +257,7 @@ ansible -m shell -a 'echo "{{ my_variable }}"' -e 'my_variable="{{ lookup("pipe"  ### Register and Conditional   #### Register -Another way to dynamicaly generate the variable content is a `register` command +Another way to dynamicaly generate the variable content is a `register` command.  `Register` is also useful to store an output of a task, and use it's value as a logic   for execution further tasks.  ``` @@ -265,7 +265,6 @@ for execution further tasks.  ```  ```yaml -#file content  ---  - hosts: localhost    tasks: @@ -293,6 +292,16 @@ for execution further tasks.  You can define complex logic with Ansible and Jinja functions. Most common is usage of `when:`, with some variable (often dynamicly generated in previous playbook steps with `register` or `lookup`) +```yaml +--- +- hosts: localhost +  tasks: +   - name: check the system capacity +     shell: df -h / +     when: some_variable in 'a string' +  roles: +   - { role: mid_nagios_probe, when: allow_nagios_probes } +```  ### ansible - tags, limit | 
