Failed to find required executable mysql

Hey guys,

All I’m trying to do, is import a schema in case a database does not exist yet

ansible --version
ansible 1.9.1

remote host is running centos 7 (fully updated) with mysql and mysql-python packages installed.

I have found only one person with this error, but in his case, the error was gone on second run, but for me it always fails.

`

tasks/main.yml

  • name: ensure databases exist
    mysql_db:
    name: “{{ item.name }}”
    login_host: “{{ item.login_host }}”
    login_user: “{{ item.login_user }}”
    login_password: “{{ item.login_password }}”
    state: present
    register: current_db
    notify: import schema
    with_items:
  • { name: “{{ first_dbname }}”,
    login_host: “{{ first_dberver }}”,
    login_user: “{{ root_user }}”,
    login_password: “{{ root_pass }}” }
  • { name: “{{ UNPUB_DBName }}”,
    login_host: “{{ second_dbserver }}”,
    login_user: “{{ root_user }}”,
    login_password: “{{ root_pass }}” }
  • { name: “{{ third_dbname }}”,
    login_host: “{{ third_server }}”,
    login_user: “{{ root_user }}”,
    login_password: “{{ root_pass }}” }

`

`

handlers/main.yml

  • name: import schema
    mysql_db:
    name: “{{ item.item.name }}”
    login_host: “{{ item.item.login_host }}”
    login_user: “{{ item.item.login_user }}”
    login_password: “{{ item.item.login_password }}”
    state: import
    target: “{{ temp_path }}/install/db/mysql/schema.sql”
    with_items: current_db.results

`

Error received:

NOTIFIED: install | import schema

failed: [host] => (item={‘invocation’: {‘module_name’: u’mysql_db’, ‘module_args’: ‘’}, ‘item’: {‘login_user’: u’root’, ‘login_host’: u’host’, 'na

me’: u’db_name’, ‘login_password’: u’pass’}, u’changed’: True, u’db’: u’db_name’}) => {“failed”: true, “item”: {“changed”: true, “db”: “db_name”, “invocatio
n”: {“module_args”: “”, “module_name”: “mysql_db”}, “item”: {“login_host”: “host”, “login_password”: “pass”, “login_user”: “root”, “name”: “db_name”}}}
msg: Failed to find required executable mysql

  • note: changed some names to not disclose my company things…

try to output the PATH var. looks like Ansible is using one that doesn’t have mysql in it.