Run tasks in ansible before pre provisioning

717 Views Asked by At

I have a set of taks in my playbook that I would like to run before ansible checks to see if roles exist. (One installs roles from galaxy and github) Right now, it appears, that ansible checks if all of the roles referenced exist prior to running ANY tasks because I get fatal errors saying those roles don't cannot be found. Can I define a task that can be run before this pre-provisioning? I would like to do this via ansible and not have to put it in a bash script that runs before my playbook.

1

There are 1 best solutions below

2
On BEST ANSWER

It would be a great way to automate downloading Galaxy dependencies and ensuring the latest/correct version of all roles is installed. Unfortunately this is not possible.

I tried this with

  • pre_tasks
  • playbook-includes
  • conditional playbook-includes

But it's all the same. The playbook is first completely parsed and resolved (includes, roles) before the first task is executed.