saving the output of debug message

Hello,

I have a simple use case of storing the output of msg (in bold) on target servers in some file. Please suggest.

  • hosts: web
    tasks:
    • name: Print application version during deployment
      debug:
      msg: " The application version {{ version }} is deployed on {{ env }} on {{ansible_date_time.date}}

Kr,
Amit

Hi @devops.amitdas,

Use local_action as under after capturing the output in a variable:

- local_action: 
        module: copy 
        content: "{{ variable1 }}"
        dest: /tmp/whatever.out

Regards,
Vitor Jr.
KodeKloud Support

Hi @Vitor_KodeKloud

Thank you for your swift reply. Now, the file is being created with the application version.

Could you please suggest how can I capture the date and time information in the same file?

Kr,

Amit

Did you try using all the variables? How is your playbook?

Regards,
Vitor Jr.
KodeKloud Support