geerlingguy / ansible-role-php

Ansible Role - PHP
https://galaxy.ansible.com/geerlingguy/php/
MIT License
496 stars 441 forks source link

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 when TASK [Add ppa Repository] #366

Closed scil closed 2 years ago

scil commented 2 years ago
  pre_tasks:
    - name: Add ppa Repository
      become: yes
      apt_repository: repo=ppa:ondrej/php 

` TASK [Add ppa Repository]


An exception occurred during task execution. To see the full traceback, use -vvv. The error was: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 907: invalid continuation byte

fatal: [a.test]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n
File \"/home/vagrant/.ansible/tmp/ansible-tmp-1648044179.5023565-6149-280507338387420/AnsiballZ_apt_repository.py\", line 107, in \n _ansiballz_main()\n

File \"/home/vagrant/.ansible/tmp/ansible-tmp-1648044179.5023565-6149-280507338387420/AnsiballZ_apt_repository.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/vagrant/.ansible/tmp/ansible-tmp-1648044179.5023565-6149-280507338387420/AnsiballZ_apt_repository.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible.modules.apt_repository', init_globals=dict(_module_fqn='ansible.modules.apt_repository', _modlib_path=modlib_path),\n File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_apt_repository_payload_gx8_t6y7/ansible_apt_repository_payload.zip/ansible/modules/apt_repository.py\", line 668, in \n File \"/tmp/ansible_apt_repository_payload_gx8_t6y7/ansible_apt_repository_payload.zip/ansible/modules/apt_repository.py\", line 606, in main\n File \"/tmp/ansible_apt_repository_payload_gx8_t6y7/ansible_apt_repository_payload.zip/ansible/modules/apt_repository.py\", line 426, in init\n File \"/tmp/ansible_apt_repository_payload_gx8_t6y7/ansible_apt_repository_payload.zip/ansible/modules/apt_repository.py\", line 205, in init\n File \"/tmp/ansible_apt_repository_payload_gx8_t6y7/ansible_apt_repository_payload.zip/ansible/modules/apt_repository.py\", line 305, in load\n File \"/usr/lib/python3.8/codecs.py\", line 322, in decode\n (result, consumed) = self._buffer_decode(data, self.errors, final)\nUnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 907: invalid continuation byte\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

scil commented 2 years ago

I mannully run sudo add-apt-repository ppa:ondrej/php

I got warning msg WARNING:root:could not open file '/etc/apt/sources.list'

after some google, I restore origin official sources.list and sudo chmod -R +x /etc/apt/

then everything is ok.