2017-01-05 09:24:20 +01:00
|
|
|
# make a installroot
|
|
|
|
- name: Create installroot
|
2019-04-27 02:33:59 +02:00
|
|
|
command: mktemp -d "{{ remote_tmp_dir }}/ansible.test.XXXXXX"
|
2017-01-05 09:24:20 +01:00
|
|
|
register: dnfroot
|
|
|
|
|
|
|
|
- name: Make a necessary directory
|
|
|
|
file:
|
|
|
|
path: "/{{ dnfroot.stdout }}/etc/dnf/vars/"
|
|
|
|
state: directory
|
|
|
|
mode: 0755
|
|
|
|
|
|
|
|
- name: Populate directory
|
|
|
|
copy:
|
2020-04-30 00:00:35 +02:00
|
|
|
# We need '8' for CentOS, but '8.x' for RHEL.
|
|
|
|
content: "{{ ansible_distribution_version|int if ansible_distribution != 'RedHat' else ansible_distribution_version }}\n"
|
2017-01-05 09:24:20 +01:00
|
|
|
dest: "/{{ dnfroot.stdout }}/etc/dnf/vars/releasever"
|
|
|
|
|
|
|
|
# This will drag in > 200 MB.
|
|
|
|
- name: attempt installroot
|
|
|
|
dnf: name=sos installroot="/{{ dnfroot.stdout }}/" disable_gpg_check=yes
|
|
|
|
register: dnf_result
|
|
|
|
|
|
|
|
- name: check sos with rpm in installroot
|
|
|
|
shell: rpm -q sos --root="/{{ dnfroot.stdout }}/"
|
|
|
|
failed_when: False
|
|
|
|
register: rpm_result
|
|
|
|
|
|
|
|
- debug: var=dnf_result
|
|
|
|
- debug: var=rpm_result
|
|
|
|
|
|
|
|
- name: verify installation of sos in installroot
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "not dnf_result.failed | default(False)"
|
|
|
|
- "dnf_result.changed"
|
|
|
|
- "rpm_result.rc == 0"
|
|
|
|
|
|
|
|
- name: verify dnf module outputs in /
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "'changed' in dnf_result"
|
|
|
|
- "'results' in dnf_result"
|
|
|
|
|
|
|
|
- name: cleanup installroot
|
|
|
|
file:
|
|
|
|
path: "/{{ dnfroot.stdout }}/"
|
|
|
|
state: absent
|