title: Ansible task template with output_encoding: base64 throws unknown encoding
body: <p>Following is the ansible task</p>
  <pre><code>- name: copy file
    template:
      src: app.properties.j2
      dest: &quot;{{ installDir }}/app.properties&quot;
      output_encoding: base64
  </code></pre>
  <p>While executing the above task, ansible throws the following error
  <code>An exception occurred during task execution. To see the full traceback, use -vvv. The error was: LookupError: unknown encoding: base64</code> and the detailed stacktrace is</p>
  <pre><code>
  The full traceback is:
  Traceback (most recent call last):
    File &quot;/usr/lib/python3/dist-packages/ansible/executor/task_executor.py&quot;, line 140, in run
      res = self._execute()
    File &quot;/usr/lib/python3/dist-packages/ansible/executor/task_executor.py&quot;, line 612, in _execute
      result = self._handler.run(task_vars=variables)
    File &quot;/usr/lib/python3/dist-packages/ansible/plugins/action/template.py&quot;, line 187, in run
      f.write(to_bytes(resultant, encoding=output_encoding, errors='surrogate_or_strict'))
    File &quot;/usr/lib/python3/dist-packages/ansible/module_utils/_text.py&quot;, line 133, in to_bytes
      return obj.encode(encoding, errors)
  LookupError: unknown encoding: base64
  </code></pre>
  <p>This is the output of ansible version command</p>
  <pre><code>ansible 2.7.7
    config file = /etc/ansible/ansible.cfg
    configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
    ansible python module location = /usr/lib/python3/dist-packages/ansible
    executable location = /usr/bin/ansible
    python version = 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]
  </code></pre>
  <p>All these libraries are packaged in dockerfile.  Please help / advice.</p>