I am trying to create a new MySQL database with Ansible controller running on Mac OSX. When I first received the error message msg: the python mysqldb module is required
, I added the install task MySQL-python
using pip
. It was installed correctly, but nonetheless I still get a message from Ansible requiring it to be installed.
My minimum playbook:
- hosts: all
tasks:
- name: Ensure MySQL-python module is installed
pip:
name: MySQL-python
executalbe: /usr/local/Cellar/python/2.7.10_2/bin/pip
- name: Create test_db MySQL database
mysql_db:
name: test_db
state: present
when i run playbook with:
ansible-playbook -i "localhost," -c local mysql-test.yml
I get the following result (with changed
for the first task on first start):
TASK: [Ensure MySQL-python module is installed] **************************************
ok: [localhost]
TASK: [Create test_db MySQL database] *********************************************
failed: [localhost] => {"failed": true}
msg: the python mysqldb module is required
pip show MySQL-python
indicates that the package is installed correctly.
I am running Python 2.7.10 and Ansible 1.9.4 installed with homebrew
, so I am not using sudo
.
What is missing?
ubuntu/trusty64
Vagrant ( OSX, Ansible, sudo
pip
).
playbook Mac -c local
, SSH , ( pip
SSH executalbe=/usr/local/Cellar/python/2.7.10_2/bin/pip
, msg: Failed to find required executable pip
)
-c local -vvvv
:
<localhost> REMOTE_MODULE mysql_db name=test_db state=present
<localhost> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1446497958.1-90296161052037 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1446497958.1-90296161052037 && echo $HOME/.ansible/tmp/ansible-tmp-1446497958.1-90296161052037']
<localhost> PUT /var/folders/nw/2vnhg_gj77v_cyfv0p1vdfj80000gn/T/tmpK3DT_j TO /Users/techraf/.ansible/tmp/ansible-tmp-1446497958.1-90296161052037/mysql_db
<localhost> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /Users/techraf/.ansible/tmp/ansible-tmp-1446497958.1-90296161052037/mysql_db; rm -rf /Users/techraf/.ansible/tmp/ansible-tmp-1446497958.1-90296161052037/ >/dev/null 2>&1']
failed: [localhost] => {"failed": true}
msg: the python mysqldb module is required