How to create a complex variable from an existing variable (not a clone)

Hi,

I’m using a lot of parameters when I instantiate an ec2 instance. I’d like to reuse the same configuration for all my instances and extend them depending on instances.
For example, my global variable is

ec2_parameters:

key_name: mykey
instance_type: mytype
image: ami-60a10117
region: myregion

and in my playbook, I’d like to use the same ec2_parameters and to add some configuration depending on the instance I configure :

host: instance_type_1

vars:
ec2:

“{{ ec2_parameters + dict(foo=‘bar’) }}”

host: instance_type_2

vars:
ec2:

“{{ ec2_parameters + dict(foo=‘toto’) }}”

Is there a way to do that easily ?

Thanks