2021-05-02 17:12:46 +12:00
|
|
|
---
|
|
|
|
|
# This is an example playbook to execute Ansible tests.
|
|
|
|
|
|
|
|
|
|
- name: Verify
|
|
|
|
|
hosts: all
|
|
|
|
|
tasks:
|
|
|
|
|
- name: Retrieve yum repofile
|
|
|
|
|
shell: cat /etc/yum.repos.d/epel.repo
|
|
|
|
|
ignore_errors: true
|
|
|
|
|
register: repofile
|
|
|
|
|
|
|
|
|
|
- name: metalink is not present
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- "'metalink=' not in repofile.stdout"
|
|
|
|
|
|
|
|
|
|
- name: baseurl is defined
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- "'baseurl=' in repofile.stdout"
|
|
|
|
|
|
|
|
|
|
- name: mirror is specified correctly
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
2021-05-02 22:58:14 +12:00
|
|
|
- "'{{ lookup('env', 'EPEL_MIRROR_URL') }}' in repofile.stdout"
|
2021-05-02 23:13:31 +12:00
|
|
|
|
|
|
|
|
- name: try to install htop from EPEL
|
|
|
|
|
package:
|
|
|
|
|
name: htop
|
|
|
|
|
state: latest
|
|
|
|
|
|
|
|
|
|
- name: Gather the rpm package facts
|
|
|
|
|
package_facts:
|
|
|
|
|
manager: auto
|
|
|
|
|
|
|
|
|
|
- name: is htop actually installed?
|
|
|
|
|
assert:
|
|
|
|
|
that: 'htop' in ansible_facts.packages
|