diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index b5795d0e9ba..aec8e7fada4 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -87,8 +87,8 @@ stages: - template: templates/matrix.yml parameters: targets: - - name: macOS 10.15 - test: macos/10.15 + - name: macOS 11.1 + test: macos/11.1 - name: RHEL 7.9 test: rhel/7.9 - name: RHEL 8.2 diff --git a/changelogs/fragments/ci-add-macos-11.yml b/changelogs/fragments/ci-add-macos-11.yml new file mode 100644 index 00000000000..7843014922d --- /dev/null +++ b/changelogs/fragments/ci-add-macos-11.yml @@ -0,0 +1,2 @@ +minor_changes: + - ansible-test - add macOS 11.1 as a remote target (https://github.com/ansible/ansible/pull/72622) diff --git a/test/integration/targets/collections_runtime_pythonpath/runme.sh b/test/integration/targets/collections_runtime_pythonpath/runme.sh index 654104a1e2d..41236e8b92a 100755 --- a/test/integration/targets/collections_runtime_pythonpath/runme.sh +++ b/test/integration/targets/collections_runtime_pythonpath/runme.sh @@ -5,7 +5,7 @@ set -eux -o pipefail export PIP_DISABLE_PIP_VERSION_CHECK=1 - +export ANSIBLE_TEST_PREFER_VENV=1 source virtualenv.sh diff --git a/test/integration/targets/delegate_to/runme.sh b/test/integration/targets/delegate_to/runme.sh index 697fc3930fd..44059552017 100755 --- a/test/integration/targets/delegate_to/runme.sh +++ b/test/integration/targets/delegate_to/runme.sh @@ -63,6 +63,7 @@ ansible-playbook has_hostvars.yml -i inventory -v "$@" # test ansible_x_interpreter # python +export ANSIBLE_TEST_PREFER_VENV=1 source virtualenv.sh ( cd "${OUTPUT_DIR}"/venv/bin diff --git a/test/integration/targets/filter_urls/runme.sh b/test/integration/targets/filter_urls/runme.sh index f6460acb33b..9362a385df7 100755 --- a/test/integration/targets/filter_urls/runme.sh +++ b/test/integration/targets/filter_urls/runme.sh @@ -6,6 +6,7 @@ export ANSIBLE_ROLES_PATH=../ ansible-playbook runme.yml "$@" +export ANSIBLE_TEST_PREFER_VENV=1 source virtualenv.sh # This is necessary for installing Jinja 2.6. We need this because Jinja 2.6 diff --git a/test/integration/targets/groupby_filter/runme.sh b/test/integration/targets/groupby_filter/runme.sh index e5099aa1b78..07894b0f2ce 100755 --- a/test/integration/targets/groupby_filter/runme.sh +++ b/test/integration/targets/groupby_filter/runme.sh @@ -2,6 +2,7 @@ set -eux +export ANSIBLE_TEST_PREFER_VENV=1 source virtualenv.sh pip install -U jinja2==2.9.4 diff --git a/test/integration/targets/lookup_password/runme.sh b/test/integration/targets/lookup_password/runme.sh index a3637a7e227..ac2c1704c50 100755 --- a/test/integration/targets/lookup_password/runme.sh +++ b/test/integration/targets/lookup_password/runme.sh @@ -2,6 +2,7 @@ set -eux +export ANSIBLE_TEST_PREFER_VENV=1 source virtualenv.sh # Requirements have to be installed prior to running ansible-playbook diff --git a/test/integration/targets/old_style_cache_plugins/runme.sh b/test/integration/targets/old_style_cache_plugins/runme.sh index 13911bd55bc..86d2433b809 100755 --- a/test/integration/targets/old_style_cache_plugins/runme.sh +++ b/test/integration/targets/old_style_cache_plugins/runme.sh @@ -2,6 +2,7 @@ set -eux +export ANSIBLE_TEST_PREFER_VENV=1 source virtualenv.sh # Run test if dependencies are installed diff --git a/test/integration/targets/pip/tasks/main.yml b/test/integration/targets/pip/tasks/main.yml index 05879c18a98..c0a36c432c1 100644 --- a/test/integration/targets/pip/tasks/main.yml +++ b/test/integration/targets/pip/tasks/main.yml @@ -1,20 +1,30 @@ # Current pip unconditionally uses md5. # We can re-enable if pip switches to a different hash or allows us to not check md5. -- name: find virtualenv command - command: "which virtualenv virtualenv-{{ ansible_python.version.major }}.{{ ansible_python.version.minor }}" - register: command - ignore_errors: true +- name: Python 2 + when: ansible_python.version.major == 2 + block: + - 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: 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: 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: - name: install git, needed for repo installs diff --git a/test/integration/targets/pip/tasks/pip.yml b/test/integration/targets/pip/tasks/pip.yml index 6281bbe80cb..572c7b6f312 100644 --- a/test/integration/targets/pip/tasks/pip.yml +++ b/test/integration/targets/pip/tasks/pip.yml @@ -521,7 +521,7 @@ ### test virtualenv_command begin ### - name: Test virtualenv command with arguments - when: "ansible_system == 'Linux'" + when: ansible_python.version.major == 2 block: - name: make sure the virtualenv does not exist file: @@ -533,7 +533,7 @@ pip: name: "{{ pip_test_package }}" virtualenv: "{{ output_dir }}/pipenv" - virtualenv_command: "virtualenv --verbose" + virtualenv_command: "{{ command.stdout_lines[0] | basename }} --verbose" state: present register: version13 diff --git a/test/integration/targets/setup_paramiko/install-MacOSX-10-python-3.yml b/test/integration/targets/setup_paramiko/install-Darwin-python-3.yml similarity index 100% rename from test/integration/targets/setup_paramiko/install-MacOSX-10-python-3.yml rename to test/integration/targets/setup_paramiko/install-Darwin-python-3.yml diff --git a/test/integration/targets/setup_paramiko/install.yml b/test/integration/targets/setup_paramiko/install.yml index 194bd51f80d..e98abe33be9 100644 --- a/test/integration/targets/setup_paramiko/install.yml +++ b/test/integration/targets/setup_paramiko/install.yml @@ -13,5 +13,6 @@ with_first_found: - "install-{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-python-{{ ansible_python.version.major }}.yml" - "install-{{ ansible_os_family }}-{{ ansible_distribution_major_version }}-python-{{ ansible_python.version.major }}.yml" + - "install-{{ ansible_os_family }}-python-{{ ansible_python.version.major }}.yml" - "install-python-{{ ansible_python.version.major }}.yml" - "install-fail.yml" diff --git a/test/integration/targets/setup_paramiko/setup.sh b/test/integration/targets/setup_paramiko/setup.sh index 64b935cdd87..8c4f6f1c772 100644 --- a/test/integration/targets/setup_paramiko/setup.sh +++ b/test/integration/targets/setup_paramiko/setup.sh @@ -3,6 +3,7 @@ set -eux +export ANSIBLE_TEST_PREFER_VENV=1 source virtualenv.sh # for pip installs, if needed, otherwise unused ansible-playbook ../setup_paramiko/install.yml -i ../setup_paramiko/inventory "$@" trap 'ansible-playbook ../setup_paramiko/uninstall.yml -i ../setup_paramiko/inventory "$@"' EXIT diff --git a/test/integration/targets/setup_paramiko/uninstall-MacOSX-10-python-3.yml b/test/integration/targets/setup_paramiko/uninstall-Darwin-python-3.yml similarity index 100% rename from test/integration/targets/setup_paramiko/uninstall-MacOSX-10-python-3.yml rename to test/integration/targets/setup_paramiko/uninstall-Darwin-python-3.yml diff --git a/test/integration/targets/setup_paramiko/uninstall.yml b/test/integration/targets/setup_paramiko/uninstall.yml index 46a16d913a0..48ff68e6f68 100644 --- a/test/integration/targets/setup_paramiko/uninstall.yml +++ b/test/integration/targets/setup_paramiko/uninstall.yml @@ -10,6 +10,7 @@ with_first_found: - "uninstall-{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-python-{{ ansible_python.version.major }}.yml" - "uninstall-{{ ansible_os_family }}-{{ ansible_distribution_major_version }}-python-{{ ansible_python.version.major }}.yml" + - "uninstall-{{ ansible_os_family }}-python-{{ ansible_python.version.major }}.yml" - "uninstall-{{ ansible_pkg_mgr }}-python-{{ ansible_python.version.major }}.yml" - "uninstall-{{ ansible_pkg_mgr }}.yml" - "uninstall-fail.yml" diff --git a/test/integration/targets/template_jinja2_latest/runme.sh b/test/integration/targets/template_jinja2_latest/runme.sh index 6a20eb5dc4d..d6a09677e0d 100755 --- a/test/integration/targets/template_jinja2_latest/runme.sh +++ b/test/integration/targets/template_jinja2_latest/runme.sh @@ -2,6 +2,7 @@ set -eux +export ANSIBLE_TEST_PREFER_VENV=1 source virtualenv.sh pip install -U -r requirements.txt diff --git a/test/integration/targets/vault/runme.sh b/test/integration/targets/vault/runme.sh index e3b21d7f579..197095bce5b 100755 --- a/test/integration/targets/vault/runme.sh +++ b/test/integration/targets/vault/runme.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -euvx + +export ANSIBLE_TEST_PREFER_VENV=1 source virtualenv.sh @@ -521,4 +523,4 @@ ansible-playbook -i ../../inventory -v "$@" --vault-password-file vault-password # Ensure we don't leave unencrypted temp files dangling ansible-playbook -v "$@" --vault-password-file vault-password test_dangling_temp.yml -ansible-playbook "$@" --vault-password-file vault-password single_vault_as_string.yml \ No newline at end of file +ansible-playbook "$@" --vault-password-file vault-password single_vault_as_string.yml diff --git a/test/lib/ansible_test/_data/completion/remote.txt b/test/lib/ansible_test/_data/completion/remote.txt index 109a80883aa..dea4367b669 100644 --- a/test/lib/ansible_test/_data/completion/remote.txt +++ b/test/lib/ansible_test/_data/completion/remote.txt @@ -2,6 +2,7 @@ freebsd/11.1 python=2.7,3.6 python_dir=/usr/local/bin freebsd/12.1 python=3.6,2.7 python_dir=/usr/local/bin osx/10.11 python=2.7 python_dir=/usr/local/bin macos/10.15 python=3.8 python_dir=/usr/local/bin +macos/11.1 python=3.9 python_dir=/usr/local/bin rhel/7.6 python=2.7 rhel/7.8 python=2.7 rhel/7.9 python=2.7