Hi,
Suppose I have a role called Ruby. I will
- install build tools
- download ruby source
- compile
- install
Because it takes long time to do all these tings and I don’t want to it it the expected Ruby already installed.
How could I do it?
I could do it using the “when” condition on every step. like the following:
-
name: check if ruby installed
shell: ls /opt/rubies
register: ruby_installed -
name: install dependencies
apt: name =…
when: ruby_installed.stdout.find(ruby_full_version) == -1
Wonder if there is any better solution? like a precondition for all the tasks in a role?
Also I found it would be convenient if we have module like Java, Ruby to install various version of the packages. Like Chef they have Java cookbook.
Any suggestion is really appreciated.
Cheers,
Rui