semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

"fix" the debug mode

Open steadfasterX opened this issue 2 years ago • 2 comments

background

I just started with semaphore a day ago and struggled over 2 major issues: the debug is not what I expect to get and there is no role concept for accessing and using semaphore.

The most important thing is I didn't understood first what exactly semaphore expects to run a playbook. In my naive first tries I didn't used git - I simply pointed to a local path to a playbook on my system. That was not working at all but likely for other reasons (which get covered in the next topics).

Now I understand that semaphore expects using a git repo and when executing a task it will run within that directory. ok got it. a better documentation would had prevented that but anyways that's for later.

the actual request

My main concern is: selecting "Debug" when running a task/build should show:

  1. the exact full (ansible) command semaphore is trying to execute
  2. the full (error/no-error) output of that command (i.e. an ansible-playbook cmd)
  3. especially when having syntax issues the both things above are not shown atm

the reason

The problem is when you write your playbooks in e.g. github and then run a task in semaphore it is very handy. you don't need shell access etc. BUT (and here is the issue actually): if you have syntax or other issues in your playbook or roles you will see the very confusing and general error message:

Listing playbook hosts failed

and after that an exit code which varies depending on the actual REAL error.

Listing playbook hosts failed had let me pull my hairs out and ofc I had also read about it here: https://github.com/ansible-semaphore/semaphore/issues/718 until I found out that this error is basically thrown always when you have an issue:

  • with your playbook path (e.g file not found)
  • with a syntax or other error in your playbook
  • with a syntax or other error in your role(s)
  • and likely all other issues preventing Ansible to actually even START

so the debug option in semaphore is useless when the above happens and instead of that currently the generic Listing playbook hosts failed is shown instead of the real underlying issue.

If the above errors are shown it would be easy to identify the real issue and fixing them without using the CLI. I found the above after executing the commands on the CLI manually which directly thrown an ansible error. After fixing them semaphore started flawlessly.

TL;DR

Please show the full (ansible) command used by semaphore and the error output of that command when running a task/build and selecting debug

steadfasterX avatar Mar 16 '22 08:03 steadfasterX

workaround:

add log_path=... to your ansible.cfg and use -vvv as extra CLI arguments. this is really just a workaround only but it might help others until we have a proper solution for this

steadfasterX avatar Apr 21 '22 14:04 steadfasterX

I totally agree with you

Unfortunately the workaround is not always sufficient and I'm still stuck...

JD-ISWT avatar May 23 '22 14:05 JD-ISWT