title: Ansible change all dict key values only by filters
body: <p>I have an ansible dict like</p>
  
  <pre><code>ports:
    webui: 7200
    webadmin: 7209
    core_api: 7201
    stock_api: 7204
    import_export: 7207
  </code></pre>
  
  <p>And i want to transform all keys in it, like</p>
  
  <pre><code>ports:
    staging-webui: 7200
    staging-webadmin: 7209
    staging-core_api: 7201
    staging-stock_api: 7204
    staging-import_export: 7207
  </code></pre>
  
  <p>I do that in 'vars' section, so i can't use 'set_fact' with 'with_items' to iterate over dict. Is it possible to it only by filters?</p>
  
  <p>I found working answer, </p>
  
  <pre><code>env: staging # comes from outside
  
  regex_env: "\"key\": \"{{ env }}-\\1\""
  app_upstreams: "{{ ports | dict2items | map('to_json') | map('regex_replace', '\"key\":\\s\"(.*)\"', lookup('vars', 'regex_env')) | map('from_json') }}"
  </code></pre>
  
  <p>but it looks really ugly, is there more good-looking solution?</p>