Hi all,

I am developing a callback plugin to print messages to hipchat when 
playbook starts and finishes, and some additional info like who is running 
the playbook. To get the username I tried 2 ways:

   1. 
   
   cli.options.remote_user -- outputs "None".
   2. 
   
   play.remote_user -- outputs username only if remote_user is defined in a 
   play. Unfortunately we don't do this in our playbooks.
   
I also looked at hipchat 
(https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/callback/hipchat.py)
 
and slack 
(https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/callback/slack.py#L155)
 
callback plugins and it's not working with Ansible 2.4.1.0:


# hipchat

PLAY [aplay] 
********************************************************************************************

[WARNING]: Failure using method (v2_playbook_on_play_start) in callback 
plugin (<ansible.plugins.callback.hipchat.CallbackModule object at 
0x10dd0f5d0>): 'Play' object has no attribute 'playbook'


#slack

PLAY [aplay] 
**********************************************************************************************
 [WARNING]: Failure using method (v2_playbook_on_play_start) in callback 
plugin (<ansible.plugins.callback.hipchat2.CallbackModule object at 
0x1092ba4d0>): 'dict' object has no attribute 'remote_user'


How do I get username which runs the playbook in a callback plugin?


Thanks,

Igor

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a0d6f49a-904a-42d6-bb16-9cfb74732b51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to