Files
tenks/ansible/roles/virtualbmc-daemon/tasks/main.yml
Pierre Riteau f34bb772a0 Fix virtualbmc installation after release of cryptography 3.4
Installing virtualbmc system-wide on CentOS 8 fails with:

    ModuleNotFoundError: No module named 'setuptools_rust'

This error appeared following the release of cryptography 3.4, which now
includes Rust code. It can be installed without Rust using a Python
wheel, but only with more recent pip than version 9.0.3 available as RPM
on CentOS 8. The cryptography bug report [1] recommends pip>=19.1.1.

Also ignore PyYAML when installing system-wide to avoid conflicts with
an existing RPM package installation.

[1] https://github.com/pyca/cryptography/issues/5753

Change-Id: Ibd61e090611b3b7a7e0670c854362b512454bf3c
Story: 2008607
Task: 41788
2021-02-08 15:54:17 +01:00

65 lines
2.0 KiB
YAML

---
- name: Gather os specific variables
include_vars: "{{ item }}"
with_first_found:
- files:
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
skip: true
tags: vars
- name: Ensure package dependencies are installed
package:
name: "{{ vbmcd_packages }}"
state: present
register: result
until: result is success
retries: 3
become: true
# NOTE(priteau): We need a recent pip to install the latest cryptography
# library. See https://github.com/pyca/cryptography/issues/5753
- name: Ensure a recent version of pip is installed
pip:
name: "pip>=19.1.1"
virtualenv: "{{ vbmcd_virtualenv_path or omit }}"
become: "{{ not vbmcd_virtualenv_path }}"
- name: Ensure Python requirements are installed
pip:
name:
- "virtualbmc>=1.4.0{% if ansible_python.version.major == 2 %},<2{% endif %}"
# NOTE(priteau): Ignore PyYAML when installing system-wide to avoid the
# following error: Cannot uninstall 'PyYAML'. It is a distutils installed
# project and thus we cannot accurately determine which files belong to it
# which would lead to only a partial uninstall.
extra_args: >-
-c {{ vbmcd_python_upper_constraints_url }}
{% if not vbmcd_virtualenv_path %}--ignore-installed PyYAML{% endif %}
virtualenv: "{{ vbmcd_virtualenv_path or omit }}"
register: result
until: result is success
retries: 3
become: "{{ not vbmcd_virtualenv_path }}"
- name: Ensure Virtual BMC systemd service is configured
template:
src: templates/{{ item }}.j2
dest: /etc/systemd/system/{{ item }}
owner: root
group: root
mode: 0644
become: true
register: service_file
loop:
- "{{ service }}.service"
- name: Ensure Virtual BMC systemd service is started and enabled
systemd:
name: "{{ service }}"
enabled: yes
state: started
daemon_reload: "{{ service_file.changed }}"
become: true