LukasGibb.unixodbc
ansible-role-unixodbc
This is an Ansible role that helps you install and set up UnixODBC along with DSN entries.
You can also choose to download and install the MySQL ODBC 8.0 driver, but it's currently only available for Ubuntu 18.04 x64.
The installation process follows what is described in the MySQL documentation:
Installing Connector/ODBC from a Binary Tarball Distribution
This installation can be tricky, so there might be ways to improve this role. For now, I've hard-coded some values for convenience (like filenames from the tar file). It would be easier to have a package managed by apt-get, but it seems no one maintains the Ubuntu package for the MySQL ODBC driver anymore, which is puzzling.
In the future, I plan to add support for more drivers (like PostgreSQL), so you can just set some variables to install the ones you need.
Requirements
None
Role Variables
Check defaults/main.yml
Dependencies
None
Example Playbook
- hosts: servers
roles:
- { role: lukasgibb.unixodbc, unixodbc_mysql_dl_enabled: true }
You can add your DSN list in the host or group variables like this:
unixodbc_dsns:
- name: asterisk-connector
description: MySQL connection to 'asterisk' database
driver: MySQL ODBC 8.0 Driver
database: asterisk
server: 127.0.0.1
port: 3306
socket: /var/run/mysqld/mysql.sock
License
MIT
Author Information
This role was created in 2019 by: Lukas Gibb - CloudJourneyman.com
An Ansible role that installs and configures UnixODBC
ansible-galaxy install LukasGibb.unixodbc