Howto add a task from a callback

51 views
Skip to first unread message

Jeff Reter

unread,
Jun 3, 2015, 3:31:42 AM6/3/15
to ansible...@googlegroups.com
what is the  right way to add a task to the end of a playbook from a callback

i need to add a task based on an if in the callback "playbook_on_start"

can you give me an example of an simlpe command taks like echo "hello" (i dont need vars)

Thanks!

Brian Coca

unread,
Jun 3, 2015, 12:51:30 PM6/3/15
to ansible...@googlegroups.com
callbacks have no influence on playbooks, they are to handle output
from plays/tasks, information only goes in one direction.

if you need a conditional task, put it int the play

--
Brian Coca

Jeff Reter

unread,
Jun 9, 2015, 2:44:14 AM6/9/15
to ansible...@googlegroups.com
hmmm, code do no look "read only"

and how can add a task, without adding it to >100 playbooks

write an own "ansible-playbook" wrapper?

is there any better docs than:

Brian Coca

unread,
Jun 9, 2015, 8:30:08 AM6/9/15
to ansible...@googlegroups.com
what are you trying to accomplish? what is this task for?
> --
> 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-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/4565139b-69ad-477a-94ec-abe1e61d791a%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Brian Coca

Jeff Reter

unread,
Jun 9, 2015, 10:53:02 AM6/9/15
to ansible...@googlegroups.com
logging on server which user, ran which playbook, when

Brian Coca

unread,
Jun 9, 2015, 10:59:55 AM6/9/15
to ansible...@googlegroups.com
Ansible already writes to syslog on the target machines also you can
turn on a more detail ansible log on the 'master' in ansible.cfg, In
general I would advice using a callback that writes to syslog (there
is an example in the repo, but it does json/syslog). For your case, if
you just want play name and user, it might be worth patching the
existing logging to add that information.
> https://groups.google.com/d/msgid/ansible-project/a9f762e7-d7f0-4dfe-afe9-8c9e8152ab46%40googlegroups.com.

Jeff Reter

unread,
Jun 15, 2015, 10:36:14 AM6/15/15
to ansible...@googlegroups.com
thanks

sounds like patching "log" is the best way
Reply all
Reply to author
Forward
0 new messages