1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/dnf/tasks/dnfreleasever.yml
Peter Janes 67493ebdee Add a 'releasever' parameter for dnf. Fixes #33314. (#37493)
* Add a 'releasever' parameter for dnf. #33314

* Set a default value for releasever

* Fix a variable name typo
2018-05-24 23:22:53 -04:00

48 lines
1.1 KiB
YAML

# make an installroot
- name: Create installroot
local_action:
module: command mktemp -d "{{lookup('env', 'TMPDIR') | default('/tmp', true)}}/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"
- name: attempt releasever to the installroot
dnf:
name: filesystem
installroot: '/{{dnfroot.stdout}}'
releasever: 22
register: dnf_result
- name: check filesystem version
shell: rpm -q filesystem --root="/{{dnfroot.stdout}}/"
failed_when: False
register: rpm_result
- debug: var=dnf_result
- debug: var=rpm_result
- name: verify installation was done
assert:
that:
- "not dnf_result.failed | default(False)"
- "dnf_result.changed"
- "rpm_result.rc == 0"
- name: verify the version
assert:
that:
- "rpm_result.stdout.find('fc22') != -1"
- name: cleanup installroot
file:
path: "/{{dnfroot.stdout}}/"
state: absent