this post was submitted on 18 Sep 2023
10 points (100.0% liked)

DevOps

1677 readers
1 users here now

DevOps integrates and automates the work of software development (Dev) and IT operations (Ops) as a means for improving and shortening the systems development life cycle.

Rules:

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS
 

I recently stumbled upon a problem: I wanted the stdout of a command task to be printed after execution, so I toggled the global -v flag. However, the service module is apparently verbose as shit and printed like a 100 lines and uhh.... that's a costly tradeoff O_o

Seems like a PR for a task-level verbosity keyword has been proposed, yet rejected.

I'm aware it's possible to just register the stdout of the command and print it in a following debug task, but I wonder if there's a prettier solution.

How would you go about this? Ever encountered such a feeling?

top 4 comments
sorted by: hot top controversial new old
[–] [email protected] 5 points 1 year ago (1 children)

The PR wasn't rejected, looks like it was abandoned by the author and otherwise no one seems to care enough about the parent issue.

Anyway, it looks like you pretty much answered your own question.
In general you probably shouldn't care about the output of the commands unless you're debugging some specific issue, in which case "tradeoff" of Ansible actually being verbose is a plus. ;)

[–] [email protected] 1 points 1 year ago

Oh thanks for the heads up, I should've read it more carefully :P

[–] [email protected] 3 points 1 year ago* (last edited 1 year ago) (1 children)

Hi! After more than 6 years using Ansible I have not found a way to print the standard output of a program running under the command module, so I'm afraid the only way to achieve this is exactly what you suggest: using a debug task, something that has always seemed terribly ugly to me.

[–] [email protected] 2 points 1 year ago

Yup, that's what i would also do.