issue with ansible acme module

239 Views Asked by At

I've tried to use acme_certificate module to generate cert on my server

I use it with the next params:

- name: "Generate a Let's Encrypt account key"
  shell: "openssl genrsa 4096 | sudo tee /etc/letsencrypt/account.key"

- name: "install acme"
  acme_certificate:
    acme_version: 2
    challenge: http-01
    terms_agreed: 1
    csr: "/etc/letsencrypt/csrs/{{ domain_name }}.csr"
    account_key_content: "/etc/letsencrypt/account.key"
    fullchain_dest: "/etc/letsencrypt/certs/fullchain_{{ domain_name }}.crt"
    acme_directory: https://acme-v02.api.letsencrypt.org/directory 
    account_email: "/etc/letsencrypt/account.key""
  become: yes

But when I've executed playbook I saw the next

FAILED! => {"changed": false, "msg": "error while parsing account key: error while loading key: Could not unserialize key data.", "other": {}}

Why does it happen ?

1

There are 1 best solutions below

2
On

I've notice that I use wrong Parameter I should use account_key_src instead of account_key_content