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 "
}
@@ -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:
Обсуждение