Adding a PPA using Ansible fails

1.6k views Asked by At

I'm using Ansible 2.2.0 to provision a Ubuntu 16.04 server, but it keeps failing at the step where I'm adding a new apt repository:

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"}

I have the following in my playbook:

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

The docs seemed pretty straightforward, so I'm not sure what the problem is here. I tried adding it manually (sudo add-apt-repository ppa:jonathonf/ffmpeg-3) and it worked just fine.

1

There are 1 answers

0
3cheesewheel On

Found this answer which had a different error, but the answer worked; add become: yes to the task and it will work.