Context: I am working on a database project, I have a central server (linux) that has to ssh to a db server (linux) and run commands. The thing is that the database commands can only run from a specific directory.
I am using the shell module
So for instance, in my playbook I have this line: shell: ssh dbadmin@dbserver001 cd sqllib/bin/ ; ls
By the time the ls part runs, the terminal has already returned to the central server and its showing me the directory before I ran the ssh command (I want it to ls from the sqllib/bin/ directory and not the central server). I also tried replacing the ; with && and the same thing occurs.
Note that using ls directly after the ssh command works (shell: ssh dbadmin@dbserver001 ls) but I have to use cd first in order to get to the proper folder to run the database commands.
Is there a way to force it to stay in the ssh'ed directory? Otherwise it will be impossible to complete my project.