diff --git a/test/integration/targets/pip/tasks/default_cleanup.yml b/test/integration/targets/pip/tasks/default_cleanup.yml new file mode 100644 index 00000000000..f2265c093db --- /dev/null +++ b/test/integration/targets/pip/tasks/default_cleanup.yml @@ -0,0 +1,5 @@ +- name: remove unwanted packages + package: + name: git + state: absent + when: git_install.changed diff --git a/test/integration/targets/pip/tasks/freebsd_cleanup.yml b/test/integration/targets/pip/tasks/freebsd_cleanup.yml new file mode 100644 index 00000000000..fa224d830de --- /dev/null +++ b/test/integration/targets/pip/tasks/freebsd_cleanup.yml @@ -0,0 +1,6 @@ +- name: remove auto-installed packages from FreeBSD + pkgng: + name: git + state: absent + autoremove: yes + when: git_install.changed diff --git a/test/integration/targets/pip/tasks/main.yml b/test/integration/targets/pip/tasks/main.yml index d796d13b816..20e84d79438 100644 --- a/test/integration/targets/pip/tasks/main.yml +++ b/test/integration/targets/pip/tasks/main.yml @@ -20,18 +20,13 @@ - include_tasks: pip.yml always: - - name: remove unwanted packages - package: - name: git - state: absent - when: git_install.changed - - - name: remove auto-installed packages from FreeBSD - pkgng: - name: git - state: absent - autoremove: yes - when: git_install.changed and ansible_distribution == "FreeBSD" + - name: platform specific cleanup + include_tasks: "{{ cleanup_filename }}" + with_first_found: + - "{{ ansible_distribution | lower }}_cleanup.yml" + - "default_cleanup.yml" + loop_control: + loop_var: cleanup_filename when: ansible_fips|bool != True module_defaults: pip: