I am trying to run a simple query on many servers. I know 100% that the file and directory in question exist.
I can do simple commands, such as ls
, pwd
, whoami
, etc, and I can run the sqlite
command on the remote host itself.
The playbook task:
- name: Do a test SELECT statement
become: yes
become_user: root
command: sqlite3 /usr/local/share/sqlite/dbfile.sqlite3 "SELECT * FROM db WHERE hostname="{{ db_server_prompt }}""
register: query_result
- debug: var=query_result.stdout_lines
The error I'm receiving is "msg": "[Errno 2] No such file or directory: b'sqlite3'",
.
Is there something wrong with my syntax? Why is it telling me there's "No such file or directory
" when using the sqlite3 command? I've tried the absolute path to the executable (/usr/bin/sqlite3
), but I get the same error.
Update I tried to use chdir
as an argument per this answer, but I get Unable to change directory before execution
. I also tried the absolute path to sqlite
with /usr/bin/sqlite3
. None of these things are working.