Я пытаюсь использовать одну переменную для использования. Но переменная также изменялась при пропуске.
name: Check httpd
debug:
msg: "NO"
when: ansible_facts.services["httpd"] is not defined or ansible_facts.services["httpd.service"] is not defined
register: httpd_status
- name: Check httpd
debug:
msg: "YES"
when: ansible_facts.services["httpd"] is defined and ansible_facts.services["httpd"].state == "running" or ansible_facts.services["httpd.service"] is defined and ansible_facts.services["httpd.service"].state == "running"
register: httpd_status
В результате недопустимый объект dict.
"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'stdout_lines'