Generating the custom log file in ansible

154 views
Skip to first unread message

Syed Kasim

unread,
Mar 31, 2021, 2:23:07 AM3/31/21
to Ansible Development

I am new to Ansible and Python. We have the following requirements.

Writing logs given in the playbook. Like

tasks: 
 - name: Copying the files 
   copy: 
     src: some path 
     dest: some path 
 write_log: msg: "Copied the files"

The 'write_log' should have the following:

  1. Custom message given in the playbook.
  2. Output of builtin 'copy' module.

We have tried custom callback plugin and achieved the second requirement to get the output of the 'copy' module, but unable to get custom message given in the playbook.

Kindly suggest how can we combine both.

Thanks in advance

Reply all
Reply to author
Forward
0 new messages