mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-06 13:22:58 +00:00
Improve CI (#281)
* Install PyOpenSSL and cryptography from PyPi if target Python != system Python. * Work around some CentOS6, 7, Ubuntu 16.04 problems. Improve jinja2 compatibility handling. * Skip tasks that require properties that aren't always there. * Only install OpenSSL when not present. * Improve output. * Improve get_certificate integration test graceful failing. * Fix tests. * Fix assert. * OpenSSL peculiarities. * Fix condition.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# (c) 2021, Felix Fontein <felix@fontein.de>
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
def get_major_minor_version(version):
|
||||
parts = version.split('.')[:2]
|
||||
return '.'.join(parts)
|
||||
|
||||
|
||||
class FilterModule(object):
|
||||
""" IP address and network manipulation filters """
|
||||
|
||||
def filters(self):
|
||||
return {
|
||||
'internal__get_major_minor_version': get_major_minor_version,
|
||||
}
|
||||
55
tests/integration/targets/setup_python_info/tasks/main.yml
Normal file
55
tests/integration/targets/setup_python_info/tasks/main.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
- name: Gather facts on controller
|
||||
setup:
|
||||
gather_subset: '!all'
|
||||
delegate_to: localhost
|
||||
delegate_facts: true
|
||||
run_once: true
|
||||
- name: Show variables
|
||||
debug:
|
||||
msg: |-
|
||||
Target:
|
||||
Python: {{ ansible_facts.python.version.major ~ '.' ~ ansible_facts.python.version.minor }}
|
||||
OS family: {{ ansible_facts.os_family }}
|
||||
Distribution: {{ ansible_facts.distribution }}
|
||||
Distribution version: {{ ansible_facts.distribution_version | internal__get_major_minor_version }}
|
||||
Distribution major version: {{ ansible_facts.distribution_major_version }}
|
||||
|
||||
Controller:
|
||||
Python: {{ hostvars['localhost'].ansible_facts.python.version.major ~ '.' ~ hostvars['localhost'].ansible_facts.python.version.minor }}
|
||||
OS family: {{ hostvars['localhost'].ansible_facts.os_family }}
|
||||
Distribution: {{ hostvars['localhost'].ansible_facts.distribution }}
|
||||
Distribution version: {{ hostvars['localhost'].ansible_facts.distribution_version | internal__get_major_minor_version }}
|
||||
Distribution major version: {{ hostvars['localhost'].ansible_facts.distribution_major_version }}
|
||||
- name: Record information
|
||||
set_fact:
|
||||
target_system_python: >-
|
||||
{{
|
||||
(ansible_facts.python.version.major ~ '.' ~ ansible_facts.python.version.minor)
|
||||
in
|
||||
(
|
||||
system_python_version_data[ansible_facts.distribution] |
|
||||
default(system_python_version_data[ansible_facts.os_family])
|
||||
)[ansible_facts.distribution_version | internal__get_major_minor_version]
|
||||
| default(
|
||||
(
|
||||
system_python_version_data[ansible_facts.distribution] |
|
||||
default(system_python_version_data[ansible_facts.os_family])
|
||||
)[ansible_facts.distribution_major_version]
|
||||
)
|
||||
}}
|
||||
controller_system_python: >-
|
||||
{{
|
||||
(hostvars['localhost'].ansible_facts.python.version.major ~ '.' ~ hostvars['localhost'].ansible_facts.python.version.minor)
|
||||
in
|
||||
(
|
||||
system_python_version_data[hostvars['localhost'].ansible_facts.distribution] |
|
||||
default(system_python_version_data[hostvars['localhost'].ansible_facts.os_family])
|
||||
)[ansible_facts.distribution_version | internal__get_major_minor_version]
|
||||
| default(
|
||||
(
|
||||
system_python_version_data[hostvars['localhost'].ansible_facts.distribution] |
|
||||
default(system_python_version_data[hostvars['localhost'].ansible_facts.os_family])
|
||||
)[hostvars['localhost'].ansible_facts.distribution_major_version]
|
||||
)
|
||||
}}
|
||||
50
tests/integration/targets/setup_python_info/vars/main.yml
Normal file
50
tests/integration/targets/setup_python_info/vars/main.yml
Normal file
@@ -0,0 +1,50 @@
|
||||
---
|
||||
system_python_version_data:
|
||||
CentOS:
|
||||
'6':
|
||||
- '2.6'
|
||||
'7':
|
||||
- '2.7'
|
||||
'8':
|
||||
- '3.6'
|
||||
Fedora:
|
||||
'30':
|
||||
- '3.7'
|
||||
'31':
|
||||
- '3.7'
|
||||
'32':
|
||||
- '3.8'
|
||||
'33':
|
||||
- '3.9'
|
||||
'34':
|
||||
- '3.9'
|
||||
Ubuntu:
|
||||
'16':
|
||||
- '2.7'
|
||||
'18':
|
||||
- '3.6'
|
||||
'20':
|
||||
- '3.8'
|
||||
Darwin:
|
||||
'10.11':
|
||||
- '2.7'
|
||||
'10.15':
|
||||
- '3.8'
|
||||
'11.1':
|
||||
- '3.9'
|
||||
FreeBSD:
|
||||
'12.1':
|
||||
- '3.6'
|
||||
'12.2':
|
||||
- '3.7'
|
||||
'13.0':
|
||||
- '3.7'
|
||||
RedHat:
|
||||
'7':
|
||||
- '2.7'
|
||||
'8':
|
||||
- '3.6'
|
||||
Suse:
|
||||
'15':
|
||||
- '2.7'
|
||||
- '3.6'
|
||||
Reference in New Issue
Block a user