TECHIES WORLD

For Techs.... Techniques.... Technologies....

CpanelLinuxPython

How to execute Linux shell command remotely using Ansible

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.

That's all…

Leave a Reply