Last active
May 8, 2024 02:47
-
-
Save enisozgen/0a61358b8101b7a08051fe121d5bbf01 to your computer and use it in GitHub Desktop.
ansible tasks that Checks if a program exists from a Bash script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Check is rvm installed | |
shell: command -v rvm >/dev/null 2>&1 | |
register: is_rvm_exist | |
ignore_errors: yes | |
- debug: msg="{{ is_rvm_exist.rc }}" # it returns rc 1 | |
- debug: var=is_rvm_exist | |
- name: Check is ls installed | |
shell: command -v ls >/dev/null 2>&1 | |
register: is_ls_exist | |
ignore_errors: yes | |
- debug: msg="{{ is_ls_exist.rc }}" # it returns rc 0 | |
- debug: var=is_ls_exist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!
I always forgot bash "command".