Calculate in salt state

Hi.

I try to find a way to calculate some ports via an offset, that I definied in a state: The code is like this:

{% set domain = [

    { "server": "server1", "dom": "domain1", "port": 7000, "version": "2.12.0" },
    { "server": "server2", "dom": "domain2", "port": 8000, "version": "1.12.0" },
]

%}

{% set offset_admin = 1 %}
{% set offset_managed = 3 %}
{% set offset_nm = 99 %}

{% for dom in domain %}
{% if grains[‘host’] == dom.server %}

{% set serverport = salt [‘cmd.shell’](‘echo $(({{ dom.port }}+{{ offset_managed }}))’) %}
/path_to_file/{{ dom.dom }}/filename-mod2:
file.replace:
- name: /path_to_file/{{ dom.dom }}/filename.ini
- pattern: “@PORT@”
- repl: {{ serverport }}
- onlyif:
- grep ‘@PORT@’ /path_to_file/{{ dom.dom }}/filename.ini

{% endif %}
{% endfor %}

Unfortunately, the value of the variables seems not to be filled before executing the bash command:

[ERROR ] Command ‘echo’ failed with return code: 1
[ERROR ] stdout: /bin/bash: {{ dom.port }}+{{ offset_managed }}: syntax error: operand expected (error token is “{{ dom.port }}+{{ offset_managed }}”)
[ERROR ] retcode: 1
[ERROR ] Command ‘echo’ failed with return code: 1

I tried some code like this (with fixed values instead of variable “offset_managed” ) too:

{% set serverport=eval({{dom.port+3}}) %}
or
{% set serverport = {{ dom.port }} + 3 %}

Any ideas? Is there a way to calculate directly in the state?

Kind regards
Jörg