Modify registered variable content from the copy module?

Hello -

Is there a way to modify the content of a registered variable? I have a shared role that logs output of my deployments.

tasks/main.yml
`

  • name: Log {{ filename }} changes
    blockinfile:
    dest: “{{ log_dir }}/{{ pb_logname }}”
    content: |

The only way I’ve been able to do something like this, assuming I understand correctly, is to write the value to a vars file in the playbook, then load that vars file when you need it later on in the playbook.