1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
- hosts: localhost
gather_facts: false
vars_prompt:
name: vars_prompt_var
default: hamsandwich
handlers:
- name: handler1
debug:
msg: handler1
- debug:
msg: listen1
listen:
- listen1
roles:
- setup_remote_tmp_dir
tasks:
- name: ok
debug:
msg: ok
- name: changed
debug:
msg: changed
changed_when: true
- name: skipped
debug:
msg: skipped
when: false
- name: failed
debug:
msg: failed
failed_when: true
ignore_errors: true
- name: unreachable
ping:
delegate_to: example.org
ignore_unreachable: true
vars:
ansible_timeout: 1
- name: loop
debug:
ignore_errors: true
changed_when: item.changed
failed_when: item.failed
when: item.when
loop:
# ok
- changed: false
failed: false
when: true
# changed
- changed: true
failed: false
when: true
# failed
- changed: false
failed: true
when: true
# skipped
- changed: false
failed: false
when: false
- name: notify handler1
debug:
msg: notify handler1
changed_when: true
notify:
- handler1
- name: notify listen1
debug:
msg: notify listen1
changed_when: true
notify:
- listen1
- name: retry ok
debug:
register: result
until: result.attempts == 2
retries: 1
delay: 0
- name: retry failed
debug:
register: result
until: result.attempts == 3
retries: 1
delay: 0
ignore_errors: true
- name: async poll ok
command: sleep 3
async: 5
poll: 2
- name: async poll failed
shell: sleep 3; false
async: 5
poll: 2
ignore_errors: true
- include_tasks: include_me.yml
- name: diff
copy:
content: diff
dest: '{{ remote_tmp_dir }}/diff.txt'
diff: true
- hosts: i_dont_exist
- hosts: localhost
gather_facts: false
max_fail_percentage: 0
tasks:
- fail:
|