Useful shortcuts for vi editor

Tuesday, 24 May 2022

'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'stdout'

Action
ansible-playbook -i /etc/ansible/hosts /etc/ansible/example.yml -v

Error
'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'stdout'

Solution
Use the standard output of the variable before setting it as a fact
e.g.
- name: debug
  debug:
   msg: "Hello, {{ my_variable.stdout }}!"

- name: set fact the variable
  set_fact:
    fact_my_variable: "{{ my_variable.stdout }}"