[[ ansible: Malformed output discovered from systemd list-unit-files ]]

ansible: Malformed output discovered from systemd list-unit-files

ansible 2.9.6
Ubuntu 20.04

Ansible не может собрать сведения о сервисах systemd

$ ansible -m service_facts localhost
localhost | FAILED! => {
    "changed": false,
    "msg": "Malformed output discovered from systemd list-unit-files: accounts-daemon.service                    masked          enabled      "
}

/usr/lib/python3/dist-packages/ansible/modules/system/service_facts.py

@@ -213,7 +213,7 @@
         rc, stdout, stderr = self.module.run_command("%s list-unit-files --no-pager --type service --all" % systemctl_path, use_unsafe_shell=True)
         for line in [svc_line for svc_line in stdout.split('\n') if '.service' in svc_line and 'not-found' not in svc_line]:
             try:
-                service_name, status_val = line.split()
+                service_name, status_val = line.split()[:2]
             except ValueError:
                 self.module.fail_json(msg="Malformed output discovered from systemd list-unit-files: {0}".format(line))
             if service_name not in services:






Обсуждение

Ваш комментарий. Вики-синтаксис разрешён:
199 +0 =
 
practice/bugs/ansible_malformed_output_discovered_from_systemd.txt · Последнее изменение: 2022/09/14 17:13 — lexa
Gentoo Linux Gentoo Linux Driven by DokuWiki