Conditionally run shell script
Hi guys, I'm trying to learn Ansible and have been building out my own workstation playbook for provisioning them just as an exercise (mostly a forked variation of this).
But for the life of me I cannot figure out how to not run a script conditionally.
zPlug is dumb and is installed via a curl | zsh, I know - security risk but I've looked at it and w/e. How can I only run the curl | zsh if command -v zplug fails?
Things I've tried:
shell: if [[ command -v zplug ]]; then `curl | zsh`; fi
shell: command -v zplug || curl | zsh
- name: Check for zplug
shell: command -v zplug
register: zplug_exists
- name: Install zPlug for ZSH
shell: curl | zsh
when: "zplug_exists.rc == 1"
And I'm out of ideas, help me please
Posted Jan 27, 2017, 5:04 AM UTC · edited
23