mirror of https://github.com/ansible/ansible.git
More tests
parent
a890890d22
commit
052f858e90
@ -1,25 +1,31 @@
|
||||
- hosts: localhost
|
||||
gather_facts: false
|
||||
pre_tasks:
|
||||
- set_fact:
|
||||
play_checkpoint: 1
|
||||
roles:
|
||||
- end_role_inside
|
||||
tasks:
|
||||
# FIXME more tests
|
||||
- import_role:
|
||||
name: end_role_inside
|
||||
allow_duplicates: true
|
||||
- set_fact:
|
||||
play_checkpoint: "{{ play_checkpoint|int + 1 }}"
|
||||
|
||||
- import_role:
|
||||
name: end_role_inside
|
||||
allow_duplicates: true
|
||||
|
||||
- import_role:
|
||||
- set_fact:
|
||||
play_checkpoint: "{{ play_checkpoint|int + 1 }}"
|
||||
|
||||
- include_role:
|
||||
name: end_role_inside
|
||||
allow_duplicates: false
|
||||
|
||||
- set_fact:
|
||||
plays_life_after_end_role: true
|
||||
play_checkpoint: "{{ play_checkpoint|int + 1 }}"
|
||||
post_tasks:
|
||||
- assert:
|
||||
that:
|
||||
- role_executed|int == 2
|
||||
- after_end_role is undefined
|
||||
- plays_life_after_end_role is defined
|
||||
- play_checkpoint|int == 4
|
||||
- role_handler_ran is defined
|
||||
|
@ -0,0 +1,6 @@
|
||||
- hosts: host1,host2
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- include_role:
|
||||
name: end_role_inside
|
||||
tasks_from: nested.yml
|
@ -0,0 +1,15 @@
|
||||
- set_fact:
|
||||
end_role_cond: "{{ inventory_hostname == 'host1' }}"
|
||||
|
||||
- include_role:
|
||||
name: end_role_inside_nested
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- after_end_role is undefined
|
||||
when: inventory_hostname == "host1"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- after_end_role
|
||||
when: inventory_hostname == "host2"
|
@ -0,0 +1,5 @@
|
||||
- meta: end_role
|
||||
when: end_role_cond
|
||||
|
||||
- set_fact:
|
||||
after_end_role: true
|
@ -0,0 +1 @@
|
||||
- import_tasks: import_tasks.yml
|
@ -0,0 +1 @@
|
||||
- include_tasks: include_tasks.yml
|
Loading…
Reference in New Issue