diff options
author | David Shrewsbury <Shrews@users.noreply.github.com> | 2021-04-20 17:19:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-20 17:19:29 +0200 |
commit | d44eb03f49c89cc8a3e398d37ea35db572b354e7 (patch) | |
tree | d830627b0635f4510abce88afb98f6b584221aa3 /test | |
parent | correct how to install Docker SDK for Python (#74288) (diff) | |
download | ansible-d44eb03f49c89cc8a3e398d37ea35db572b354e7.tar.xz ansible-d44eb03f49c89cc8a3e398d37ea35db572b354e7.zip |
Remove include from tests (#74330)
Diffstat (limited to 'test')
25 files changed, 43 insertions, 37 deletions
diff --git a/test/integration/targets/any_errors_fatal/on_includes.yml b/test/integration/targets/any_errors_fatal/on_includes.yml index 981d9f46d0..cbc51cb239 100644 --- a/test/integration/targets/any_errors_fatal/on_includes.yml +++ b/test/integration/targets/any_errors_fatal/on_includes.yml @@ -4,4 +4,4 @@ hosts: testhost,testhost2 any_errors_fatal: True tasks: - - include: test_fatal.yml + - import_tasks: test_fatal.yml diff --git a/test/integration/targets/become/tasks/main.yml b/test/integration/targets/become/tasks/main.yml index 3feb5cc729..b4c7b6015d 100644 --- a/test/integration/targets/become/tasks/main.yml +++ b/test/integration/targets/become/tasks/main.yml @@ -1,5 +1,5 @@ - include_vars: default.yml -- include: default.yml -- include: sudo.yml -- include: su.yml +- import_tasks: default.yml +- import_tasks: sudo.yml +- import_tasks: su.yml diff --git a/test/integration/targets/blocks/main.yml b/test/integration/targets/blocks/main.yml index 012d5ab270..efe358a3b4 100644 --- a/test/integration/targets/blocks/main.yml +++ b/test/integration/targets/blocks/main.yml @@ -96,8 +96,8 @@ tasks: - block: - name: include fail.yml in tasks - include: fail.yml - args: + import_tasks: fail.yml + vars: msg: "failed from tasks" - name: tasks flag should not be set after failure set_fact: @@ -106,8 +106,8 @@ - set_fact: rescue_run_after_include_fail: true - name: include fail.yml in rescue - include: fail.yml - args: + import_tasks: fail.yml + vars: msg: "failed from rescue" - name: flag should not be set after failure in rescue set_fact: diff --git a/test/integration/targets/blocks/nested_fail.yml b/test/integration/targets/blocks/nested_fail.yml index 31ae870e37..12e33cb47d 100644 --- a/test/integration/targets/blocks/nested_fail.yml +++ b/test/integration/targets/blocks/nested_fail.yml @@ -1,3 +1,3 @@ -- include: fail.yml - args: +- import_tasks: fail.yml + vars: msg: "nested {{msg}}" diff --git a/test/integration/targets/blocks/nested_nested_fail.yml b/test/integration/targets/blocks/nested_nested_fail.yml index e9a050fb98..f63fa5ce27 100644 --- a/test/integration/targets/blocks/nested_nested_fail.yml +++ b/test/integration/targets/blocks/nested_nested_fail.yml @@ -1,3 +1,3 @@ -- include: nested_fail.yml - args: +- import_tasks: nested_fail.yml + vars: msg: "nested {{msg}}" diff --git a/test/integration/targets/copy/tasks/tests.yml b/test/integration/targets/copy/tasks/tests.yml index be9553179e..fa4254c79a 100644 --- a/test/integration/targets/copy/tasks/tests.yml +++ b/test/integration/targets/copy/tasks/tests.yml @@ -1489,13 +1489,13 @@ # src is a file, dest is a non-existent directory (2 levels of directories): # using remote_src # checks that dest is created -- include: dest_in_non_existent_directories_remote_src.yml +- include_tasks: file=dest_in_non_existent_directories_remote_src.yml with_items: - { src: 'foo.txt', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/foo.txt' } # src is a file, dest is file in a non-existent directory: checks that a failure occurs # using remote_src -- include: src_file_dest_file_in_non_existent_dir_remote_src.yml +- include_tasks: file=src_file_dest_file_in_non_existent_dir_remote_src.yml with_items: - 'new_sub_dir1/sub_dir2/foo.txt' - 'new_sub_dir1/foo.txt' @@ -1504,7 +1504,7 @@ # src is a file, dest is a non-existent directory (2 levels of directories): # checks that dest is created -- include: dest_in_non_existent_directories.yml +- include_tasks: file=dest_in_non_existent_directories.yml with_items: - { src: 'foo.txt', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/foo.txt' } - { src: 'subdir', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/subdir/bar.txt' } @@ -1513,7 +1513,7 @@ - { src: 'subdir/', dest: 'new_sub_dir1/sub_dir2', check: 'new_sub_dir1/sub_dir2/bar.txt' } # src is a file, dest is file in a non-existent directory: checks that a failure occurs -- include: src_file_dest_file_in_non_existent_dir.yml +- include_tasks: file=src_file_dest_file_in_non_existent_dir.yml with_items: - 'new_sub_dir1/sub_dir2/foo.txt' - 'new_sub_dir1/foo.txt' diff --git a/test/integration/targets/dpkg_selections/tasks/main.yaml b/test/integration/targets/dpkg_selections/tasks/main.yaml index 6abd1dec10..abf9fa1b45 100644 --- a/test/integration/targets/dpkg_selections/tasks/main.yaml +++ b/test/integration/targets/dpkg_selections/tasks/main.yaml @@ -1,3 +1,3 @@ --- - - include: 'dpkg_selections.yaml' + - include_tasks: file='dpkg_selections.yaml' when: ansible_distribution in ('Ubuntu', 'Debian') diff --git a/test/integration/targets/file/tasks/directory_as_dest.yml b/test/integration/targets/file/tasks/directory_as_dest.yml index 9b6ddb5dc9..85451e43fc 100644 --- a/test/integration/targets/file/tasks/directory_as_dest.yml +++ b/test/integration/targets/file/tasks/directory_as_dest.yml @@ -1,6 +1,6 @@ # File module tests for overwriting directories - name: Initialize the test output dir - include: initialize.yml + import_tasks: initialize.yml # We need to make this more consistent: # https://github.com/ansible/proposals/issues/111 diff --git a/test/integration/targets/file/tasks/selinux_tests.yml b/test/integration/targets/file/tasks/selinux_tests.yml index 6a95c4427a..8efe819543 100644 --- a/test/integration/targets/file/tasks/selinux_tests.yml +++ b/test/integration/targets/file/tasks/selinux_tests.yml @@ -17,7 +17,7 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. - name: Initialize the test output dir - include: initialize.yml + import_tasks: initialize.yml - name: touch a file for testing file: path={{output_dir}}/foo-se.txt state=touch diff --git a/test/integration/targets/file/tasks/state_link.yml b/test/integration/targets/file/tasks/state_link.yml index 1753481538..991159e2e7 100644 --- a/test/integration/targets/file/tasks/state_link.yml +++ b/test/integration/targets/file/tasks/state_link.yml @@ -1,7 +1,7 @@ # file module tests for dealing with symlinks (state=link) - name: Initialize the test output dir - include: initialize.yml + import_tasks: initialize.yml # # Basic absolute symlink to a file diff --git a/test/integration/targets/handlers/roles/test_handlers_include/handlers/main.yml b/test/integration/targets/handlers/roles/test_handlers_include/handlers/main.yml index abe01be4ba..6c3b73c6a3 100644 --- a/test/integration/targets/handlers/roles/test_handlers_include/handlers/main.yml +++ b/test/integration/targets/handlers/roles/test_handlers_include/handlers/main.yml @@ -1 +1 @@ -- include: handlers.yml +- import_tasks: handlers.yml diff --git a/test/integration/targets/handlers/test_handlers_include.yml b/test/integration/targets/handlers/test_handlers_include.yml index 5514fc1094..158266d2d3 100644 --- a/test/integration/targets/handlers/test_handlers_include.yml +++ b/test/integration/targets/handlers/test_handlers_include.yml @@ -6,7 +6,7 @@ notify: test handler tags: ['playbook_include_handlers'] handlers: - - include: handlers.yml + - import_tasks: handlers.yml - name: verify that role can include handler hosts: testhost diff --git a/test/integration/targets/incidental_ios_file/tasks/cli.yaml b/test/integration/targets/incidental_ios_file/tasks/cli.yaml index d4f663b394..3eb57691ce 100644 --- a/test/integration/targets/incidental_ios_file/tasks/cli.yaml +++ b/test/integration/targets/incidental_ios_file/tasks/cli.yaml @@ -10,7 +10,7 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test cases (connection=ansible.netcommon.network_cli) - include: "{{ test_case_to_run }}" + include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/incidental_ios_file/tasks/main.yaml b/test/integration/targets/incidental_ios_file/tasks/main.yaml index 415c99d8b1..24ad94aea2 100644 --- a/test/integration/targets/incidental_ios_file/tasks/main.yaml +++ b/test/integration/targets/incidental_ios_file/tasks/main.yaml @@ -1,2 +1,2 @@ --- -- { include: cli.yaml, tags: ['cli'] } +- { import_tasks: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/incidental_setup_rabbitmq/tasks/main.yml b/test/integration/targets/incidental_setup_rabbitmq/tasks/main.yml index ad401fb344..e6c870894c 100644 --- a/test/integration/targets/incidental_setup_rabbitmq/tasks/main.yml +++ b/test/integration/targets/incidental_setup_rabbitmq/tasks/main.yml @@ -1,5 +1,5 @@ --- -- include: ubuntu.yml +- include_tasks: ubuntu.yml when: - ansible_distribution == 'Ubuntu' - ansible_distribution_release != 'focal' diff --git a/test/integration/targets/incidental_vyos_config/tasks/cli.yaml b/test/integration/targets/incidental_vyos_config/tasks/cli.yaml index 22a71d96e6..d601bb700a 100644 --- a/test/integration/targets/incidental_vyos_config/tasks/cli.yaml +++ b/test/integration/targets/incidental_vyos_config/tasks/cli.yaml @@ -10,13 +10,17 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + include_tasks: "file={{ test_case_to_run }}" + vars: + ansible_connection: ansible.netcommon.network_cli with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" + include_tasks: "file={{ test_case_to_run }}" + vars: + ansible_connection: local with_first_found: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/incidental_vyos_config/tasks/cli_config.yaml b/test/integration/targets/incidental_vyos_config/tasks/cli_config.yaml index 8ed2874819..7e673560cb 100644 --- a/test/integration/targets/incidental_vyos_config/tasks/cli_config.yaml +++ b/test/integration/targets/incidental_vyos_config/tasks/cli_config.yaml @@ -10,7 +10,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + include_tasks: "file={{ test_case_to_run }}" + vars: + ansible_connection: ansible.netcommon.network_cli with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/incidental_vyos_config/tasks/main.yaml b/test/integration/targets/incidental_vyos_config/tasks/main.yaml index 13977a44b1..0d4e8fdddc 100644 --- a/test/integration/targets/incidental_vyos_config/tasks/main.yaml +++ b/test/integration/targets/incidental_vyos_config/tasks/main.yaml @@ -1,3 +1,3 @@ --- -- {include: cli.yaml, tags: ['cli']} -- {include: cli_config.yaml, tags: ['cli_config']} +- {import_tasks: cli.yaml, tags: ['cli']} +- {import_tasks: cli_config.yaml, tags: ['cli_config']} diff --git a/test/integration/targets/incidental_vyos_lldp_interfaces/tasks/cli.yaml b/test/integration/targets/incidental_vyos_lldp_interfaces/tasks/cli.yaml index 83496e0e56..c6923f3ef2 100644 --- a/test/integration/targets/incidental_vyos_lldp_interfaces/tasks/cli.yaml +++ b/test/integration/targets/incidental_vyos_lldp_interfaces/tasks/cli.yaml @@ -11,7 +11,7 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: "{{ test_case_to_run }}" + include_tasks: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli with_items: "{{ test_items }}" diff --git a/test/integration/targets/incidental_vyos_lldp_interfaces/tasks/main.yaml b/test/integration/targets/incidental_vyos_lldp_interfaces/tasks/main.yaml index d4cf26fc4a..a6d418bb4a 100644 --- a/test/integration/targets/incidental_vyos_lldp_interfaces/tasks/main.yaml +++ b/test/integration/targets/incidental_vyos_lldp_interfaces/tasks/main.yaml @@ -1,2 +1,2 @@ --- -- {include: cli.yaml, tags: ['cli']} +- {import_tasks: cli.yaml, tags: ['cli']} diff --git a/test/integration/targets/incidental_win_data_deduplication/tasks/main.yml b/test/integration/targets/incidental_win_data_deduplication/tasks/main.yml index ae6be90ecb..83c7197c64 100644 --- a/test/integration/targets/incidental_win_data_deduplication/tasks/main.yml +++ b/test/integration/targets/incidental_win_data_deduplication/tasks/main.yml @@ -1,2 +1,2 @@ --- -- include: pre_test.yml +- import_tasks: pre_test.yml diff --git a/test/integration/targets/incidental_win_data_deduplication/tasks/pre_test.yml b/test/integration/targets/incidental_win_data_deduplication/tasks/pre_test.yml index f72955e46b..0d1c3d50ed 100644 --- a/test/integration/targets/incidental_win_data_deduplication/tasks/pre_test.yml +++ b/test/integration/targets/incidental_win_data_deduplication/tasks/pre_test.yml @@ -34,7 +34,7 @@ - name: Run tests block: - - include: tests.yml + - import_tasks: tests.yml always: - name: Detach disk win_command: diskpart.exe /s {{ remote_tmp_dir }}\partition_deletion_script.txt diff --git a/test/integration/targets/rpm_key/tasks/main.yaml b/test/integration/targets/rpm_key/tasks/main.yaml index 9f6fd4ec60..6f71ca6ead 100644 --- a/test/integration/targets/rpm_key/tasks/main.yaml +++ b/test/integration/targets/rpm_key/tasks/main.yaml @@ -1,2 +1,2 @@ - - include: 'rpm_key.yaml' + - include_tasks: 'rpm_key.yaml' when: ansible_os_family == "RedHat" diff --git a/test/integration/targets/task_ordering/tasks/main.yml b/test/integration/targets/task_ordering/tasks/main.yml index 4a7828bf42..a666006b7a 100644 --- a/test/integration/targets/task_ordering/tasks/main.yml +++ b/test/integration/targets/task_ordering/tasks/main.yml @@ -1,7 +1,7 @@ - set_fact: temppath: "{{ remote_tmp_dir }}/output.txt" -- include: taskorder-include.yml +- include_tasks: taskorder-include.yml with_items: - 1 - 2 diff --git a/test/integration/targets/template/tasks/main.yml b/test/integration/targets/template/tasks/main.yml index da80343686..6d1a72c198 100644 --- a/test/integration/targets/template/tasks/main.yml +++ b/test/integration/targets/template/tasks/main.yml @@ -716,4 +716,4 @@ that: "\"'y' is undefined\" in error.msg" # aliases file requires root for template tests so this should be safe -- include: backup_test.yml +- import_tasks: backup_test.yml |