From 86268b09a1745ee5cd2cfe7210729e3e39507923 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 28 Mar 2019 14:05:56 -0700 Subject: [PATCH] Support ansible-galaxy test on FreeBSD Python 3.x. --- .../targets/ansible-galaxy/cleanup.yml | 16 ++++++++++++++++ test/integration/targets/ansible-galaxy/runme.sh | 2 ++ .../integration/targets/ansible-galaxy/setup.yml | 5 +++++ 3 files changed, 23 insertions(+) create mode 100644 test/integration/targets/ansible-galaxy/cleanup.yml diff --git a/test/integration/targets/ansible-galaxy/cleanup.yml b/test/integration/targets/ansible-galaxy/cleanup.yml new file mode 100644 index 00000000000..5c0dc5117b1 --- /dev/null +++ b/test/integration/targets/ansible-galaxy/cleanup.yml @@ -0,0 +1,16 @@ +- hosts: localhost + vars: + git_install: '{{ lookup("file", lookup("env", "OUTPUT_DIR") + "/git_install.json") | from_json }}' + tasks: + - 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" diff --git a/test/integration/targets/ansible-galaxy/runme.sh b/test/integration/targets/ansible-galaxy/runme.sh index 58f9a0a9e01..c34d9370840 100755 --- a/test/integration/targets/ansible-galaxy/runme.sh +++ b/test/integration/targets/ansible-galaxy/runme.sh @@ -4,6 +4,8 @@ set -eux -o pipefail ansible-playbook setup.yml +trap 'ansible-playbook cleanup.yml' EXIT + # Need a relative custom roles path for testing various scenarios of -p galaxy_relative_rolespath="my/custom/roles/path" diff --git a/test/integration/targets/ansible-galaxy/setup.yml b/test/integration/targets/ansible-galaxy/setup.yml index 581902474d4..a82d02aed2d 100644 --- a/test/integration/targets/ansible-galaxy/setup.yml +++ b/test/integration/targets/ansible-galaxy/setup.yml @@ -4,3 +4,8 @@ package: name: git when: ansible_distribution != "MacOSX" + register: git_install + - name: save install result + copy: + content: '{{ git_install }}' + dest: '{{ lookup("env", "OUTPUT_DIR") }}/git_install.json'