Hi Ansible devel list,

I'm writing a callback plugin that uses ansible's --diff flag to display a 
summary of changes made by a playbook. In a case where the 'no_log' 
parameter has been set for a task, I want to respect that but still provide 
some useful context.

At the moment I am overriding the v2_on_file_diff class method to parse the 
_result object and construct output like this:

changes:
  test-host-1:
    /Users/nbailey/git/utility/callback/tests/test_file (content):
      after: |-
        Now it's version F
      before: |-
        This is version C
    /Users/nbailey/git/utility/callback/tests/test_file (file attributes):
      after: ''
      before: ''
    changed: 'false'
    redacted:
      redacted_change: 'the output has been hidden due to the fact that 
''no_log: true'' was specified for this result'
  test-host-2:
    /Users/nbailey/git/utility/callback/tests/host2file (content):
      after: |-
        But it's changed to version 2!!
      before: |-
        Now it's version 1
    /Users/nbailey/git/utility/callback/tests/host2file (file attributes):
      after: ''
      before: ''
    changed: 'false'
    redacted:
      redacted_change: 'the output has been hidden due to the fact that 
''no_log: true'' was specified for this result'

When no_log is set, the _result object is censored to 'changed' and a 
message describing that no_log is set ("'the output has been hidden due to 
the fact that ''no_log: true'' was specified for this result'").

Is there a way I can access the task name or the module arguments when 
no_log is set?

When you're displaying output per task, it's clear from context what's 
being censored, but since this output is displayed at the end of a play 
rather than per task, it'd be useful to have some info more specific than 
"something in this play was censored". Is it possible to access that that 
information from the task attributes?

If you'd like some more context, I wrote a bit about what I was trying to 
do here 
https://groups.google.com/forum/#!msg/ansible-project/0TG0aQICf6w/FlvRjeiiBQAJ 
(which was probably the wrong group for it - sorry!)


Thanks,
Nikki

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to