More tests

pull/82893/head
Martin Krizek 3 months ago
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

@ -54,4 +54,7 @@ ANSIBLE_PRIVATE_ROLE_VARS=1 ansible-playbook privacy.yml -e @vars/privacy_vars.y
ANSIBLE_PRIVATE_ROLE_VARS=0 ansible-playbook privacy.yml -e @vars/privacy_vars.yml "$@"
ansible-playbook privacy.yml -e @vars/privacy_vars.yml "$@"
ansible-playbook end_role.yml "$@"
for strategy in linear free; do
ANSIBLE_STRATEGY=$strategy ansible-playbook end_role.yml "$@"
ANSIBLE_STRATEGY=$strategy ansible-playbook -i host1,host2 end_role_nested.yml "$@"
done

Loading…
Cancel
Save