Files
Felix Fontein 99d6a17653 Fix some ansible-lint issues (#907) (#908)
* Fix fqcn[action-core].

* Fix fqcn[action].

* Fix jinja[spacing].

(cherry picked from commit 8792635bef)
2025-05-30 22:43:43 +02:00

80 lines
3.8 KiB
YAML

---
# 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
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
- name: Retrieve information
community.crypto.crypto_info:
register: result
- name: Display information
ansible.builtin.debug:
var: result
- name: Register cryptography version
ansible.builtin.command: "{{ ansible_python.executable }} -c 'import cryptography; print(cryptography.__version__)'"
register: local_cryptography_version
- name: Determine complex version-based capabilities
ansible.builtin.set_fact:
supports_ed25519: >-
{{
local_cryptography_version.stdout is version("2.6", ">=")
and not (
ansible_os_family == "FreeBSD" and
ansible_facts.distribution_version is version("12.1", ">=") and
ansible_facts.distribution_version is version("12.2", "<")
)
}}
supports_ed448: >-
{{
local_cryptography_version.stdout is version("2.6", ">=")
and not (
ansible_os_family == "FreeBSD" and
ansible_facts.distribution_version is version("12.1", ">=") and
ansible_facts.distribution_version is version("12.2", "<")
)
}}
- name: Verify cryptography information
ansible.builtin.assert:
that:
- result.python_cryptography_installed
- "'python_cryptography_import_error' not in result"
- result.python_cryptography_capabilities.version == local_cryptography_version.stdout
- "'secp256r1' in result.python_cryptography_capabilities.curves"
- result.python_cryptography_capabilities.has_ec == (local_cryptography_version.stdout is version('0.5', '>='))
- result.python_cryptography_capabilities.has_ec_sign == (local_cryptography_version.stdout is version('1.5', '>='))
- result.python_cryptography_capabilities.has_ed25519 == supports_ed25519
- result.python_cryptography_capabilities.has_ed25519_sign == supports_ed25519
- result.python_cryptography_capabilities.has_ed448 == supports_ed448
- result.python_cryptography_capabilities.has_ed448_sign == supports_ed448
- result.python_cryptography_capabilities.has_dsa == (local_cryptography_version.stdout is version('0.5', '>='))
- result.python_cryptography_capabilities.has_dsa_sign == (local_cryptography_version.stdout is version('1.5', '>='))
- result.python_cryptography_capabilities.has_rsa == (local_cryptography_version.stdout is version('0.5', '>='))
- result.python_cryptography_capabilities.has_rsa_sign == (local_cryptography_version.stdout is version('1.4', '>='))
- result.python_cryptography_capabilities.has_x25519 == (local_cryptography_version.stdout is version('2.0', '>='))
- result.python_cryptography_capabilities.has_x25519_serialization == (local_cryptography_version.stdout is version('2.5', '>='))
- result.python_cryptography_capabilities.has_x448 == (local_cryptography_version.stdout is version('2.5', '>='))
- name: Find OpenSSL binary
ansible.builtin.command: which openssl
register: local_openssl_path
- name: Find OpenSSL version
ansible.builtin.command: openssl version
register: local_openssl_version_full
- name: Verify OpenSSL information
ansible.builtin.assert:
that:
- result.openssl_present
- result.openssl.path == local_openssl_path.stdout
- (result.openssl.version_output | trim) == local_openssl_version_full.stdout
- result.openssl.version == local_openssl_version_full.stdout.split(' ')[1]