使用Ansible添加PPA失败

时间:2017-01-03 17:11:42

标签: ansible apt

我使用Ansible 2.2.0来配置Ubuntu 16.04服务器,但它在我adding a new apt repository {<3}}的步骤中一直失败:

fatal: [the.server.ip.address]: FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_pctla3gj/ansible_module_apt_repository.py\", line 528, in <module>\r\n    main()\r\n  File \"/tmp/ansible_pctla3gj/ansible_module_apt_repository.py\", line 492, in main\r\n    sourceslist.add_source(repo)\r\n  File \"/tmp/ansible_pctla3gj/ansible_module_apt_repository.py\", line 403, in add_source\r\n    info = self._get_ppa_info(ppa_owner, ppa_name)\r\n  File \"/tmp/ansible_pctla3gj/ansible_module_apt_repository.py\", line 377, in _get_ppa_info\r\n    return json.load(response)\r\n  File \"/usr/lib/python3.5/json/__init__.py\", line 268, in load\r\n    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)\r\n  File \"/usr/lib/python3.5/json/__init__.py\", line 312, in loads\r\n    s.__class__.__name__))\r\nTypeError: the JSON object must be str, not 'bytes'\r\n", "msg": "MODULE FAILURE"}

我的剧本中有以下内容:

- name: add the ffmpeg PPA
  apt_repository:
    repo: 'ppa:jonathonf/ffmpeg-3'

文档看起来非常简单,所以我不确定这里的问题是什么。我尝试手动添加它(sudo add-apt-repository ppa:jonathonf/ffmpeg-3),它工作得很好。

1 个答案:

答案 0 :(得分:0)

发现this answer有不同的错误,但答案有效;将become: yes添加到任务中它将起作用。