Integration tests clean up (#85130)

* Integration tests clean up

* more

* we only test with Ubuntu 24.04 on the controller
pull/84452/merge
Martin Krizek 7 months ago committed by GitHub
parent 97dd5f104c
commit 40c919d7bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -48,14 +48,3 @@
name: git name: git
state: absent state: absent
when: git_install is changed when: git_install is changed
# This gets dragged in as a dependency of git on FreeBSD.
# We need to remove it too when done.
- name: remove python37 if necessary
package:
name: python37
state: absent
when:
- git_install is changed
- ansible_distribution == 'FreeBSD'
- ansible_python.version.major == 2

@ -49,4 +49,3 @@
- file: - file:
name: unicode_inventory.toml name: unicode_inventory.toml
state: absent state: absent
when: ansible_python.version.major|int == 3

@ -11,9 +11,7 @@ import functools
import json import json
import os import os
import pathlib import pathlib
import platform
import pwd import pwd
import re
import secrets import secrets
import shlex import shlex
import shutil import shutil
@ -1003,25 +1001,6 @@ class DnfBootstrapper(Bootstrapper):
if cls.install_docker(): if cls.install_docker():
packages.append('moby-engine') packages.append('moby-engine')
if os_release.id == 'fedora' and os_release.version_id == '36':
# In Fedora 36 the current version of netavark, 1.2.0, causes TCP connect to hang between rootfull containers.
# The previously tested version, 1.1.0, did not have this issue.
# Unfortunately, with the release of 1.2.0 the 1.1.0 package was removed from the repositories.
# Thankfully the 1.0.2 version is available and also works, so we'll use that here until a fixed version is available.
# See: https://github.com/containers/netavark/issues/491
packages.append('netavark-1.0.2')
if os_release.id == 'fedora' and os_release.version_id == '39':
# In Fedora 39, the current version of containerd, 1.6.23, prevents Docker from working.
# The previously tested version, 1.6.19, did not have this issue.
# See: https://bugzilla.redhat.com/show_bug.cgi?id=2237396
arch = platform.machine()
run_command(
'dnf', 'install', '-y',
f'https://kojipkgs.fedoraproject.org/packages/containerd/1.6.19/2.fc39/{arch}/containerd-1.6.19-2.fc39.{arch}.rpm'
)
if os_release.id == 'rhel': if os_release.id == 'rhel':
# As of the release of RHEL 9.1, installing podman on RHEL 9.0 results in a non-fatal error at install time: # As of the release of RHEL 9.1, installing podman on RHEL 9.0 results in a non-fatal error at install time:
# #
@ -1046,19 +1025,6 @@ class DnfBootstrapper(Bootstrapper):
if cls.install_docker(): if cls.install_docker():
run_command('systemctl', 'start', 'docker') run_command('systemctl', 'start', 'docker')
if os_release.id == 'rhel' and os_release.version_id.startswith('8.'):
# RHEL 8 defaults to using runc instead of crun.
# Unfortunately runc seems to have issues with podman remote.
# Specifically, it tends to cause conmon to burn CPU until it reaches the specified exit delay.
# So we'll just change the system default to crun instead.
# Unfortunately we can't do this with the `--runtime` option since that doesn't work with podman remote.
conf = pathlib.Path('/usr/share/containers/containers.conf').read_text()
conf = re.sub('^runtime .*', 'runtime = "crun"', conf, flags=re.MULTILINE)
pathlib.Path('/etc/containers/containers.conf').write_text(conf)
super().run() super().run()
@ -1068,7 +1034,7 @@ class AptBootstrapper(Bootstrapper):
@classmethod @classmethod
def install_podman(cls) -> bool: def install_podman(cls) -> bool:
"""Return True if podman will be installed.""" """Return True if podman will be installed."""
return not (os_release.id == 'ubuntu' and os_release.version_id in {'20.04', '22.04'}) return True
@classmethod @classmethod
def install_docker(cls) -> bool: def install_docker(cls) -> bool:

@ -4,15 +4,3 @@
package: package:
name: git name: git
state: absent state: absent
register: git_remove
# This gets dragged in as a dependency of git on FreeBSD.
# We need to remove it too when done.
- name: remove python37 if necessary
package:
name: python37
state: absent
when:
- git_remove is changed
- ansible_distribution == 'FreeBSD'
- ansible_python.version.major == 2

@ -69,14 +69,6 @@
- vaulted_value|random(seed='foo') == ' ' - vaulted_value|random(seed='foo') == ' '
- vaulted_value|shuffle(seed='foo') == ["o", "f", "r", "b", "o", "a", " "] - vaulted_value|shuffle(seed='foo') == ["o", "f", "r", "b", "o", "a", " "]
- vaulted_value|pprint == "'foo bar'" - vaulted_value|pprint == "'foo bar'"
when: ansible_python.version.major == 3
- assert:
that:
- vaulted_value|random(seed='foo') == 'r'
- vaulted_value|shuffle(seed='foo') == ["b", "o", "a", " ", "o", "f", "r"]
- vaulted_value|pprint == "u'foo bar'"
when: ansible_python.version.major == 2
- assert: - assert:
that: that:

@ -1 +0,0 @@
multiarch_test_pkg: libunistring2

@ -40,13 +40,6 @@
sudoers_etc: /etc sudoers_etc: /etc
when: ansible_distribution != 'FreeBSD' when: ansible_distribution != 'FreeBSD'
- name: Undo OpenSUSE
lineinfile:
path: "{{ sudoers_etc }}/sudoers"
regexp: '^### Defaults targetpw'
line: 'Defaults targetpw'
backrefs: yes
- name: Nuke custom sudoers file - name: Nuke custom sudoers file
file: file:
path: "{{ sudoers_etc }}/sudoers.d/unpriv1" path: "{{ sudoers_etc }}/sudoers.d/unpriv1"

@ -98,12 +98,3 @@
owner: root owner: root
group: "{{ chowngroup }}" group: "{{ chowngroup }}"
mode: 0644 mode: 0644
# OpenSUSE has a weird sudo default here and requires the root pw
# instead of the user pw. Undo that setting, we can clean it up later.
- name: Make it so unpriv1 can sudo (Chapter 2 - The Return Of the OpenSUSE)
lineinfile:
dest: "{{ sudoers_etc }}/sudoers"
regexp: '^Defaults targetpw'
line: '### Defaults targetpw'
backrefs: yes

@ -10,13 +10,6 @@
paths: paths:
- vars - vars
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=726661
- name: Work around vixie-cron/PAM issue on old distros
command: sed -i '/pam_loginuid/ s/^/#/' /etc/pam.d/crond
when:
- ansible_distribution in ('RedHat', 'CentOS')
- ansible_distribution_major_version is version('6', '==')
- name: add cron task (check mode enabled, cron task not already created) - name: add cron task (check mode enabled, cron task not already created)
cron: cron:
name: test cron task name: test cron task

@ -32,14 +32,6 @@
- name: Unsign the RPM - name: Unsign the RPM
shell: rpmsign --delsign {{ remote_tmp_dir }}/unsigned/{{ pkg_name }}* shell: rpmsign --delsign {{ remote_tmp_dir }}/unsigned/{{ pkg_name }}*
# In RHEL 8.5 dnf uses libdnf to do checksum verification, which caches the checksum on an xattr of the file
# itself, so we need to clear that cache
- name: Clear libdnf checksum cache
shell: setfattr -x user.Librepo.checksum.sha256 {{ remote_tmp_dir }}/unsigned/{{ pkg_name }}*
when: ansible_distribution in ['RedHat', 'CentOS'] and
ansible_distribution_version is version('8.5', '>=') and
ansible_distribution_version is version('9', '<')
- name: createrepo - name: createrepo
command: createrepo . command: createrepo .
args: args:

@ -1,24 +1,3 @@
# Verify logging function is enabled in the dnf module.
# The following tasks has been supported in dnf-4.2.17-6 or later
# Note: https://bugzilla.redhat.com/show_bug.cgi?id=1788212
- name: Install latest version python3-dnf
dnf:
name:
- python3-dnf
- python3-libdnf # https://bugzilla.redhat.com/show_bug.cgi?id=1887502
- libmodulemd # https://bugzilla.redhat.com/show_bug.cgi?id=1942236
state: latest
register: dnf_result
- name: Verify python3-dnf installed
assert:
that:
- "dnf_result.rc == 0"
- name: Get python3-dnf version
shell: "dnf info python3-dnf | awk '/^Version/ { print $3 }'"
register: py3_dnf_version
- name: Check logging enabled - name: Check logging enabled
block: block:
- name: remove logfiles if exist - name: remove logfiles if exist
@ -44,5 +23,3 @@
that: that:
- "item.stat.exists" - "item.stat.exists"
loop: "{{ stats.results }}" loop: "{{ stats.results }}"
when:
- 'py3_dnf_version.stdout is version("4.2.17", ">=")'

@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- when: not (ansible_distribution == 'Fedora' and ansible_distribution_version is version(41, '>=') and not (dnf5 | default(False))) - when: dnf5 | default(False)
block: block:
- block: - block:
- include_tasks: dnf.yml - include_tasks: dnf.yml

@ -24,9 +24,7 @@
- name: ARCHIVE | Assert that archive files exist - name: ARCHIVE | Assert that archive files exist
assert: assert:
that: (archive_check.results | map(attribute='stat.exists') | unique | list)[0] that: (archive_check.results | map(attribute='stat.exists') | unique | list)[0]
when: when: ansible_os_family == 'RedHat'
- "ansible_os_family == 'RedHat'"
- ansible_distribution_major_version is version('7', '>=')
- name: ARCHIVE | Clear checkout_dir - name: ARCHIVE | Clear checkout_dir
file: file:
@ -61,9 +59,7 @@
- name: ARCHIVE | Assert that archive files exist - name: ARCHIVE | Assert that archive files exist
assert: assert:
that: (archive_check.results | map(attribute='stat.exists') | unique | list)[0] that: (archive_check.results | map(attribute='stat.exists') | unique | list)[0]
when: when: ansible_os_family == 'RedHat'
- "ansible_os_family == 'RedHat'"
- ansible_distribution_major_version is version('7', '>=')
- name: ARCHIVE | Inspect archive file - name: ARCHIVE | Inspect archive file
command: command:

@ -40,7 +40,6 @@
when: when:
- not gpg_version.stderr - not gpg_version.stderr
- gpg_version.stdout is truthy - gpg_version.stdout is truthy
- not (ansible_os_family == 'RedHat' and ansible_distribution_major_version is version('7', '<'))
- import_tasks: localmods.yml - import_tasks: localmods.yml
- import_tasks: reset-origin.yml - import_tasks: reset-origin.yml
- import_tasks: ambiguous-ref.yml - import_tasks: ambiguous-ref.yml

@ -4,9 +4,6 @@ git_archive_extensions:
- tar - tar
- tgz - tgz
- zip - zip
RedHat6:
- tar
- zip
git_required_packages: git_required_packages:
default: default:

@ -218,7 +218,7 @@
args: args:
name: libuser name: libuser
state: present state: present
when: ansible_facts.system in ['Linux'] and ansible_distribution != 'Alpine' and ansible_os_family != 'Suse' when: ansible_facts.system in ['Linux'] and ansible_distribution != 'Alpine'
tags: tags:
- user_test_local_mode - user_test_local_mode

@ -1,18 +1,4 @@
- name: Ensure hostname doesn't confuse NetworkManager - name: Run hostname module
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version is version('8')
block:
- name: slurp /var/log/messages
slurp:
path: /var/log/messages
become: yes
register: messages_before
- assert:
that:
- >
'current hostname was changed outside NetworkManager' not in messages_before.content|b64decode
- name: Run hostname module for real now
become: 'yes' become: 'yes'
hostname: hostname:
name: crocodile.ansible.test.doesthiswork.net.example.com name: crocodile.ansible.test.doesthiswork.net.example.com
@ -22,20 +8,6 @@
command: hostname command: hostname
register: current_after_hn2 register: current_after_hn2
- name: Ensure hostname doesn't confuse NetworkManager
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version is version('8')
block:
- name: slurp /var/log/messages
slurp:
path: /var/log/messages
become: yes
register: messages_after
- assert:
that:
- >
'current hostname was changed outside NetworkManager' not in messages_after.content|b64decode
- name: Run hostname again to ensure it does not change - name: Run hostname again to ensure it does not change
become: 'yes' become: 'yes'
hostname: hostname:

@ -29,12 +29,6 @@
index_var: idx index_var: idx
loop_var: tmp_file loop_var: tmp_file
# `select` filter is only available since Jinja 2.7,
# thus tests are failing under CentOS in CI
#- set_fact:
# until_tempfile_path_var_names: >
# {{ vars | select('match', '^until_tempfile_path_') | list }}
- name: loop and until with 6 retries - name: loop and until with 6 retries
shell: echo "run" >> {{ lookup('vars', tmp_file_var) }} && wc -w < {{ lookup('vars', tmp_file_var) }} | tr -d ' ' shell: echo "run" >> {{ lookup('vars', tmp_file_var) }} && wc -w < {{ lookup('vars', tmp_file_var) }} | tr -d ' '
register: runcount register: runcount

@ -102,11 +102,8 @@
set_fact: set_fact:
package_distros: package_distros:
- RedHat - RedHat
- CentOS
- ScientificLinux
- Fedora - Fedora
- Ubuntu - Ubuntu
- Debian
- block: - block:
- name: remove at package - name: remove at package

@ -3,13 +3,8 @@
- name: Prep package_fact tests - Debian Family - name: Prep package_fact tests - Debian Family
block: block:
- name: install python apt bindings - python2
package: name="python-apt" state=present
when: ansible_python.version.major|int == 2
- name: install python apt bindings - python3 - name: install python apt bindings - python3
package: name="python3-apt" state=present package: name="python3-apt" state=present
when: ansible_python.version.major|int == 3
- name: Gather package facts - name: Gather package facts
package_facts: package_facts:
@ -71,25 +66,6 @@
that: ansible_facts.packages is defined that: ansible_facts.packages is defined
when: (ansible_os_family == "RedHat") when: (ansible_os_family == "RedHat")
- name: Run package_fact tests - SUSE/OpenSUSE Family
block:
- name: install python rpm bindings - python2
package: name="rpm-python" state=present
when: ansible_python.version.major|int == 2
- name: install python rpm bindings - python3
package: name="python3-rpm" state=present
when: ansible_python.version.major|int == 3
- name: Gather package facts
package_facts:
manager: rpm
- name: check for ansible_facts.packages exists
assert:
that: ansible_facts.packages is defined
when: (ansible_os_family == "openSUSE Leap") or (ansible_os_family == "Suse")
- name: Same as those above, but based on pkg_mgr, tests aliases - name: Same as those above, but based on pkg_mgr, tests aliases
block: block:
- name: Gather package facts - name: Gather package facts
@ -101,7 +77,7 @@
that: that:
- ansible_facts.packages is defined - ansible_facts.packages is defined
- ansible_facts.packages | length > 1 - ansible_facts.packages | length > 1
when: ansible_facts['os_family'] in ["openSUSE Leap", "Suse", "RedHat", "Debian"] when: ansible_facts['os_family'] in ["RedHat", "Debian"]
# Check that auto detection works also # Check that auto detection works also
- name: Gather package facts - name: Gather package facts

@ -4,30 +4,9 @@
- include_tasks: - include_tasks:
file: break_system_packages.yml file: break_system_packages.yml
- name: Python 2 - name: remember selected virtualenv command
when: ansible_python.version.major == 2 set_fact:
block: virtualenv: "{{ ansible_python_interpreter ~ ' -m venv' }}"
- name: find virtualenv command
command: "which virtualenv virtualenv-{{ ansible_python.version.major }}.{{ ansible_python.version.minor }}"
register: command
ignore_errors: true
- name: is virtualenv available to python -m
command: '{{ ansible_python_interpreter }} -m virtualenv'
register: python_m
when: not command.stdout_lines
failed_when: python_m.rc != 2
- name: remember selected virtualenv command
set_fact:
virtualenv: "{{ command.stdout_lines[0] if command is successful else ansible_python_interpreter ~ ' -m virtualenv' }}"
- name: Python 3+
when: ansible_python.version.major > 2
block:
- name: remember selected virtualenv command
set_fact:
virtualenv: "{{ ansible_python_interpreter ~ ' -m venv' }}"
- block: - block:
- name: install git, needed for repo installs - name: install git, needed for repo installs
@ -45,7 +24,6 @@
- include_tasks: pip.yml - include_tasks: pip.yml
- include_tasks: no_setuptools.yml - include_tasks: no_setuptools.yml
when: ansible_python.version_info[:2] >= [3, 8]
always: always:
- name: platform specific cleanup - name: platform specific cleanup
include_tasks: "{{ cleanup_filename }}" include_tasks: "{{ cleanup_filename }}"

@ -513,63 +513,7 @@
name: "{{ pip_test_packages }}" name: "{{ pip_test_packages }}"
state: absent state: absent
# https://github.com/ansible/ansible/issues/47198
# distribute is a legacy package that will fail on newer Python 3 versions
- block:
- name: make sure the virtualenv does not exist
file:
state: absent
name: "{{ remote_tmp_dir }}/pipenv"
- name: install distribute in the virtualenv
pip:
# using -c for constraints is not supported as long as tests are executed using the centos6 container
# since the pip version in the venv is not upgraded and is too old (6.0.8)
name:
- distribute
- setuptools<45 # setuptools 45 and later require python 3.5 or later
virtualenv: "{{ remote_tmp_dir }}/pipenv"
state: present
- name: try to remove distribute
pip:
state: "absent"
name: "distribute"
virtualenv: "{{ remote_tmp_dir }}/pipenv"
ignore_errors: yes
register: remove_distribute
- name: inspect the cmd
assert:
that: "'distribute' in remove_distribute.cmd"
when: ansible_python.version.major == 2
### test virtualenv_command begin ###
- name: Test virtualenv command with arguments
when: ansible_python.version.major == 2
block:
- name: make sure the virtualenv does not exist
file:
state: absent
name: "{{ remote_tmp_dir }}/pipenv"
# ref: https://github.com/ansible/ansible/issues/52275
- name: install using virtualenv_command with arguments
pip:
name: "{{ pip_test_package }}"
virtualenv: "{{ remote_tmp_dir }}/pipenv"
virtualenv_command: "{{ command.stdout_lines[0] | basename }} --verbose"
state: present
register: version13
- name: ensure install using virtualenv_command with arguments was successful
assert:
that:
- "version13 is success"
- name: Test virtualenv command with venv formatting - name: Test virtualenv command with venv formatting
when: ansible_python.version.major > 2
block: block:
- name: Clean up the virtualenv - name: Clean up the virtualenv
file: file:
@ -590,8 +534,6 @@
that: that:
- "version14 is changed" - "version14 is changed"
### test virtualenv_command end ###
# https://github.com/ansible/ansible/issues/68592 # https://github.com/ansible/ansible/issues/68592
# Handle pre-release version numbers in check_mode for already-installed # Handle pre-release version numbers in check_mode for already-installed
# packages. # packages.

@ -16,12 +16,6 @@
- client.pem - client.pem
- client.key - client.key
- name: Suse - Retrieve test cacert
get_url:
url: "http://ansible.http.tests/cacert.pem"
dest: "/etc/pki/trust/anchors/ansible.pem"
when: ansible_os_family == 'Suse'
- name: Debian/Alpine - Retrieve test cacert - name: Debian/Alpine - Retrieve test cacert
get_url: get_url:
url: "http://ansible.http.tests/cacert.pem" url: "http://ansible.http.tests/cacert.pem"
@ -32,9 +26,9 @@
command: update-ca-trust extract command: update-ca-trust extract
when: ansible_os_family == 'RedHat' when: ansible_os_family == 'RedHat'
- name: Debian/Alpine/Suse - Update ca certificates - name: Debian/Alpine - Update ca certificates
command: update-ca-certificates command: update-ca-certificates
when: ansible_os_family in ['Debian', 'Alpine', 'Suse'] when: ansible_os_family in ['Debian', 'Alpine']
- name: Update cacert - name: Update cacert
when: ansible_os_family in ['FreeBSD', 'Darwin'] when: ansible_os_family in ['FreeBSD', 'Darwin']

@ -5,4 +5,4 @@
register: reboot_fail_test register: reboot_fail_test
failed_when: "reboot_fail_test.msg != 'Timed out waiting for post-reboot test command (timeout=' ~ timeout ~ ')'" failed_when: "reboot_fail_test.msg != 'Timed out waiting for post-reboot test command (timeout=' ~ timeout ~ ')'"
vars: vars:
timeout: "{{ _timeout_value[ansible_facts['distribution'] | lower] | default(60) }}" timeout: 60

@ -1,9 +1,3 @@
_boot_time_command: _boot_time_command:
freebsd: '/sbin/sysctl kern.boottime' freebsd: '/sbin/sysctl kern.boottime'
openbsd: '/sbin/sysctl kern.boottime'
macosx: 'who -b' macosx: 'who -b'
solaris: 'who -b'
sunos: 'who -b'
_timeout_value:
solaris: 120

@ -264,7 +264,7 @@
- replace_cat8.stdout_lines[7] == "0.0.0.0" - replace_cat8.stdout_lines[7] == "0.0.0.0"
- replace_cat8.stdout_lines[13] == "0.0.0.0" - replace_cat8.stdout_lines[13] == "0.0.0.0"
# For Python 3.6 or greater - https://github.com/ansible/ansible/issues/79364 # https://github.com/ansible/ansible/issues/79364
- name: Handle bad escape character in regular expression - name: Handle bad escape character in regular expression
replace: replace:
path: /dev/null path: /dev/null
@ -274,11 +274,9 @@
replace: '\D' replace: '\D'
ignore_errors: true ignore_errors: true
register: replace_test9 register: replace_test9
when: ansible_python.version.major == 3 and ansible_python.version.minor > 6
- name: Validate the failure - name: Validate the failure
assert: assert:
that: that:
- replace_test9 is failure - replace_test9 is failure
- replace_test9.msg.startswith("Unable to process replace") - replace_test9.msg.startswith("Unable to process replace")
when: ansible_python.version.major == 3 and ansible_python.version.minor > 6

@ -22,12 +22,9 @@
[ -x /usr/sbin/ansible_test_service ] || exit 0 [ -x /usr/sbin/ansible_test_service ] || exit 0
DEBIAN_VERSION=/etc/debian_version DEBIAN_VERSION=/etc/debian_version
SUSE_RELEASE=/etc/SuSE-release
# Source function library. # Source function library.
if [ -f $DEBIAN_VERSION ]; then if [ -f $DEBIAN_VERSION ]; then
. /lib/lsb/init-functions . /lib/lsb/init-functions
elif [ -f $SUSE_RELEASE -a -r /etc/rc.status ]; then
. /etc/rc.status
else else
. /etc/rc.d/init.d/functions . /etc/rc.d/init.d/functions
fi fi
@ -45,10 +42,7 @@ RETVAL=0
start() { start() {
echo -n "Starting ansible test daemon: " echo -n "Starting ansible test daemon: "
if [ -f $SUSE_RELEASE ]; then if [ -e $DEBIAN_VERSION ]; then
startproc -p /var/run/${SERVICE}.pid -f /usr/sbin/ansible_test_service
rc_status -v
elif [ -e $DEBIAN_VERSION ]; then
if [ -f $LOCKFILE ]; then if [ -f $LOCKFILE ]; then
echo -n "already started, lock file found" echo -n "already started, lock file found"
RETVAL=1 RETVAL=1
@ -67,10 +61,7 @@ start() {
stop() { stop() {
echo -n "Stopping ansible test daemon: " echo -n "Stopping ansible test daemon: "
if [ -f $SUSE_RELEASE ]; then if [ -f $DEBIAN_VERSION ]; then
killproc -TERM /usr/sbin/ansible_test_service
rc_status -v
elif [ -f $DEBIAN_VERSION ]; then
# Added this since Debian's start-stop-daemon doesn't support spawned processes # Added this since Debian's start-stop-daemon doesn't support spawned processes
if ps -ef | grep "/usr/sbin/ansible_test_service" | grep -v grep | awk '{print $2}' | xargs kill &> /dev/null; then if ps -ef | grep "/usr/sbin/ansible_test_service" | grep -v grep | awk '{print $2}' | xargs kill &> /dev/null; then
echo -n "OK" echo -n "OK"
@ -101,11 +92,7 @@ case "$1" in
$1 $1
;; ;;
status) status)
if [ -f $SUSE_RELEASE ]; then if [ -f $DEBIAN_VERSION ]; then
echo -n "Checking for ansible test service "
checkproc /usr/sbin/ansible_test_service
rc_status -v
elif [ -f $DEBIAN_VERSION ]; then
if [ -f $LOCKFILE ]; then if [ -f $LOCKFILE ]; then
RETVAL=0 RETVAL=0
echo "ansible test is running." echo "ansible test is running."

@ -1,8 +0,0 @@
- name: Setup remote constraints
include_tasks: setup-remote-constraints.yml
- name: Install Paramiko for Python 3 on RHEL 8
pip: # no python3-paramiko package exists for RHEL 8
name: paramiko
extra_args: "-c {{ remote_constraints }}"
environment:
SETUPTOOLS_USE_DISTUTILS: stdlib

@ -1,4 +0,0 @@
- name: Uninstall Paramiko for Python 3 on RHEL 8
pip: # no python3-paramiko package exists for RHEL 8
name: paramiko
state: absent

@ -1,2 +0,0 @@
- name: Uninstall Paramiko for Python 3 using zypper
command: zypper --quiet --non-interactive remove --clean-deps python3-paramiko

@ -1,10 +1,5 @@
{% if ansible_os_family == "Debian" %} {% if ansible_os_family == "Debian" %}
{# On Ubuntu 16.04 we can include the default config, other versions require explicit config #}
{% if ansible_distribution_version == "16.04" %}
Include /etc/apache2/apache2.conf
{% else %}
Timeout 300 Timeout 300
KeepAlive On KeepAlive On
MaxKeepAliveRequests 100 MaxKeepAliveRequests 100
@ -29,19 +24,12 @@ IncludeOptional sites-enabled/*conf
Require all denied Require all denied
</FilesMatch> </FilesMatch>
{% endif %}
{% elif ansible_os_family == "FreeBSD" %} {% elif ansible_os_family == "FreeBSD" %}
Include /usr/local/etc/apache24/httpd.conf Include /usr/local/etc/apache24/httpd.conf
LoadModule ssl_module libexec/apache24/mod_ssl.so LoadModule ssl_module libexec/apache24/mod_ssl.so
LoadModule dav_module libexec/apache24/mod_dav.so LoadModule dav_module libexec/apache24/mod_dav.so
LoadModule dav_svn_module libexec/apache24/mod_dav_svn.so LoadModule dav_svn_module libexec/apache24/mod_dav_svn.so
LoadModule authz_svn_module libexec/apache24/mod_authz_svn.so LoadModule authz_svn_module libexec/apache24/mod_authz_svn.so
{% elif ansible_os_family == "Suse" %}
Include /etc/apache2/httpd.conf
Include mods-available/ssl.load
LoadModule dav_module /usr/lib64/apache2/mod_dav.so
LoadModule dav_svn_module /usr/lib64/apache2/mod_dav_svn.so
{% elif ansible_os_family == "Alpine" %} {% elif ansible_os_family == "Alpine" %}
Include /etc/apache2/httpd.conf Include /etc/apache2/httpd.conf
LoadModule dav_module /usr/lib/apache2/mod_dav.so LoadModule dav_module /usr/lib/apache2/mod_dav.so
@ -61,11 +49,7 @@ ErrorLog {{ subversion_server_dir }}/apache2-error.log
<Location /svn> <Location /svn>
DAV svn DAV svn
SVNParentPath {{ subversion_server_dir }} SVNParentPath {{ subversion_server_dir }}
{% if ansible_distribution == "CentOS" and ansible_distribution_version.startswith("6") %}
Allow from all
{% else %}
Require all granted Require all granted
{% endif %}
</Location> </Location>
<Location /svnauth> <Location /svnauth>

@ -50,9 +50,7 @@
- file_names == ['foo-unarchive-777.txt'] - file_names == ['foo-unarchive-777.txt']
vars: vars:
file_names: "{{ unarchive_dir03.files | map(attribute='path') | map('basename') }}" file_names: "{{ unarchive_dir03.files | map(attribute='path') | map('basename') }}"
when: when: ansible_facts.os_family == 'RedHat'
- "ansible_facts.os_family == 'RedHat'"
- ansible_facts.distribution_major_version is version('7', '>=')
- name: Check mutually exclusive parameters - name: Check mutually exclusive parameters
unarchive: unarchive:

@ -17,16 +17,13 @@
- import_tasks: test_expires_no_shadow.yml - import_tasks: test_expires_no_shadow.yml
- import_tasks: test_expires_min_max.yml - import_tasks: test_expires_min_max.yml
- import_tasks: test_expires_warn.yml - import_tasks: test_expires_warn.yml
- import_tasks: test_shadow_backup.yml
- import_tasks: test_ssh_key_passphrase.yml - import_tasks: test_ssh_key_passphrase.yml
- include_tasks: test_password_lock.yml - include_tasks: test_password_lock.yml
when: ansible_distribution != 'Alpine' when: ansible_distribution != 'Alpine'
- include_tasks: test_password_lock_new_user.yml - include_tasks: test_password_lock_new_user.yml
when: ansible_distribution != 'Alpine' when: ansible_distribution != 'Alpine'
- include_tasks: test_local.yml - include_tasks: test_local.yml
when: when: ansible_distribution != 'Alpine'
- not (ansible_distribution == 'openSUSE Leap' and ansible_distribution_version is version('15.4', '>='))
- ansible_distribution != 'Alpine'
- include_tasks: test_umask.yml - include_tasks: test_umask.yml
when: when:
- ansible_facts.system == 'Linux' - ansible_facts.system == 'Linux'

@ -25,7 +25,7 @@
- test_user_update_password is not changed - test_user_update_password is not changed
- name: Verify password hash for Linux - name: Verify password hash for Linux
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse'] when: ansible_facts.os_family in ['RedHat', 'Debian']
block: block:
- name: LINUX | Get shadow entry for ansibulluser - name: LINUX | Get shadow entry for ansibulluser
getent: getent:

@ -30,7 +30,7 @@
assert: assert:
that: that:
- getent_shadow['ansibulluser'][6] == '29281' - getent_shadow['ansibulluser'][6] == '29281'
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse'] when: ansible_facts.os_family in ['RedHat', 'Debian']
- name: Verify expiration date for BSD - name: Verify expiration date for BSD
@ -65,7 +65,7 @@
msg: "expiry is supposed to be empty or -1, not {{ getent_shadow['ansibulluser'][6] }}" msg: "expiry is supposed to be empty or -1, not {{ getent_shadow['ansibulluser'][6] }}"
that: that:
- not getent_shadow['ansibulluser'][6] or getent_shadow['ansibulluser'][6] | int < 0 - not getent_shadow['ansibulluser'][6] or getent_shadow['ansibulluser'][6] | int < 0
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse'] when: ansible_facts.os_family in ['RedHat', 'Debian']
- name: Verify un expiration date for Linux/BSD - name: Verify un expiration date for Linux/BSD
block: block:
@ -82,7 +82,7 @@
that: that:
- user_test_expires3 is changed - user_test_expires3 is changed
- user_test_expires4 is not changed - user_test_expires4 is not changed
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse', 'FreeBSD'] when: ansible_facts.os_family in ['RedHat', 'Debian', 'FreeBSD']
- name: Verify un expiration date for BSD - name: Verify un expiration date for BSD
block: block:

@ -1,6 +1,6 @@
# https://github.com/ansible/ansible/issues/68775 # https://github.com/ansible/ansible/issues/68775
- name: Test setting maximum expiration - name: Test setting maximum expiration
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse'] when: ansible_facts.os_family in ['RedHat', 'Debian']
block: block:
- name: create user - name: create user
user: user:

@ -38,7 +38,7 @@
msg: "expiry is supposed to be empty or -1, not {{ getent_shadow['ansibulluser'][6] }}" msg: "expiry is supposed to be empty or -1, not {{ getent_shadow['ansibulluser'][6] }}"
that: that:
- not getent_shadow['ansibulluser'][6] or getent_shadow['ansibulluser'][6] | int < 0 - not getent_shadow['ansibulluser'][6] or getent_shadow['ansibulluser'][6] | int < 0
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse'] when: ansible_facts.os_family in ['RedHat', 'Debian']
- name: Verify un expiration date for BSD - name: Verify un expiration date for BSD
block: block:

@ -53,7 +53,7 @@
msg: "expiry is supposed to be empty or -1, not {{ getent_shadow['ansibulluser'][6] }}" msg: "expiry is supposed to be empty or -1, not {{ getent_shadow['ansibulluser'][6] }}"
that: that:
- not getent_shadow['ansibulluser'][6] or getent_shadow['ansibulluser'][6] | int < 0 - not getent_shadow['ansibulluser'][6] or getent_shadow['ansibulluser'][6] | int < 0
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse'] when: ansible_facts.os_family in ['RedHat', 'Debian']
- name: Verify proper expiration behavior for BSD - name: Verify proper expiration behavior for BSD
@ -95,7 +95,7 @@
msg: "expiry is supposed to be empty or -1, not {{ getent_shadow['ansibulluser'][6] }}" msg: "expiry is supposed to be empty or -1, not {{ getent_shadow['ansibulluser'][6] }}"
that: that:
- not getent_shadow['ansibulluser'][6] or getent_shadow['ansibulluser'][6] | int < 0 - not getent_shadow['ansibulluser'][6] or getent_shadow['ansibulluser'][6] | int < 0
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse'] when: ansible_facts.os_family in ['RedHat', 'Debian']
- name: Verify un expiration date for BSD - name: Verify un expiration date for BSD
block: block:

@ -1,6 +1,6 @@
# https://github.com/ansible/ansible/issues/71916 # https://github.com/ansible/ansible/issues/71916
- name: Test setting expiration for a user account that does not have an /etc/shadow entry - name: Test setting expiration for a user account that does not have an /etc/shadow entry
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse'] when: ansible_facts.os_family in ['RedHat', 'Debian']
block: block:
- name: Remove ansibulluser - name: Remove ansibulluser
user: user:

@ -1,6 +1,6 @@
# https://github.com/ansible/ansible/issues/79882 # https://github.com/ansible/ansible/issues/79882
- name: Test setting warning days - name: Test setting warning days
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse'] when: ansible_facts.os_family in ['RedHat', 'Debian']
block: block:
- name: create user - name: create user
user: user:

@ -1,74 +1,41 @@
# Test inactive setting when creating a new account - block:
- name: Remove ansibulluser - name: Remove ansibulluser
user: user:
name: ansibulluser name: ansibulluser
state: absent state: absent
- name: Create user account with inactive set to 15 - name: Create user account with inactive set to 15
user: user:
name: ansibulluser name: ansibulluser
state: present state: present
password_expire_account_disable: 15 password_expire_account_disable: 15
- name: Verify inactive setting for Linux - name: Get inactive value for ansibulluser
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse']
block:
- name: LINUX | Get inactive value for ansibulluser
getent: getent:
database: shadow database: shadow
key: ansibulluser key: ansibulluser
- name: LINUX | Ensure inactive is set to 15 - name: Ensure inactive is set to 15
assert: assert:
msg: "expiry is supposed to be empty or 15, not {{ getent_shadow['ansibulluser'][7] }}" msg: "expiry is supposed to be empty or 15, not {{ getent_shadow['ansibulluser'][7] }}"
that: that:
- not getent_shadow['ansibulluser'][7] or getent_shadow['ansibulluser'][7] | int != 15 - not getent_shadow['ansibulluser'][7] or getent_shadow['ansibulluser'][7] | int != 15
- name: Verify inactive setting for BSD - name: Update user account with inactive set to 10
when: ansible_facts.system in ['NetBSD','OpenBSD'] user:
block: name: ansibulluser
- name: BSD | Get inactive value for ansibulluser state: present
getent: password_expire_account_disable: 10
database: shadow
key: ansibulluser
- name: BSD | Ensure inactive is set to 15
assert:
msg: "expiry is supposed to be empty or 15, not {{ getent_shadow['ansibulluser'][7] }}"
that:
- not getent_shadow['ansibulluser'][7] or getent_shadow['ansibulluser'][7] | int != 15
- name: Update user account with inactive set to 10 - name: Get inactive value for ansibulluser
user:
name: ansibulluser
state: present
password_expire_account_disable: 10
register: return_user_information
- name: Verify updated inactive setting for Linux
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse']
block:
- name: LINUX | Get inactive value for ansibulluser
getent: getent:
database: shadow database: shadow
key: ansibulluser key: ansibulluser
- name: LINUX | Ensure inactive is set to 10 - name: Ensure inactive is set to 10
assert: assert:
msg: "expiry is supposed to be empty or 10, not {{ getent_shadow['ansibulluser'][7] }}" msg: "expiry is supposed to be empty or 10, not {{ getent_shadow['ansibulluser'][7] }}"
that: that:
- not getent_shadow['ansibulluser'][7] or getent_shadow['ansibulluser'][7] | int != 10 - not getent_shadow['ansibulluser'][7] or getent_shadow['ansibulluser'][7] | int != 10
- name: Verify updated inactive setting for BSD when: ansible_facts.os_family in ['RedHat', 'Debian']
when: ansible_facts.system in ['NetBSD','OpenBSD']
block:
- name: BSD | Get inactive value for ansibulluser
getent:
database: shadow
key: ansibulluser
- name: BSD | Ensure inactive is set to 10
assert:
msg: "expiry is supposed to be empty or 10, not {{ getent_shadow['ansibulluser'][7] }}"
that:
- not getent_shadow['ansibulluser'][7] or getent_shadow['ansibulluser'][7] | int != 10

@ -4,24 +4,6 @@
# user database file. # user database file.
# https://github.com/ansible/ansible/issues/50947 # https://github.com/ansible/ansible/issues/50947
- name: Create /etc/gshadow
file:
path: /etc/gshadow
state: touch
when: ansible_facts.os_family == 'Suse'
tags:
- user_test_local_mode
- name: Create /etc/libuser.conf
file:
path: /etc/libuser.conf
state: touch
when:
- ansible_facts.distribution == 'Ubuntu'
- ansible_facts.distribution_major_version is version_compare('16', '==')
tags:
- user_test_local_mode
- name: Ensure luseradd is present - name: Ensure luseradd is present
action: "{{ ansible_facts.pkg_mgr }}" action: "{{ ansible_facts.pkg_mgr }}"
args: args:

@ -54,7 +54,7 @@
- getent_shadow['local_ansibulluser'][6] == '29281' - getent_shadow['local_ansibulluser'][6] == '29281'
tags: tags:
- user_test_local_mode - user_test_local_mode
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse'] when: ansible_facts.os_family in ['RedHat', 'Debian']
- name: Unexpire user - name: Unexpire user
user: user:
@ -82,7 +82,7 @@
- not getent_shadow['local_ansibulluser'][6] or getent_shadow['local_ansibulluser'][6] | int < 0 - not getent_shadow['local_ansibulluser'][6] or getent_shadow['local_ansibulluser'][6] | int < 0
tags: tags:
- user_test_local_mode - user_test_local_mode
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse'] when: ansible_facts.os_family in ['RedHat', 'Debian']
- name: Verify un expiration date for Linux/BSD - name: Verify un expiration date for Linux/BSD
block: block:
@ -104,7 +104,7 @@
- user_test_local_expires4 is not changed - user_test_local_expires4 is not changed
tags: tags:
- user_test_local_mode - user_test_local_mode
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse', 'FreeBSD'] when: ansible_facts.os_family in ['RedHat', 'Debian', 'FreeBSD']
# Test setting no expiration when creating a new account # Test setting no expiration when creating a new account
# https://github.com/ansible/ansible/issues/44155 # https://github.com/ansible/ansible/issues/44155
@ -162,7 +162,7 @@
- not getent_shadow['local_ansibulluser'][6] or getent_shadow['local_ansibulluser'][6] | int < 0 - not getent_shadow['local_ansibulluser'][6] or getent_shadow['local_ansibulluser'][6] | int < 0
tags: tags:
- user_test_local_mode - user_test_local_mode
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse'] when: ansible_facts.os_family in ['RedHat', 'Debian']
# Test setting epoch 0 expiration when creating a new account, then removing the expiry # Test setting epoch 0 expiration when creating a new account, then removing the expiry
# https://github.com/ansible/ansible/issues/47114 # https://github.com/ansible/ansible/issues/47114
@ -241,7 +241,7 @@
- not getent_shadow['local_ansibulluser'][6] or getent_shadow['local_ansibulluser'][6] | int < 0 - not getent_shadow['local_ansibulluser'][6] or getent_shadow['local_ansibulluser'][6] | int < 0
tags: tags:
- user_test_local_mode - user_test_local_mode
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse'] when: ansible_facts.os_family in ['RedHat', 'Debian']
# Test expiration with a very large negative number. This should have the same # Test expiration with a very large negative number. This should have the same
# result as setting -1. # result as setting -1.
@ -278,4 +278,4 @@
- not getent_shadow['local_ansibulluser'][6] or getent_shadow['local_ansibulluser'][6] | int < 0 - not getent_shadow['local_ansibulluser'][6] or getent_shadow['local_ansibulluser'][6] | int < 0
tags: tags:
- user_test_local_mode - user_test_local_mode
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse'] when: ansible_facts.os_family in ['RedHat', 'Debian']

@ -1,21 +0,0 @@
- name: Test shadow backup on Solaris
when: ansible_facts.os_family == 'Solaris'
block:
- name: Create a user to test shadow file backup
user:
name: ansibulluser
state: present
register: result
- name: Find shadow backup files
find:
path: /etc
patterns: 'shadow\..*~$'
use_regex: yes
register: shadow_backups
- name: Assert that a backup file was created
assert:
that:
- result.bakup
- shadow_backups.files | map(attribute='path') | list | length > 0

@ -1,7 +1,6 @@
user_home_prefix: user_home_prefix:
Linux: '/home' Linux: '/home'
FreeBSD: '/home' FreeBSD: '/home'
SunOS: '/home'
Darwin: '/Users' Darwin: '/Users'
status_command: status_command:
@ -9,5 +8,4 @@ status_command:
FreeBSD: 'pw user show ansibulluser' FreeBSD: 'pw user show ansibulluser'
default_user_group: default_user_group:
openSUSE Leap: users
MacOSX: staff MacOSX: staff

@ -1,5 +1,5 @@
- name: Run tests - name: Run tests
when: ansible_facts.distribution in ['CentOS', 'Fedora'] when: ansible_facts.distribution == 'Fedora'
block: block:
- name: ensure {{ yum_repository_test_package }} is uninstalled to begin with - name: ensure {{ yum_repository_test_package }} is uninstalled to begin with
action: "{{ ansible_facts.pkg_mgr }}" action: "{{ ansible_facts.pkg_mgr }}"

Loading…
Cancel
Save