Make APT pinning noop on distros that don't use APT

Change-Id: I7d9920468d9719158135d0a85d711341cf46868e
This commit is contained in:
Mohammed Naser 2018-06-22 13:28:38 -04:00
parent e616cde2a3
commit 17c1b0b632
2 changed files with 6 additions and 1 deletions

View File

@ -17,7 +17,9 @@
template:
src: apt_pinned_packages.perf.j2
dest: "/etc/apt/preferences.d/{{ apt_package_pinning_file_name }}"
when: apt_pinned_packages is defined
when:
- ansible_pkg_mgr == 'apt'
- apt_pinned_packages is defined
tags:
- apt-package-pinning
- apt-install

View File

@ -23,12 +23,15 @@
slurp:
src: "/etc/apt/preferences.d/test.pref"
register: preference_file
when: ansible_pkg_mgr == 'apt'
- name: Read preference file
set_fact:
preference_contents: "{{ preference_file.content | b64decode }}"
when: ansible_pkg_mgr == 'apt'
- name: Check pin files contents
assert:
that:
- "'Pin: version 9.9.9-version' in preference_contents"
- "'Pin: origin test-origin.org' in preference_contents"
- "'Pin: release o=TestRelease' in preference_contents"
when: ansible_pkg_mgr == 'apt'