I'm trying to restore a MySQL database and this message is shown.
"msg": "Failed to find required executable mysql in paths: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin"
MySQL is installed in the host (I successfully restored from the command line) but when I try to execute module it doesn't work. Tried to add path as well, but nothing... Any suggestions?
Controller OS (macOS Mojave) Host OS (macOS High Sierra) MySQL 8 ansible 2.7.4
# - name: add 'mysql' to path
# lineinfile:
# dest: /etc/paths
# state: present
# backrefs: yes
# regexp: 'PATH=(["]*)((?!.*?/usr/local/mysql/bin/).*?)(["]*)$'
# line: 'PATH=\1\2:/usr/local/mysql/bin\3'
# - name: add 'mysql' to path
# shell: export PATH=$PATH:/usr/local/mysql/bin && echo $PATH
- name: Copy database dump file to host
copy:
src: dump.sql
dest: /tmp
- name: Restore database
mysql_db:
login_user: root
login_password: password
state: import
name: all
target: /tmp/dump.sql
ln -s /usr/local/mysql/bin/* /usr/local/sbin/
– JGK