I have a remote machine which I ssh to and this leads to a command shell from which I need to enter the command “shell” to enter into the bash shell. I have tried to use the raw module to execute the command and it works, however after entering the bash shell, the rest of my playbook is not preformed. Instead what occurs is that ansible stays in the bash shell for 10 minutes and then times out returning to the original shell. Then, ansible attempts to preform the rest of my playbook, which results in a failure as I need to execute these commands in the bash shell. Essentially, my question is how can I get my ansible playbook to pipe its tasks to be preformed while in the bash shell after I enter the shell using the raw module. Is there another way in which I can enter the bash shell directly using ansible or alternate methods to pipe in the playbook tasks?
Have you tried the shell module?
from the raw module doc:
- This is useful and should only be done in a few cases. A common case is installing
python
on a system without python installed by default. Another is speaking to any devices such as routers that do not have any Python installed. In any other case, using the shell or command module is much more appropriate.
Unfortunately, this does not work because Python is not installed on the initial shell from which I try to enter the bash shell and thus I cannot use any ansible modules except for raw and script