S
S
Sanes2017-01-09 21:58:57
System administration
Sanes, 2017-01-09 21:58:57

Ansible. Is it possible to pass to var_prompt (for example) the target host?

When starting the playbook, you can specify the -i key with the necessary inventory, and already in the playbook itself, resolve the hosts. But somehow it looks hardcoded. Ideally I would like to use var_prompt

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Puma Thailand, 2017-01-10
@opium

through and everything is fine, no hardcore

G
Grigory, 2017-01-10
@gerasimov

---
- hosts: "{{ host }}"

  vars_prompt:
    - name: host
      prompt: "Enter hostname"
      private: no

  tasks:
    - debug: msg="{{ host }}"

the only question is that the file with inventory with the host registered there entered through vars_prompt should still be there, otherwise it does not work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question