forked from CCCHH/ansible-infra
Vendor Galaxy Roles and Collections
This commit is contained in:
parent
c1e1897cda
commit
2aed20393f
422 changed files with 387444 additions and 2 deletions
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
collections:
|
||||
- ansible.posix
|
||||
- community.crypto
|
||||
- community.general
|
||||
- community.internal_test_tools
|
||||
- community.library_inventory_filtering_v1
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
hidden
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
set -eux
|
||||
|
||||
[ -f "${INVENTORY}" ]
|
||||
|
||||
# Run connection tests with both the default and C locale.
|
||||
|
||||
ansible-playbook test_connection.yml -i "${INVENTORY}" "$@"
|
||||
|
||||
if ansible --version | grep ansible | grep -E ' 2\.(9|10|11|12|13)\.'; then
|
||||
LC_ALL=C LANG=C ansible-playbook test_connection.yml -i "${INVENTORY}" "$@"
|
||||
fi
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- hosts: "{{ target_hosts }}" # noqa: syntax-check[specific]
|
||||
gather_facts: false
|
||||
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,7 @@
|
|||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
azp/4
|
||||
skip/docker # coverage does not work if we're inside a docker container, since we cannot access this container's /tmp dir from the new container; also privileged doesn't work
|
||||
destructive
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
dependencies:
|
||||
- setup_docker
|
||||
|
|
@ -0,0 +1 @@
|
|||
../connection_posix/test.sh
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# If you use another image, you possibly also need to adjust
|
||||
# ansible_python_interpreter in test_connection.inventory.
|
||||
source ../setup_docker/vars/main.env
|
||||
IMAGE="${DOCKER_TEST_IMAGE_PYTHON3}"
|
||||
|
||||
# Setup phase
|
||||
|
||||
echo "Setup"
|
||||
ANSIBLE_ROLES_PATH=.. ansible-playbook setup.yml
|
||||
|
||||
# If docker wasn't installed, don't run the tests
|
||||
if [ "$(command -v docker)" == "" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# Test phase
|
||||
|
||||
CONTAINER_SUFFIX=-${RANDOM}
|
||||
|
||||
DOCKER_CONTAINERS="docker-connection-test-container${CONTAINER_SUFFIX}"
|
||||
|
||||
[[ -n "$DEBUG" || -n "$ANSIBLE_DEBUG" ]] && set -x
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cleanup() {
|
||||
echo "Cleanup"
|
||||
docker rm -f ${DOCKER_CONTAINERS}
|
||||
echo "Shutdown"
|
||||
ANSIBLE_ROLES_PATH=.. ansible-playbook shutdown.yml
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
trap cleanup INT TERM EXIT
|
||||
|
||||
echo "Start containers"
|
||||
for CONTAINER in ${DOCKER_CONTAINERS}; do
|
||||
if [ "${ANSIBLE_TEST_COVERAGE:-}" == "" ]; then
|
||||
docker run --rm --name "${CONTAINER}" --detach "${IMAGE}" /bin/sh -c 'sleep 10m'
|
||||
else
|
||||
docker run --rm --name "${CONTAINER}" --detach -v /tmp:/tmp "${IMAGE}" /bin/sh -c 'sleep 10m'
|
||||
docker exec "${CONTAINER}" pip3 install coverage
|
||||
fi
|
||||
echo "${CONTAINER}"
|
||||
done
|
||||
|
||||
cat > test_connection.inventory << EOF
|
||||
[docker]
|
||||
docker-no-pipelining ansible_pipelining=false
|
||||
docker-pipelining ansible_pipelining=true
|
||||
docker-working-dir ansible_docker_working_dir=/home
|
||||
docker-privileged ansible_docker_privileged=true
|
||||
|
||||
[docker:vars]
|
||||
ansible_host=docker-connection-test-container${CONTAINER_SUFFIX}
|
||||
ansible_connection=community.docker.docker
|
||||
ansible_python_interpreter=/usr/local/bin/python3
|
||||
EOF
|
||||
|
||||
echo "Run tests"
|
||||
./runme-connection.sh "$@"
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- hosts: localhost
|
||||
connection: local
|
||||
vars:
|
||||
docker_skip_cleanup: true
|
||||
|
||||
tasks:
|
||||
- name: Setup docker
|
||||
import_role:
|
||||
name: setup_docker # noqa: syntax-check[specific]
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- hosts: localhost
|
||||
connection: local
|
||||
vars:
|
||||
docker_skip_cleanup: true
|
||||
|
||||
tasks:
|
||||
- name: Remove docker packages
|
||||
action: "{{ ansible_facts.pkg_mgr }}"
|
||||
args:
|
||||
name:
|
||||
- docker
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
state: absent
|
||||
when: not docker_skip_cleanup
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
azp/4
|
||||
skip/docker # coverage does not work if we're inside a docker container, since we cannot access this container's /tmp dir from the new container; also privileged doesn't work
|
||||
destructive
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
dependencies:
|
||||
- setup_docker
|
||||
- setup_docker_python_deps
|
||||
|
|
@ -0,0 +1 @@
|
|||
../connection_posix/test.sh
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# If you use another image, you possibly also need to adjust
|
||||
# ansible_python_interpreter in test_connection.inventory.
|
||||
source ../setup_docker/vars/main.env
|
||||
IMAGE="${DOCKER_TEST_IMAGE_PYTHON3}"
|
||||
|
||||
# Setup phase
|
||||
|
||||
echo "Setup"
|
||||
ANSIBLE_ROLES_PATH=.. ansible-playbook setup.yml
|
||||
|
||||
# If docker wasn't installed, don't run the tests
|
||||
if [ "$(command -v docker)" == "" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# Test phase
|
||||
|
||||
CONTAINER_SUFFIX=-${RANDOM}
|
||||
|
||||
DOCKER_CONTAINERS="docker-connection-test-container${CONTAINER_SUFFIX}"
|
||||
|
||||
[[ -n "$DEBUG" || -n "$ANSIBLE_DEBUG" ]] && set -x
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cleanup() {
|
||||
echo "Cleanup"
|
||||
docker rm -f ${DOCKER_CONTAINERS}
|
||||
echo "Shutdown"
|
||||
ANSIBLE_ROLES_PATH=.. ansible-playbook shutdown.yml
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
trap cleanup INT TERM EXIT
|
||||
|
||||
echo "Start containers"
|
||||
for CONTAINER in ${DOCKER_CONTAINERS}; do
|
||||
if [ "${ANSIBLE_TEST_COVERAGE:-}" == "" ]; then
|
||||
docker run --rm --name "${CONTAINER}" --detach "${IMAGE}" /bin/sh -c 'sleep 10m'
|
||||
else
|
||||
docker run --rm --name "${CONTAINER}" --detach -v /tmp:/tmp "${IMAGE}" /bin/sh -c 'sleep 10m'
|
||||
docker exec "${CONTAINER}" pip3 install coverage
|
||||
fi
|
||||
echo "${CONTAINER}"
|
||||
done
|
||||
|
||||
cat > test_connection.inventory << EOF
|
||||
[docker_api]
|
||||
docker_api-no-pipelining ansible_pipelining=false
|
||||
docker_api-pipelining ansible_pipelining=true
|
||||
docker_api-working-dir ansible_docker_working_dir=/home
|
||||
docker_api-privileged ansible_docker_privileged=true
|
||||
|
||||
[docker_api:vars]
|
||||
ansible_host=docker-connection-test-container${CONTAINER_SUFFIX}
|
||||
ansible_connection=community.docker.docker_api
|
||||
ansible_python_interpreter=/usr/local/bin/python3
|
||||
EOF
|
||||
|
||||
echo "Run tests"
|
||||
./runme-connection.sh "$@"
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- hosts: localhost
|
||||
connection: local
|
||||
vars:
|
||||
docker_skip_cleanup: true
|
||||
|
||||
tasks:
|
||||
- name: Setup docker
|
||||
import_role:
|
||||
name: setup_docker # noqa: syntax-check[specific]
|
||||
|
||||
- name: Setup docker Python deps
|
||||
import_role:
|
||||
name: setup_docker_python_deps # noqa: syntax-check[specific]
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- hosts: localhost
|
||||
connection: local
|
||||
vars:
|
||||
docker_skip_cleanup: true
|
||||
|
||||
tasks:
|
||||
- name: Remove docker packages
|
||||
action: "{{ ansible_facts.pkg_mgr }}"
|
||||
args:
|
||||
name:
|
||||
- docker
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
state: absent
|
||||
when: not docker_skip_cleanup
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
azp/5
|
||||
skip/docker # this requires unfettered access to the container host
|
||||
skip/rhel7.9 # nsenter does not work out of the box
|
||||
destructive
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
dependencies:
|
||||
- setup_docker
|
||||
|
|
@ -0,0 +1 @@
|
|||
../connection_posix/test.sh
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
[[ -n "${DEBUG:-}" || -n "${ANSIBLE_DEBUG:-}" ]] && set -x
|
||||
|
||||
readonly IMAGE="quay.io/ansible/ansible-runner:devel"
|
||||
# shellcheck disable=SC2155
|
||||
readonly PYTHON="$(command -v python3 python | head -n1)"
|
||||
|
||||
# Determine collection root
|
||||
COLLECTION_ROOT=./
|
||||
while true; do
|
||||
if [ -e ${COLLECTION_ROOT}galaxy.yml ] || [ -e ${COLLECTION_ROOT}MANIFEST.json ]; then
|
||||
break
|
||||
fi
|
||||
COLLECTION_ROOT="${COLLECTION_ROOT}../"
|
||||
done
|
||||
# shellcheck disable=SC2155
|
||||
readonly COLLECTION_ROOT="$(cd ${COLLECTION_ROOT} ; pwd)"
|
||||
|
||||
# Setup phase
|
||||
echo "Setup"
|
||||
ANSIBLE_ROLES_PATH=.. ansible-playbook setup.yml
|
||||
|
||||
# If docker wasn't installed, don't run the tests
|
||||
if [ "$(command -v docker)" == "" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
cleanup() {
|
||||
echo "Cleanup"
|
||||
echo "Shutdown"
|
||||
ANSIBLE_ROLES_PATH=.. ansible-playbook shutdown.yml
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
envs=(--env "HOME=${HOME:-}")
|
||||
while IFS=$'\0' read -d '' -r line; do
|
||||
key="$(echo "$line" | cut -d= -f1)"
|
||||
value="$(echo "$line" | cut -d= -f2-)"
|
||||
if [[ "${key}" =~ ^(ANSIBLE_|JUNIT_OUTPUT_DIR$|OUTPUT_DIR$|PYTHONPATH$) ]]; then
|
||||
envs+=(--env "${key}=${value}")
|
||||
fi
|
||||
done < <(printenv -0)
|
||||
|
||||
# Test phase
|
||||
cat > test_connection.inventory << EOF
|
||||
[nsenter]
|
||||
nsenter-no-pipelining ansible_pipelining=false
|
||||
nsenter-pipelining ansible_pipelining=true
|
||||
|
||||
[nsenter:vars]
|
||||
ansible_host=localhost
|
||||
ansible_connection=community.docker.nsenter
|
||||
ansible_host_volume_mount=/host
|
||||
ansible_nsenter_pid=1
|
||||
ansible_python_interpreter=${PYTHON}
|
||||
EOF
|
||||
|
||||
echo "Run tests"
|
||||
set -x
|
||||
docker run \
|
||||
-i \
|
||||
--rm \
|
||||
--privileged \
|
||||
--pid host \
|
||||
"${envs[@]}" \
|
||||
--volume "${COLLECTION_ROOT}:${COLLECTION_ROOT}" \
|
||||
--workdir "$(pwd)" \
|
||||
"${IMAGE}" \
|
||||
./runme-connection.sh "$@"
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue