We can use the Ansible shell module to run Linux commands.
Let us see the sample yaml code to run a shell script after changing the location.
- name: Run Linux command. shell: sh script.sh args: chdir: foldername
Here we need to replace the script and folder names accordingly.
Please note that any shell commands or scripts can be executed in this way.