title: Set Content-Type and Content-Encoding header of s3 object using ansibles s3_sync or related module
body: <p>Using ansible's <code>s3_sync</code> module (task below) doesn't specify a Content-Type header and then it's not decipherable by the browser. I'm wondering how to set the Content-Type header either with the <code>mime_type</code> option or another ansible module.</p>
  
  <pre><code>  - name: S3 | sync gzip assets in build directory
      s3_sync:
        aws_access_key: "{{ lookup('env', 'AWS_ACCESS_KEY_ID') }}"
        aws_secret_key: "{{ lookup('env', 'AWS_SECRET_ACCESS_KEY') }}"
        bucket: "{{ s3_bucket }}"
        file_root: "{{ s3_sync_dir }}"
        mime_map:
          .gz: application/gzip
          .json: application/text
          .png: image/png
          .ico: image/vnd.microsoft.icon
          .svg: image/svg+xml
        file_change_strategy: force
        permission: public-read
        cache_control: "public, max-age=31536000"
        include: "*"
        region: us-east-1
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/gvP93.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gvP93.png" alt="enter image description here"></a></p>
  
  <p>I would like to do something like:</p>
  
  <pre><code>  mime_map:
      .js.gz: 
          headers: "Content-Encoding=application/gzip, Content-Type=application/js"
      .css.gz: 
          headers: "Content-Encoding=application/gzip, Content-Type=text/css"
      .json: application/text
      .png: image/png
      .ico: image/vnd.microsoft.icon
      .svg: image/svg+xml
  </code></pre>
  
  <p><strong>Please note:</strong> the files are hashed to bust browser cache, so any solution will need pattern matching like: <code>files: **/*.js.gz, headers: "Content-Type=application/javascript"</code></p>