TECHIES WORLD

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

BashLinux

How to run script in a relative path using Ansible

We can user the role_path variable in Ansible to to run script on a relative path. This variable points the working directory of the playbook that include that role.

Sample playbook is sharing below.

- name: Execute script
  shell: script-file-name
  args:
    chdir: "{{role_path}}"

Here we need to replace the script-file-name with the corresponding value.

That's all…

Leave a Reply