Files
community.crypto/tests/integration/targets/setup_openssl/tasks/main.yml
Felix Fontein 4d8dcad190 Speed up tests (#153)
* Improve openssh_* tests.

* Use 2048 instead of 4096 bit keys in many places.

ci_complete

* Parameterize default RSA key length for tests.

* Reduce default RSA key size to 1024.

ci_complete

* Fix error.

ci_complete

* Use variable more often.

* Use 2048 bits for RSA keys for certificates on RHEL8 and CentOS8.

ci_complete

* Fix missing constant.

ci_complete

* Print default key sizes.
2020-12-04 13:08:14 +00:00

103 lines
3.3 KiB
YAML

---
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
- name: Register system environment
command: "{{ ansible_python.executable }} -c 'import os; print(dict(os.environ))'"
register: sys_environment
- debug: var=sys_environment
- name: Default value for OpenSSL binary path
set_fact:
openssl_binary: openssl
- 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: Register openssl version (full)
shell: "{{ openssl_binary }} version"
register: openssl_version_full
- name: Show openssl version (full)
debug:
var: openssl_version_full.stdout_lines
- when: ansible_os_family == "Darwin" and "LibreSSL" in openssl_version_full.stdout
# In case LibreSSL is installed on macOS, we need to install a more modern OpenSSL
block:
- name: MACOS | Find brew binary
command: which brew
register: brew_which
- name: MACOS | Get owner of brew binary
stat:
path: "{{ brew_which.stdout }}"
register: brew_stat
- name: MACOS | Install openssl
homebrew:
name: openssl
state: present
become: yes
become_user: "{{ brew_stat.stat.pw_name }}"
- name: MACOS | Locale openssl binary
command: brew --prefix openssl
register: brew_openssl_prefix
- name: MACOS | Point to OpenSSL binary
set_fact:
openssl_binary: "{{ brew_openssl_prefix.stdout }}/bin/openssl"
- name: MACOS | Register openssl version (full)
shell: "{{ openssl_binary }} version"
register: openssl_version_full_again
# We must use a different variable to prevent the 'when' condition of the surrounding block to fail
- name: MACOS | Show openssl version (full)
debug:
var: openssl_version_full_again.stdout_lines
- name: Register openssl version
shell: "{{ openssl_binary }} version | cut -d' ' -f2"
register: openssl_version
- when: ansible_facts.distribution ~ ansible_facts.distribution_major_version not in ['CentOS6', 'RedHat6']
block:
- name: Install cryptography (Python 3)
become: true
package:
name: '{{ cryptography_package_name_python3 }}'
when: not ansible_os_family == 'Darwin' and ansible_python_version is version('3.0', '>=')
- name: Install cryptography (Python 2)
become: true
package:
name: '{{ cryptography_package_name }}'
when: not ansible_os_family == 'Darwin' and ansible_python_version is version('3.0', '<')
- name: Install cryptography (Darwin)
become: true
pip:
name: cryptography
extra_args: "-c {{ remote_constraints }}"
when: ansible_os_family == 'Darwin'
- name: Register cryptography version
command: "{{ ansible_python.executable }} -c 'import cryptography; print(cryptography.__version__)'"
register: cryptography_version
- name: Print default key sizes
debug:
msg: "Default RSA key size: {{ default_rsa_key_size }} (for certificates: {{ default_rsa_key_size_certifiates }})"