@ -84,8 +84,8 @@
- "not dnf_result.changed"
- "not dnf_result.changed"
# Multiple packages
# Multiple packages
- name : uninstall sos and shar utils
- name : uninstall sos and pci utils
dnf : name=sos, shar utils state=removed
dnf : name=sos, pci utils state=removed
register : dnf_result
register : dnf_result
- name : check sos with rpm
- name : check sos with rpm
@ -93,19 +93,19 @@
failed_when : False
failed_when : False
register : rpm_sos_result
register : rpm_sos_result
- name : check shar utils with rpm
- name : check pci utils with rpm
shell : rpm -q shar utils
shell : rpm -q pci utils
failed_when : False
failed_when : False
register : rpm_ shar utils_result
register : rpm_ pci utils_result
- name : verify packages installed
- name : verify packages installed
assert:
assert:
that:
that:
- "rpm_sos_result.rc != 0"
- "rpm_sos_result.rc != 0"
- "rpm_ shar utils_result.rc != 0"
- "rpm_ pci utils_result.rc != 0"
- name : install sos and shar utils as comma separated
- name : install sos and pci utils as comma separated
dnf : name=sos, shar utils state=present
dnf : name=sos, pci utils state=present
register : dnf_result
register : dnf_result
- name : check sos with rpm
- name : check sos with rpm
@ -113,10 +113,10 @@
failed_when : False
failed_when : False
register : rpm_sos_result
register : rpm_sos_result
- name : check shar utils with rpm
- name : check pci utils with rpm
shell : rpm -q shar utils
shell : rpm -q pci utils
failed_when : False
failed_when : False
register : rpm_ shar utils_result
register : rpm_ pci utils_result
- name : verify packages installed
- name : verify packages installed
assert:
assert:
@ -124,17 +124,17 @@
- "not dnf_result.failed | default(False)"
- "not dnf_result.failed | default(False)"
- "dnf_result.changed"
- "dnf_result.changed"
- "rpm_sos_result.rc == 0"
- "rpm_sos_result.rc == 0"
- "rpm_ shar utils_result.rc == 0"
- "rpm_ pci utils_result.rc == 0"
- name : uninstall sos and shar utils
- name : uninstall sos and pci utils
dnf : name=sos, shar utils state=removed
dnf : name=sos, pci utils state=removed
register : dnf_result
register : dnf_result
- name : install sos and shar utils as list
- name : install sos and pci utils as list
dnf:
dnf:
name:
name:
- sos
- sos
- shar utils
- pci utils
state : present
state : present
register : dnf_result
register : dnf_result
@ -143,10 +143,10 @@
failed_when : False
failed_when : False
register : rpm_sos_result
register : rpm_sos_result
- name : check shar utils with rpm
- name : check pci utils with rpm
shell : rpm -q shar utils
shell : rpm -q pci utils
failed_when : False
failed_when : False
register : rpm_ shar utils_result
register : rpm_ pci utils_result
- name : verify packages installed
- name : verify packages installed
assert:
assert:
@ -154,17 +154,17 @@
- "not dnf_result.failed | default(False)"
- "not dnf_result.failed | default(False)"
- "dnf_result.changed"
- "dnf_result.changed"
- "rpm_sos_result.rc == 0"
- "rpm_sos_result.rc == 0"
- "rpm_ shar utils_result.rc == 0"
- "rpm_ pci utils_result.rc == 0"
- name : uninstall sos and shar utils
- name : uninstall sos and pci utils
dnf:
dnf:
name : "sos, shar utils"
name : "sos, pci utils"
state : removed
state : removed
register : dnf_result
register : dnf_result
- name : install sos and shar utils as comma separated with spaces
- name : install sos and pci utils as comma separated with spaces
dnf:
dnf:
name : "sos, shar utils"
name : "sos, pci utils"
state : present
state : present
register : dnf_result
register : dnf_result
@ -174,9 +174,9 @@
register : rpm_sos_result
register : rpm_sos_result
- name : check sos with rpm
- name : check sos with rpm
shell : rpm -q shar utils
shell : rpm -q pci utils
failed_when : False
failed_when : False
register : rpm_ shar utils_result
register : rpm_ pci utils_result
- name : verify packages installed
- name : verify packages installed
assert:
assert:
@ -184,13 +184,13 @@
- "not dnf_result.failed | default(False)"
- "not dnf_result.failed | default(False)"
- "dnf_result.changed"
- "dnf_result.changed"
- "rpm_sos_result.rc == 0"
- "rpm_sos_result.rc == 0"
- "rpm_ shar utils_result.rc == 0"
- "rpm_ pci utils_result.rc == 0"
- name : uninstall sos and shar utils
- name : uninstall sos and pci utils
dnf:
dnf:
name:
name:
- sos
- sos
- shar utils
- pci utils
state : removed
state : removed
- name : install non-existent rpm
- name : install non-existent rpm
@ -267,6 +267,8 @@
# GROUP INSTALL
# GROUP INSTALL
# Using 'Books and Guides' because it is only 5 packages and a 7.3 M download on Fedora 26.
# Using 'Books and Guides' because it is only 5 packages and a 7.3 M download on Fedora 26.
# It also doesn't install anything that will tamper with our Python environment.
# It also doesn't install anything that will tamper with our Python environment.
- name : install Books and Guides group block (Fedora)
block:
- name : install Books and Guides group
- name : install Books and Guides group
dnf:
dnf:
name : "@Books and Guides"
name : "@Books and Guides"
@ -371,6 +373,115 @@
# cleanup until https://github.com/ansible/ansible/issues/27377 is resolved
# cleanup until https://github.com/ansible/ansible/issues/27377 is resolved
- shell : dnf -y group install "Books and Guides" && dnf -y group remove "Books and Guides"
- shell : dnf -y group install "Books and Guides" && dnf -y group remove "Books and Guides"
when : ansible_distribution == "Fedora"
- name : install RPM Development Tools group block (rhel8 beta)
block:
- name : install RPM Development Tools group
dnf:
name : "@RPM Development Tools"
state : present
register : dnf_result
- name : verify installation of the group
assert:
that:
- "not dnf_result.failed | default(False)"
- "dnf_result.changed"
- name : verify dnf module outputs
assert:
that:
- "'changed' in dnf_result"
- "'results' in dnf_result"
- name : install the group again
dnf:
name : "@RPM Development Tools"
state : present
register : dnf_result
- name : verify nothing changed
assert:
that:
- "not dnf_result.changed"
- name : verify dnf module outputs
assert:
that:
- "'changed' in dnf_result"
- "'msg' in dnf_result"
- name : verify that bc is not installed
dnf:
name : bc
state : absent
- name : install the group again but also with a package that is not yet installed
dnf:
name:
- "@RPM Development Tools"
- bc
state : present
register : dnf_result
- name : verify bc is installed
assert:
that:
- "dnf_result.changed"
- name : verify dnf module outputs
assert:
that:
- "'changed' in dnf_result"
- "'results' in dnf_result"
- name : try to install the group again, with --check to check 'changed'
dnf:
name : "@RPM Development Tools"
state : present
check_mode : yes
register : dnf_result
- name : verify nothing changed
assert:
that:
- "not dnf_result.changed"
- name : verify dnf module outputs
assert:
that:
- "'changed' in dnf_result"
- "'msg' in dnf_result"
# cleanup until https://github.com/ansible/ansible/issues/27377 is resolved
- shell : 'dnf -y group install "RPM Development Tools" && dnf -y group remove "RPM Development Tools"'
register : shell_dnf_result
# GROUP UPGRADE - this will go to the same method as group install
# but through group_update - it is its invocation we're testing here
# see commit 119c9e5d6eb572c4a4800fbe8136095f9063c37b
- name : install latest RPM Development Tools
dnf:
name : "@RPM Development Tools"
state : latest
register : dnf_result
- name : verify installation of the group
assert:
that:
- "not dnf_result.failed | default(False)"
- "dnf_result.changed"
- name : verify dnf module outputs
assert:
that:
- "'changed' in dnf_result"
- "'results' in dnf_result"
# cleanup until https://github.com/ansible/ansible/issues/27377 is resolved
- shell : dnf -y group install "RPM Development Tools" && dnf -y group remove "RPM Development Tools"
when : ansible_distribution == "RedHat" and ansible_distribution_major_version|int == 8
- name : try to install non existing group
- name : try to install non existing group
dnf:
dnf:
@ -440,30 +551,49 @@
command : dnf install --allowerasing -y coreutils
command : dnf install --allowerasing -y coreutils
changed_when : '"Nothing to do" not in coreutils_install.stdout'
changed_when : '"Nothing to do" not in coreutils_install.stdout'
register : coreutils_install
register : coreutils_install
when : ansible_distribution == "Fedora"
- block:
- name : install Web Server environment block (Fedora)
block:
- name : install Web Server environment
- name : install Web Server environment
dnf:
dnf:
name : "@Web Server"
name : "@Web Server"
state : latest
state : latest
register : dnf_result
register : dnf_result
- name : verify installation of the environment
assert:
that:
- "not dnf_result.failed | default(False)"
- "dnf_result.changed"
- name : verify dnf module outputs
assert:
that:
- "'changed' in dnf_result"
- "'results' in dnf_result"
always:
always:
- name : reinstall coreutils-single if coreutils was installed
- name : reinstall coreutils-single if coreutils was installed
command : dnf install --allowerasing -y coreutils-single
command : dnf install --allowerasing -y coreutils-single
when : coreutils_install is changed
when : coreutils_install is changed
when : ansible_distribution == "Fedora"
- name : install Server environment block (rhel8 beta)
block:
- name : install Server environment
dnf:
name : "@Server"
state : latest
register : dnf_result
- name : verify installation of the environment
- name : verify installation of the environment
assert:
assert:
that:
that:
- "not dnf_result.failed | default(False)"
- "not dnf_result.failed | default(False)"
- "dnf_result.changed"
- "dnf_result.changed"
- name : verify dnf module outputs
- name : verify dnf module outputs
assert:
assert:
that:
that:
- "'changed' in dnf_result"
- "'changed' in dnf_result"
- "'results' in dnf_result"
- "'results' in dnf_result"
when : ansible_distribution == "RedHat"
# https://github.com/ansible/ansible/issues/39704
# https://github.com/ansible/ansible/issues/39704
- name : install non-existent rpm, state=latest
- name : install non-existent rpm, state=latest
@ -685,3 +815,5 @@
assert:
assert:
that:
that:
- "'vim-minimal' in rpm_output.stdout"
- "'vim-minimal' in rpm_output.stdout"
when:
- ansible_distribution == 'Fedora'