我只想通过ansible使用分子来完成一项简单的任务。以下代码如下:
- name: Continue to install applications
snap:
name: "{{ item }}"
classic: true
loop:
- bitwarden
- clion
但是我得到了以下错误。使用--debug选项,我没有获得更多信息
Task exception was never retrieved
future: <Task finished name='Task-19' coro=<_read_stream() done, defined at /home/vlad/.local/lib/python3.8/site-packages/subprocess_tee/__init__.py:21> exception=ValueError('Separator is found, but chunk is longer than limit')>
Traceback (most recent call last):
File "/usr/lib/python3.8/asyncio/streams.py", line 540, in readline
line = await self.readuntil(sep)
File "/usr/lib/python3.8/asyncio/streams.py", line 635, in readuntil
raise exceptions.LimitOverrunError(
asyncio.exceptions.LimitOverrunError: Separator is found, but chunk is longer than limit
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/vlad/.local/lib/python3.8/site-packages/subprocess_tee/__init__.py", line 23, in _read_stream
line = await stream.readline()
File "/usr/lib/python3.8/asyncio/streams.py", line 549, in readline
raise ValueError(e.args[0])
ValueError: Separator is found, but chunk is longer than limit
CRITICAL Ansible return code was 2, command was: ansible-playbook --diff --inventory....
可翻译版本:
ansible 2.10.4
config file = None
configured module search path = ['/home/vlad/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/vlad/.local/lib/python3.8/site-packages/ansible
executable location = /home/vlad/.local/bin/ansible
python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]
分子版本:
molecule 3.2.2 using python 3.8
ansible:2.10.4
delegated:3.2.2 from molecule
vagrant:0.6.1 from molecule_vagrant
我检查了机器日志,发现ansible试图在我的机箱中安装snap时,一个步骤内存不足
给将来犯同样错误的人。该错误似乎与快照模块或任何其他模块无关。输出将打印在stdout/stderr上,新行(\n)将转义到\\n。 流模块将尝试在内容中查找b'\n',但由于新行被转义,它将无法找到它。因此会出现错误
如问题中所述,错误源是asyncio/streams.py模块,而不是ansible本身
克服此问题的一种方法是通过对任务使用no_log:true来限制ansible输出
ansible将打印合理的错误消息,而不是抛出python的错误
我能够使用Ubuntu上的
snap
ansible模块安装snap软件包Ubuntu 20.04.1 LTS
代码:
相关问题 更多 >
编程相关推荐