Modify variables during the playbook

Is it possible to modify nested variables when playbook is executing.

nested_variable:

  • {
    ip: 1.2.3.4,
    port: 80,
    host: ‘example.com’,
    ssl:
    {
    enabled: true,
    port: 443,
    },
    }

During the playbook based on other conditions I want to change enabled to false.

I tried set_fact module but that does not allow dot in variable name. (Btw couldn’t find any explanation for this behavior as well)
I tried set inside jinja2 template but that doesn’t work as well.