Azure application gateway pfx certificate installation with Ansible

Viewed 103

I am trying to provision an Azure application gateway using Ansible. But am getting the below error when I try to include a PFX certificate.

fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'file'. Error was a <type 'exceptions.UnicodeDecodeError'>, original message: 'utf8' codec can't decode byte 0x82 in position 1: invalid start byte"}

This is my ansible script

ssl_certificates:
     - data: "{{ lookup('file', './certificate.pfx') }}"
       name: certificate
       password: "xxxxxxxx"

I have tried the following format but no luck

  • data: "{{ b64encode (lookup('file', './certificate.pfx' )) }}"
  • data: "{{ lookup('file', './certificate.pfx') | b64encode }}"
  • data: "{{ lookup('file', './certificate.pfx') b64encode }}"
  • data: "{{ b64encode | (lookup('file', './certificate.pfx' )) }}"
0 Answers
Related