Ansible Expect模块重复回答

时间:2019-09-26 16:40:27

标签: ansible

我正在使用Ansible Expect模块来安装软件。在安装过程中,软件安装会询问几个问题。直到最后几个问题,一切似乎都进展顺利。当提出问题时,使用先前问题的答案。请参阅下面的代码和详细程度。预先感谢您的帮助。

name: Run the Install of the software
expect:
chdir: /tmp/
timeout: 120
command: ./software.bin -c
responses: 
  Do you want to continue? : 'y'
  Select only the set of components you want to install : '2'
  Communication Direction : '1'
  Where should the software be installed? : ""
  Minimum requirements met. Select "Yes" to continue, "No" to cancel installation : 'y'
  First name : 'Doug'
  Last name : 'Keller'
  Company : 'Awesome'
  Do you want to pair the scan engine with the console now? : 'y'
  Console Address : '10.x.x.x'
  Console TCP Port : ""
  Shared Secret : 'some-secret'
  Please select t to test your connection before continuing to pair with the console : 't'
  Select c to pair this engine to the console: 'c'
  sudo systemctl start software.service: ""
echo: yes

详细程度如下:

"                                                                           ", 
    "Do you want to pair the scan engine with the console now? Pairing on installation is recommended, but you can pair later if necessary. ", 
    "Yes [y], No [n]", 
    "y", 
    "Specify the details for the Security Console with which to pair this Scan Engine", 
    "Console Address:", 
    "[]", 
    "10.x.x.x", 
    "Console TCP Port:", 
    "[40000]", 
    "", 
    "", 
    "Shared Secret:", 
    "[]", 
    "some-secret", 
    "The port number is valid.", 
    "Console Address accepted.", 
    "Console Shared Secret accepted.", 
    "Testing the connection is required. Please select t to test your connection before continuing to pair with the console.", 
    "Test [t, Enter], Continue [c]", 
    "10.x.x.x", 
    "Testing the connection is required. Please select t to test your connection before continuing to pair with the console.", 
    "Test [t, Enter], Continue [c]", 
    "some-secret", 
    "Testing the connection is required. Please select t to test your connection before continuing to pair with the console.", 
    "Test [t, Enter], Continue [c]", 
    "t", 
    "running test...", 
    "Communication between engine and console succeeded!", 
    "Select c to pair this engine to the console.", 
    "Test [t, Enter], Continue [c]", 
    "t", 
    "running test...", 
    "Communication between engine and console succeeded!", 
    "Select c to pair this engine to the console.", 
    "Test [t, Enter], Continue [c]", 
    "t", 
    "running test...", 
    "Communication between engine and console succeeded!", 
    "Select c to pair this engine to the console.", 
    "Test [t, Enter], Continue [c]"

0 个答案:

没有答案