ansible expect模块抛出错误模块失败分析:失败
我的剧本就像ansible expect模块抛出错误模块失败分析:失败,ansible,ansible-playbook,Ansible,Ansible Playbook,我的剧本就像 - 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 v
- 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传递到第一个提示时,您会得到一个版权协议,它不仅仅是一个页面,您会在页面的末尾找到--更多--当继续按enter键时,协议的最后一行出现第二个提示(出现问题),如
然后你再按一下
然后它要求注册。钥匙
更新:
这就像是在更多之后没有听到我的下一个回应。。我无法理解这是怎么发生的
我的回答并不是为了你
“你同意这个版权吗?[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}
fatal:[10.135.232.213]:失败!=>{“更改”:false,“失败”:true,
“调用”:{“module_name”:“expect”},“module_stderr”:“”,
“模块\标准输出”:“回溯(最近一次调用):\r\n文件
\“/tmp/ansible\u V\u modk/ansible\u module\u expect.py\”,第230行,在\r\n
main()\r\n文件\“/tmp/ansible\u V\u modk/ansible\u module\u expect.py\”,第199行,
在main\r\n events=events,cwd=chdir,echo=echo\r\n文件中
\“/usr/lib/python2.6/site packages/pexpect/uuu init_uuuuu.py\”,第225行,在
runu\r\n env=env,_spawn=spawnu,**kwargs)\r\n文件
\“/usr/lib/python2.6/site packages/pexpect/_init__uuu.py\”,第246行,在
_运行\r\n index=child.expect(模式)\r\n文件
\“/usr/lib/python2.6/site packages/pexpect/_uinit__uuu.py\”,第1451行,在
需要\r\n超时,SearchWindowsSize)\r\n文件
\“/usr/lib/python2.6/site packages/pexpect/_init__uuu.py\”,第1466行,在
预期\u列表\r\n超时,SearchWindowsSize)\r\n文件
\“/usr/lib/python2.6/site packages/pexpect/_init__uuu.py\”,第1535行,在
expect\u loop\r\n c=self.read\u非阻塞(self.maxread,超时)\r\n
文件\“/usr/lib/python2.6/site packages/pexpect/_init__uu.py\”,第984行,在
读取\u非阻塞\r\n s=self.\u强制\u读取\u字符串\r\n文件
\“/usr/lib/python2.6/site packages/pexpect/_init__uuu.py\”,第1797行,在
_强制\u读取\u字符串\r\n返回self.\u解码器。解码(s,final=False)\r\n
文件\“/usr/lib64/python2.6/codecs.py\”,第296行,解码中\r\n
(结果,消耗)=自身缓冲区解码(数据,自身错误,
final)\r\nUnicodeDecodeError:“utf8”编解码器无法解码中的字节0xd2
位置1166:无效的连续字节\r\n,“消息”:“模块故障”,
“已解析”:false}
你可以尝试改变TTY的高度,避免“更多”的事情:
command: /bin/bash -c "stty rows 2000,2000; ./install.sh"
你可以尝试改变TTY的高度,避免“更多”的事情:
command: /bin/bash -c "stty rows 2000,2000; ./install.sh"
我试着使用它,但现在我得到模块故障错误,不明白为什么会遇到那个错误我试着使用它,但现在我得到模块故障错误,不明白为什么会遇到那个错误