我的剧本就像
- name: configuring pdf harmony
expect:
command: ./install.sh
responses:
'This will install pdfharmony on your system. Do you want to continue[y/N]?': y
'Do you agree with this copyright? [y/N]': y
'Now you must enter a valid registration number:': XXXX-XXXX-XXXX-XXXX-XXXX
echo: yes
args:
chdir: '{{ dest_dir }}/pdfHarmony_20_L26_64'
become: yes
错误:
fatal: [10.135.232.213]: FAILED! => {"changed": true, "cmd": "./install.sh",
"delta": "0:00:30.186764", "end": "2016-08-12 14:02:23.384237", "failed":
true, "invocation": {"module_args": {"chdir":
"/usr/local/pdfHarmony_20_L26_64", "command": "./
mounted or mapped drive. You may not copy the software to use for ",
"development, testing or staging purposes.", "", "1. Restrictions: You may
not resell, transfer, rent or lease the Software ", "without the specific
agreement of Appligent. You may not reverse engineer, ", "\u001b[7m--More--
\u001b[27m"]}
我无法理解这个错误的原因 手动安装时, 当你将y传递给第一个提示时,你会得到一个超过一页的版权协议,你会发现 - 更多 - 在页面的末尾,当按下时输入协议的最后一行第二个提示(问题出现)喜欢 when you press y for 1st prompt you see this 然后你按更多 after pressing more at last you see this 然后它要求reg。键
更新: 这就像是不再听我的下一个回应了......我无法理解这是怎么回事 它没有接受我的回应 '您是否同意此版权? [y / N]':y
我添加了更多,现在看起来像
- name: configuring pdf harmony
expect:
command: ./install.sh
responses:
'This will install pdfharmony on your system. Do you want to continue[y/N]?': y
'--More--': \r
'(?i)Do you agree with this copyright? [y/N]': y
'Now you must enter a valid registration number': XXXX-XXXX-XXXX-XXXX-XXXX
echo: yes
args:
chdir: '{{ dest_dir }}/pdfHarmony_20_L26_64'
become: yes
但是现在它在下一次响应时失败了,它没有采取下一个响应,我也不知道它为什么会失败:
"\u001b[7m--More--\u001b[27m\u0007\u0007", "Updates may be licensed to you
by Appligent with additional or different terms.", "", "Do you agree with
this copyright? [y/N] : "]}
模块出现了新的错误,我无法从中获取任何信息,将游戏改为:
- name: configuring stamp pdf batch
expect:
command: /bin/bash -c "stty rows 2000,2000; ./install.sh"
responses:
'This will install stamppdf on your system. Do you want to continue[y/N]?': y
# '--More--': \r
'(?i)Do you agree with this copyright\? \[y/N\]': y
'AP_FONT_DIR [/usr/local/fonts]': y
'Now you must enter a valid registration number': '{{ stamp_pdf_key }}'
echo: yes
args:
chdir: '{{ dest_dir }}/StampPDFBatch_60_L26_64'
become: yes
错误是:
fatal: [10.135.232.213]: FAILED! => {"changed": false, "failed": true,
"invocation": {"module_name": "expect"}, "module_stderr": "",
"module_stdout": "Traceback (most recent call last):\r\n File
\"/tmp/ansible_V_modk/ansible_module_expect.py\", line 230, in <module>\r\n
main()\r\n File \"/tmp/ansible_V_modk/ansible_module_expect.py\", line 199,
in main\r\n events=events, cwd=chdir, echo=echo)\r\n File
\"/usr/lib/python2.6/site-packages/pexpect/__init__.py\", line 225, in
runu\r\n env=env, _spawn=spawnu, **kwargs)\r\n File
\"/usr/lib/python2.6/site-packages/pexpect/__init__.py\", line 246, in
_run\r\n index = child.expect(patterns)\r\n File
\"/usr/lib/python2.6/site-packages/pexpect/__init__.py\", line 1451, in
expect\r\n timeout, searchwindowsize)\r\n File
\"/usr/lib/python2.6/site-packages/pexpect/__init__.py\", line 1466, in
expect_list\r\n timeout, searchwindowsize)\r\n File
\"/usr/lib/python2.6/site-packages/pexpect/__init__.py\", line 1535, in
expect_loop\r\n c = self.read_nonblocking(self.maxread, timeout)\r\n
File \"/usr/lib/python2.6/site-packages/pexpect/__init__.py\", line 984, in
read_nonblocking\r\n s = self._coerce_read_string(s)\r\n File
\"/usr/lib/python2.6/site-packages/pexpect/__init__.py\", line 1797, in
_coerce_read_string\r\n return self._decoder.decode(s, final=False)\r\n
File \"/usr/lib64/python2.6/codecs.py\", line 296, in decode\r\n
(result, consumed) = self._buffer_decode(data, self.errors,
final)\r\nUnicodeDecodeError: 'utf8' codec can't decode byte 0xd2 in
position 1166: invalid continuation byte\r\n", "msg": "MODULE FAILURE",
"parsed": false}
答案 0 :(得分:0)
您可以尝试改变TTY高度并避免使用“更多”事物:
command: /bin/bash -c "stty rows 2000,2000; ./install.sh"