Hi All, i am facing below issue while running a playbook that generates and stores a password for an application: need some help in figuring out how to fix it.
- name: Set variables for new password created block: - name: Print out flatten newpw debug: msg: "{{ lookup('ansible.utils.to_paths', newpw) }}" - name: SQL SA - Set variables for a new password ansible.builtin.set_fact: use_password: '{{ newpw.json.Password }}' ignore_errors: true when: - ( newpw is defined ) no_log: false #end block - name: SQL SA - Set variables for a retrieved password ansible.builtin.set_fact: use_password: '{{ pwresult["json"][0]["Password"] }}' when: - '"Not Found" not in pwresult["msg"]' - 'pwresult is succeeded' no_log: false Error: 2023-09-21T01:15:41.5141061Z TASK [role_pass : Set variables for new password created] ********** 2023-09-21T01:15:41.5141404Z Thursday 21 September 2023 11:15:41 +1000 (0:00:00.205) 0:00:20.403 **** 2023-09-21T01: 15:41.6295368Z [0;31mfatal: [APP1]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'json'\n\nThe error appears to be in 'sa.yml': line 44, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Set variables for a new password \n ^ here\n"}[0m 2023-09-21T01:15:41.6296986Z [0;36m...ignoring[0m 2023-09- 21T01:15:41.6298339Z [0;31mfatal: [APP2]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'json'\n\nThe error appears to be in 'sa.yml': line 44, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Set variables for a new password\n ^ here\n"}[0m 2023-09-21T01:15:41.6298984Z [0;36m...ignoring[0m 2023-09-21T01:15:41.6514809Z [0;31mfatal: [APP3]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'json'\n\nThe error appears to be in 'sa.yml': line 44, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Set variables for a new password\n ^ here\n"}[0m 2023-09-21T01:15:41.6515817Z [0 ;36m...ignoring[0m 2023-09-21T01:15:41.6687053Z [0;31mfatal: [APP4]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'json'\n\nThe error appears to be in 'sa.yml': line 44, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: SQL SA - Set variables for a new password\n ^ here\n"}[0m 2023-09- 21T01:15:41.6688101Z [0;36m...ignoring[0m -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8ba0cb46-1fac-4919-a734-fdc5a64adc4bn%40googlegroups.com.