HELP please - default 'yes' to all prompt in ansible

54 views
Skip to first unread message

NouraD

unread,
Apr 4, 2017, 11:55:58 AM4/4/17
to Ansible Project
currently ansible allows only one 'yes' to be pushed to any question generated by config script. 

I cannot run multiple 'yes' for the prompts generated . it get stuck after first  'yes'


this is my task :

---
- name: place generated  config file
  template: src=config-template dest=/root/config-file owner=root group=root mode=0644

- name: snmp bash
  template: src=run.bash dest=/root/run.bash owner=root group=root mode=0777

- name: Run script

  shell: /root/run.bash -->  this will run the bash script directly on the VNF

  register: myoutput



this is my template , will be run directly from VNF


run.bash

#!/bin/bash

yes y | /opt/config/bin/Config -f /root/config-file  --> this will run on the VNF to configure the system



any help please?







Kai Stian Olstad

unread,
Apr 4, 2017, 12:30:39 PM4/4/17
to ansible...@googlegroups.com
For interactive scripts you will need to use expect module to make it work.

--
Kai Stian Olstad

NouraD

unread,
Apr 4, 2017, 1:50:11 PM4/4/17
to Ansible Project, ansible-pr...@olstad.com
even if i want to bypass all the prompt? i would like  it to proceed with 'yes' in the background without validating the answer.

Kai Stian Olstad

unread,
Apr 4, 2017, 1:57:27 PM4/4/17
to ansible...@googlegroups.com
On 04. april 2017 19:50, NouraD wrote:
> even if i want to bypass all the prompt? i would like it to proceed with
> 'yes' in the background without validating the answer.

Only way to bypass the prompts is if the script support it with a
command line option.
If not, the interactive script do expect the answer at a specified time,
only way to do that in Ansible or from another script would be to use
expect.

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages