summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/dnf/tasks/dnfinstallroot.yml
blob: 19f67069096bf728a95c4b79ce65764606863896 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# make a installroot
- name: Create installroot
  command: mktemp -d "{{ remote_tmp_dir }}/ansible.test.XXXXXX"
  register: dnfroot

# This will drag in > 200 MB.
- name: attempt installroot
  dnf: name=sos installroot="/{{ dnfroot.stdout }}/" disable_gpg_check=yes releasever={{ansible_facts['distribution_major_version']}}
  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