Skip to content

Commit

Permalink
test : print a final list of all tasks / test run
Browse files Browse the repository at this point in the history
  • Loading branch information
zerwes committed Dec 14, 2023
1 parent 14395d7 commit af6a8bd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions test/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
ansible_python_interpreter: "/usr/bin/env python" # REQUIRED for guthub action
config_path: test/{{ inventory_hostname }}.xml
local_config_path: cfg/{{ inventory_hostname }}.xml
all_tests: {}
tasks:
- name: "simple task test {{ _testtask }} ..."
ansible.builtin.include_tasks: testsimpletask.yml
Expand All @@ -20,3 +21,6 @@
- dnsserver
when:
- test | default(_testtask) == _testtask
- name: report all tests
ansible.builtin.debug:
var: all_tests
5 changes: 5 additions & 0 deletions test/testsimpletask.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---

- name: register task in all_tests
ansible.builtin.set_fact:
all_tests: "{{ all_tests | combine({_testtask: []}) }}"
when: not _testtask in all_tests.keys()

- name: "{{ _testtask }} test loop ..."
ansible.builtin.include_tasks: testsimpletaskgeneric.yml
vars:
Expand Down
7 changes: 3 additions & 4 deletions test/testsimpletaskgeneric.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---

# subtasks for filter test loop
- name: register test in all_tests
ansible.builtin.set_fact:
all_tests: "{{ all_tests | combine({_testtask: all_tests[_testtask] + [_test]}) }}"

#- name: set test item
# ansible.builtin.set_fact:
# _test: "{{ item | basename | splitext | first }}"
- name: "copy test file {{ _test }}"
ansible.builtin.copy:
src: "{{ lookup('ansible.builtin.first_found', testxmlfile) }}"
Expand Down

0 comments on commit af6a8bd

Please sign in to comment.