From 11eee1181a9ee8f69bc36c44bbe63cf0554b0bff Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Mon, 10 Feb 2020 15:25:38 -0800 Subject: [PATCH] Split out platform specific cleanup in pip test. --- .../targets/pip/tasks/default_cleanup.yml | 5 +++++ .../targets/pip/tasks/freebsd_cleanup.yml | 6 ++++++ test/integration/targets/pip/tasks/main.yml | 19 +++++++------------ 3 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 test/integration/targets/pip/tasks/default_cleanup.yml create mode 100644 test/integration/targets/pip/tasks/freebsd_cleanup.yml 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: