Initial cleanup.

This commit is contained in:
Felix Fontein
2020-10-28 13:28:37 +01:00
parent 42315baa74
commit 6555a5a0de
75 changed files with 1203 additions and 387 deletions
@@ -0,0 +1 @@
hidden
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -eux
[ -f "${INVENTORY}" ]
# Run connection tests with both the default and C locale.
ansible-playbook test_connection.yml -i "${INVENTORY}" "$@"
LC_ALL=C LANG=C ansible-playbook test_connection.yml -i "${INVENTORY}" "$@"
@@ -0,0 +1,43 @@
- hosts: "{{ target_hosts }}"
gather_facts: no
serial: 1
tasks:
### raw with unicode arg and output
- name: raw with unicode arg and output
raw: echo 汉语
register: command
- name: check output of raw with unicode arg and output
assert:
that:
- "'汉语' in command.stdout"
- command is changed # as of 2.2, raw should default to changed: true for consistency w/ shell/command/script modules
### copy local file with unicode filename and content
- name: create local file with unicode filename and content
local_action: lineinfile dest={{ local_tmp }}-汉语/汉语.txt create=true line=汉语
- name: remove remote file with unicode filename and content
action: "{{ action_prefix }}file path={{ remote_tmp }}-汉语/汉语.txt state=absent"
- name: create remote directory with unicode name
action: "{{ action_prefix }}file path={{ remote_tmp }}-汉语 state=directory"
- name: copy local file with unicode filename and content
action: "{{ action_prefix }}copy src={{ local_tmp }}-汉语/汉语.txt dest={{ remote_tmp }}-汉语/汉语.txt"
### fetch remote file with unicode filename and content
- name: remove local file with unicode filename and content
local_action: file path={{ local_tmp }}-汉语/汉语.txt state=absent
- name: fetch remote file with unicode filename and content
fetch: src={{ remote_tmp }}-汉语/汉语.txt dest={{ local_tmp }}-汉语/汉语.txt fail_on_missing=true validate_checksum=true flat=true
### remove local and remote temp files
- name: remove local temp file
local_action: file path={{ local_tmp }}-汉语 state=absent
- name: remove remote temp file
action: "{{ action_prefix }}file path={{ remote_tmp }}-汉语 state=absent"
### test wait_for_connection plugin
- ansible.builtin.wait_for_connection:
@@ -0,0 +1,2 @@
needs/target/connection
hidden
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -eux
# Connection tests for POSIX platforms use this script by linking to it from the appropriate 'connection_' target dir.
# The name of the inventory group to test is extracted from the directory name following the 'connection_' prefix.
group=$(python -c \
"from os import path; print(path.basename(path.abspath(path.dirname('$0'))).replace('connection_', ''))")
cd ../connection
INVENTORY="../connection_${group}/test_connection.inventory" ./test.sh \
-e target_hosts="${group}" \
-e action_prefix= \
-e local_tmp=/tmp/ansible-local \
-e remote_tmp=/tmp/ansible-remote \
"$@"
@@ -1,9 +1,2 @@
shippable/posix/group3
skip/osx
skip/macos
skip/freebsd
skip/aix
destructive
skip/docker # The tests sometimes make docker daemon unstable; hence,
# we skip all docker-based CI runs to avoid disrupting
# the whole CI system.
@@ -1,6 +1,2 @@
shippable/posix/group5
skip/osx
skip/macos
skip/freebsd
skip/aix
destructive
@@ -1,6 +1,2 @@
shippable/posix/group2
skip/osx
skip/macos
skip/freebsd
skip/aix
shippable/posix/group5
destructive
@@ -1,6 +1,2 @@
shippable/posix/group2
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group4
destructive
@@ -1,6 +1,2 @@
shippable/posix/group5
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group4
destructive
@@ -1,6 +1,2 @@
shippable/posix/group2
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group4
destructive
@@ -1,6 +1,2 @@
shippable/posix/group3
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group4
destructive
@@ -1,6 +1,2 @@
shippable/posix/group5
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group4
destructive
@@ -1,6 +1,2 @@
shippable/posix/group2
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group4
destructive
@@ -1,12 +1,3 @@
shippable/posix/group2
skip/aix
skip/osx
skip/macos
skip/freebsd
destructive
skip/docker # The tests sometimes make docker daemon unstable; hence,
# we skip all docker-based CI runs to avoid disrupting
# the whole CI system. On VMs, we restart docker daemon
# after finishing the tests to minimize potential effects
# on other tests.
needs/root
@@ -1,9 +1,2 @@
shippable/posix/group3
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group2
destructive
skip/docker # The tests sometimes make docker daemon unstable; hence,
# we skip all docker-based CI runs to avoid disrupting
# the whole CI system.
@@ -1,6 +1,2 @@
shippable/posix/group2
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group4
destructive
@@ -1,9 +1,2 @@
shippable/posix/group2
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group3
destructive
skip/docker # The tests sometimes make docker daemon unstable; hence,
# we skip all docker-based CI runs to avoid disrupting
# the whole CI system.
@@ -1,9 +1,2 @@
shippable/posix/group2
skip/aix
skip/osx
skip/macos
skip/freebsd
destructive
skip/docker # The tests sometimes make docker daemon unstable; hence,
# we skip all docker-based CI runs to avoid disrupting
# the whole CI system.
@@ -1,9 +1,2 @@
shippable/posix/group1
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group2
destructive
skip/docker # The tests sometimes make docker daemon unstable; hence,
# we skip all docker-based CI runs to avoid disrupting
# the whole CI system.
@@ -1,9 +1,2 @@
shippable/posix/group1
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group2
destructive
skip/docker # The tests sometimes make docker daemon unstable; hence,
# we skip all docker-based CI runs to avoid disrupting
# the whole CI system.
+1 -11
View File
@@ -1,13 +1,3 @@
shippable/posix/group2
disabled # See: https://github.com/ansible/ansible/issues/61815
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group1
destructive
skip/docker # The tests sometimes make docker daemon unstable; hence,
# we skip all docker-based CI runs to avoid disrupting
# the whole CI system. On VMs, we restart docker daemon
# after finishing the tests to minimize potential effects
# on other tests.
needs/root
@@ -1,9 +1,2 @@
shippable/posix/group1
skip/aix
skip/osx
skip/macos
skip/freebsd
destructive
skip/docker # The tests sometimes make docker daemon unstable; hence,
# we skip all docker-based CI runs to avoid disrupting
# the whole CI system.
@@ -1,9 +1,2 @@
shippable/posix/group5
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group3
destructive
skip/docker # The tests sometimes make docker daemon unstable; hence,
# we skip all docker-based CI runs to avoid disrupting
# the whole CI system.
@@ -1,9 +1,2 @@
shippable/posix/group3
skip/aix
skip/osx
skip/macos
skip/freebsd
destructive
skip/docker # The tests sometimes make docker daemon unstable; hence,
# we skip all docker-based CI runs to avoid disrupting
# the whole CI system.
@@ -1,6 +1,2 @@
shippable/posix/group2
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group4
destructive
@@ -1,6 +1,2 @@
shippable/posix/group1
skip/aix
skip/osx
skip/macos
skip/freebsd
shippable/posix/group4
destructive
@@ -1,11 +1,4 @@
disabled
shippable/posix/group2
skip/aix
skip/osx
skip/macos
skip/freebsd
destructive
skip/docker # We need SSH access to the VM and need to be able to let
# docker-machine install docker in the VM. This won't work
# with tests running in docker containers.
needs/root
@@ -1,12 +1,3 @@
shippable/posix/group2
skip/aix
skip/osx
skip/macos
skip/freebsd
destructive
skip/docker # The tests sometimes make docker daemon unstable; hence,
# we skip all docker-based CI runs to avoid disrupting
# the whole CI system. On VMs, we restart docker daemon
# after finishing the tests to minimize potential effects
# on other tests.
needs/root
@@ -0,0 +1,10 @@
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
- name: Install EPEL
yum:
name: https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/setup_epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm
disable_gpg_check: true
when: ansible_facts.distribution in ['RedHat', 'CentOS']
@@ -0,0 +1,3 @@
dependencies:
- setup_remote_constraints
- setup_pkg_mgr
@@ -0,0 +1,46 @@
---
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
- name: Include OS-specific variables
include_vars: '{{ ansible_os_family }}.yml'
when: not ansible_os_family == "Darwin"
- name: Install OpenSSL
become: True
package:
name: '{{ openssl_package_name }}'
when: not ansible_os_family == 'Darwin'
- name: Install pyOpenSSL (Python 3)
become: True
package:
name: '{{ pyopenssl_package_name_python3 }}'
when: not ansible_os_family == 'Darwin' and ansible_python_version is version('3.0', '>=')
- name: Install pyOpenSSL (Python 2)
become: True
package:
name: '{{ pyopenssl_package_name }}'
when: not ansible_os_family == 'Darwin' and ansible_python_version is version('3.0', '<')
- name: Install pyOpenSSL (Darwin)
become: True
pip:
name: pyOpenSSL
extra_args: "-c {{ remote_constraints }}"
when: ansible_os_family == 'Darwin'
- name: register pyOpenSSL version
command: "{{ ansible_python.executable }} -c 'import OpenSSL; print(OpenSSL.__version__)'"
register: pyopenssl_version
- name: register openssl version
shell: "openssl version | cut -d' ' -f2"
register: openssl_version
- name: register cryptography version
command: "{{ ansible_python.executable }} -c 'import cryptography; print(cryptography.__version__)'"
register: cryptography_version
@@ -0,0 +1,3 @@
pyopenssl_package_name: python-openssl
pyopenssl_package_name_python3: python3-openssl
openssl_package_name: openssl
@@ -0,0 +1,3 @@
pyopenssl_package_name: py27-openssl
pyopenssl_package_name_python3: py36-openssl
openssl_package_name: openssl
@@ -0,0 +1,3 @@
pyopenssl_package_name: pyOpenSSL
pyopenssl_package_name_python3: python3-pyOpenSSL
openssl_package_name: openssl
@@ -0,0 +1,3 @@
pyopenssl_package_name: python-pyOpenSSL
pyopenssl_package_name_python3: python3-pyOpenSSL
openssl_package_name: openssl
@@ -0,0 +1,17 @@
---
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
- set_fact:
pkg_mgr: community.general.pkgng
ansible_pkg_mgr: community.general.pkgng
cacheable: yes
when: ansible_os_family == "FreeBSD"
- set_fact:
pkg_mgr: community.general.zypper
ansible_pkg_mgr: community.general.zypper
cacheable: yes
when: ansible_os_family == "Suse"
@@ -0,0 +1 @@
needs/file/tests/utils/constraints.txt
@@ -0,0 +1,2 @@
dependencies:
- setup_remote_tmp_dir
@@ -0,0 +1,13 @@
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
- name: record constraints.txt path on remote host
set_fact:
remote_constraints: "{{ remote_tmp_dir }}/constraints.txt"
- name: copy constraints.txt to remote host
copy:
src: "{{ role_path }}/../../../utils/constraints.txt"
dest: "{{ remote_constraints }}"
@@ -0,0 +1,5 @@
- name: delete temporary directory
include_tasks: default-cleanup.yml
- name: delete temporary directory (windows)
include_tasks: windows-cleanup.yml
@@ -0,0 +1,5 @@
- name: delete temporary directory
file:
path: "{{ remote_tmp_dir }}"
state: absent
no_log: yes
@@ -0,0 +1,11 @@
- name: create temporary directory
tempfile:
state: directory
suffix: .test
register: remote_tmp_dir
notify:
- delete temporary directory
- name: record temporary directory
set_fact:
remote_tmp_dir: "{{ remote_tmp_dir.path }}"
@@ -0,0 +1,15 @@
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
- name: make sure we have the ansible_os_family and ansible_distribution_version facts
setup:
gather_subset: distribution
when: ansible_facts == {}
- include_tasks: "{{ lookup('first_found', files)}}"
vars:
files:
- "{{ ansible_os_family | lower }}.yml"
- "default.yml"