Need some assistance to send to a text file a message that appears in debug msg.
my uri task give me the flow msg
“msg”: [
“JOB-1”,
“JOB-2”,
" JOB- 3 ",
" JOB- 4 ",
" JOB- 5 ",
" JOB- 6 ",
" JOB- 7 "
]
and I need to add task on the playbook to send this msg to specific file like this
The text you print in the debug task is previously stored in a variable?
If that’s the case, you can write the variable stdout_lines attribute to a local file using lineinfile module and delegate_to: localhost, so this is writted locally.
The text you print in the debug task is previously stored in a variable? *No*
- name: Display all Jobs Names
ansible.builtin.debug:
msg: "{{ Jobs.json | json_query('Jobs.Jobs[*].Name')}}"