IYI, my eventual solution involves creating a blank change-mgmt ticket with 
a callback_plugin in init(). I then store the ticket number that is created 
in __main__.cli.ticket_number.
Then, the first pre-task of my playbook calls my action_plugin to read the 
ticket_number from __main__.cli and update the ticket with the actual data 
specific to the playbook that is being run.

I'm not sure I'm completely satisfied with this solution, but it does seem 
to work.



On Tuesday, January 26, 2016 at 1:22:01 PM UTC-5, Mike Biancaniello wrote:
>
> Ok, so the problem I'm having in making this a callback is that I want to 
> open a ticket on playbook start and close it on stats. 
>
> In order to open the ticket, I need certain information that will be 
> specific to the playbook being run. The only way I can find to pass vars is 
> through play_vars, which are only available in v2_playbook_on_play_start 
> through play.get_vars().
> These vars are only those that are set in the play itself, which excludes 
> vars defined in vars_files (play.get_vars_files() returns a list of files 
> which I would then need to read).
>
> I feel like I'm missing something. Is there a better way that I can pass 
> variables to a callback_plugin?
>
> The best I can find so far is to grab them from TaskResult['invocation'] 
> *after* the first task is run (then keep track of the fact that I've 
> already opened a ticket and not open a new one for every task).
>
>
>

-- 
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/796887d1-9e14-4b15-a28b-f82987d54c45%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to