Use ansible_facts[] instead of fact variables

See https://github.com/ansible/ansible/issues/73654

Change-Id: Ib7e1fa820767fe419eadd6309311204433e9bf20
This commit is contained in:
Jonathan Rosser 2021-02-22 16:42:40 +00:00
parent 2eec061c1b
commit 7c8888ac6d
2 changed files with 5 additions and 5 deletions

View File

@ -18,8 +18,8 @@
src: apt_pinned_packages.perf.j2
dest: "/etc/apt/preferences.d/{{ apt_package_pinning_file_name }}"
when:
- ansible_pkg_mgr == 'apt'
- ansible_facts['pkg_mgr'] == 'apt'
- apt_pinned_packages is defined
tags:
- apt-package-pinning
- apt-install
- apt-install

View File

@ -23,15 +23,15 @@
slurp:
src: "/etc/apt/preferences.d/test.pref"
register: preference_file
when: ansible_pkg_mgr == 'apt'
when: ansible_facts['pkg_mgr'] == 'apt'
- name: Read preference file
set_fact:
preference_contents: "{{ preference_file.content | b64decode }}"
when: ansible_pkg_mgr == 'apt'
when: ansible_facts['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'
when: ansible_facts['pkg_mgr'] == 'apt'