roles: bifrost-ironic-install: Add PyMySQL dependency for ironic-dbsync

We are using MariaDB database for ironic so we need to install
the optional PyMySQL dependency for sqlalchemy on all distributions
otherwise ironic-dbsync fails with the following error:

CRITI [ironic] ImportError: No module named pymysql
Traceback (most recent call last):
  File "/usr/bin/ironic-dbsync", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/ironic/cmd/dbsync.py", line 103, in main
    CONF.command.func()
  File "/usr/lib/python2.7/site-packages/ironic/cmd/dbsync.py", line 35, in upgrade
     migration.upgrade(CONF.command.revision)
  File "/usr/lib/python2.7/site-packages/ironic/db/migration.py", line 36, in upgrade
     return get_backend().upgrade(version)
  File "/usr/lib/python2.7/site-packages/ironic/db/sqlalchemy/migration.py", line 56, in upgrade
     alembic.command.upgrade(config, revision or 'head')
  [...]
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/pymysql.py", line 49, in dbapi
     return __import__('pymysql')
ImportError: No module named pymysql

Change-Id: Ib44779de06a7bad91a08e148e1c0e1eb9815afe8
This commit is contained in:
Markos Chandras 2017-03-09 22:25:46 +00:00
parent 0532e286fb
commit 952e99cb6b
2 changed files with 11 additions and 0 deletions

View File

@ -47,4 +47,5 @@ required_packages:
- socat
- python-pip
- gcc
- python-PyMySQL
iscsi_client_package: "open-iscsi"

View File

@ -85,6 +85,16 @@
- name: "Install pymysql in venv if using"
include: pip_install.yml package=pymysql virtualenv=bifrost_venv_dir
when: skip_install is not defined and (enable_venv | bool == true)
# NOTE(hwoarang): The python-pymysql package is not available on the CentOS7
# and old Debian/Ubuntu repositories so we need to get it via pip
- name: "Install pymysql on CentOS/Ubuntu if necessary"
include: pip_install.yml package=pymysql
when:
- skip_install is not defined
- enable_venv | bool == false
- (ansible_distribution == 'CentOS' and ansible_distribution_major_version <= 7) or
(ansible_distribution == 'Ubuntu' and ansible_distribution_version|version_compare('14.10', '=='))
- name: "Install Ironic using pip"
include: pip_install.yml
package=ironic