ansible/test/integration/targets/dnf/tasks/dnfinstallroot.yml
Matt Clay 149336319a
Clean up local_action and delegate_to in tests. (#55835)
* Remove unnecessary delegate_to in tests.

* Remove incorrect delegate_to in tests.

* Remove unnecessary use of local_action in tests.

* Remove incorrect use of local_action in tests.

* Remove unnecessary use of local_action in tests.

* Remove incorrect use of local_action in tests.

* Remove unnecessary use of local_action in tests.

* Use delegate_to instead of local_action in tests.

* Use setup_remote_tmp_dir instead of TMPDIR.
2019-04-26 17:33:59 -07:00

46 lines
1.1 KiB
YAML

# make a installroot
- name: Create installroot
command: mktemp -d "{{ remote_tmp_dir }}/ansible.test.XXXXXX"
register: dnfroot
- name: Make a necessary directory
file:
path: "/{{ dnfroot.stdout }}/etc/dnf/vars/"
state: directory
mode: 0755
- name: Populate directory
copy:
content: "{{ ansible_distribution_version }}\n"
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