0

My ansible playbook has a task named 'Copy the build script to the system and run it'. It is prone to errors, so I've created a debug task to debug it:

- name: Copy the build script to the system and run it
  template:
    src: build3.sh.j2
    dest: "{{ yocto3_env_user_home }}/build3.sh"
    owner: "{{ yocto3_env_user }}"
    mode: 0755
- command: "/bin/su -l {{ yocto3_env_user }} -c '{{ yocto3_env_user_home }}/build3.sh'"
  register: script_output # Creating a variable from the output of the task
  async: 28800
  poll: 300

- debug:
    var: script_output # Debugging the variable created above

However, when the 'yocto3-env' task fails, ansible halts and doesn't proceed to the debug task, which causes me to miss out on the debugging output as it can be seen below. What could be potential reason for that? (Please note that my ansible runs in a docker container in a CI/CD pipeline)

TASK [yocto3-env : Copy the build script to the system and run it] *************
changed: [3.236.191.93]
TASK [yocto3-env : command] ****************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: OSError: [Errno 2] No such file or directory
fatal: [3.236.191.93]: FAILED! => {"msg": "Unexpected failure during module execution.", "stdout": ""}
ERROR! Unexpected Exception, this is probably a bug: [Errno 2] No such file or directory
to see the full traceback, use -vvv
2
  • Fatal error terminates the thread. That's the default. You can handle the errors on your own if you want to. Oct 8 at 23:13
  • This is good as an answer, can you please answer the question with this comment? Oct 11 at 6:48
0

Per Vladimir Botka: Fatal error terminates the thread. That's the default. You can handle the errors on your own if you want to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.