변규섭
변규섭

Reputation: 23

How do i use var_prompt module after tasks is started in ansible

I'm new to an Ansible

simply i say, I wanna make a confirmation alert after tasks is started.

due to I have to use setup facts which is hosts addresses in my alert.

my process is below

  1. to show hosts
  2. to confirm that the users really wanna run next processes? [in this part I need to show hosts list]
  3. to do something....

is there any way to resolve it?

thank you.

Upvotes: 0

Views: 439

Answers (2)

Rob H
Rob H

Reputation: 1716

I think Start and Step will do what you want assuming you don't have a lot of tasks in your playbook.

Run your playbook like:

ansible-playbook playbook.yml --step

From the docs: This will cause ansible to stop on each task, and ask if it should execute that task.

The tradeoff is that you're going to get prompted for every task, so this is really only suitable if the number of tasks is small. Also, do you really want to run your playbook interactively?

Upvotes: 1

Konstantin Suvorov
Konstantin Suvorov

Reputation: 68269

You may want to try pause module.

- pause: prompt="Make sure that {{my_custom_fact_ip_address}} is correct..."

Upvotes: 0

Related Questions