Network and Prompts

19 views
Skip to first unread message

Billy B

unread,
Jan 11, 2017, 8:55:56 PM1/11/17
to Ansible Project
Hi I am quite new to ansible and I hope I could ask a few questions here please.

My goal

To use ansible to try and configure both Juniper and Cisco devices in one playbook and then test them Eg: run a ping,


How can I prompt for a simple variable will this work? For example

So far
I have a .Set file which gets called from the. Yml file with set system host-name justarandomname

I would like the justarandombame to be the variable which is imputed after a user prompt.

Thanks any help would be greatly appreciated.

Johannes Kastl

unread,
Jan 12, 2017, 5:04:54 AM1/12/17
to ansible...@googlegroups.com
On 11.01.17 22:36 Billy B wrote:
> How can I prompt for a simple variable will this work?

> I would like the justarandombame to be the variable which is
> imputed after a user prompt.

Not sure if I understand you right, but you can put this in your yml
file and call it with the variable set on the command line:

#### snip ###
---
- hosts: "{{ target }}"
...
#### snip ###

ansible-playbook your_file.yml -e 'target=justarandomname'

Johannes

signature.asc
Reply all
Reply to author
Forward
0 new messages