ansible-role-letsencrypt icon indicating copy to clipboard operation
ansible-role-letsencrypt copied to clipboard

letsencrypt_opt_test_cert is undefined

Open 107142 opened this issue 1 year ago • 0 comments

Found a minor issue when the acme account is not created. The playbook fails at task Create new Let's Encrypt account.

fatal: [sub.example.org]: FAILED! =>
  msg: |-
    The task includes an option with an undefined variable. The error was: 'letsencrypt_opt_test_cert' is undefined. 'letsencrypt_opt_test_cert' is undefined

    The error appears to be in '/home/user/linux-maintenance/roles/ansible-role-letsencrypt/tasks/account.yml': line 54, column 5, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:


      - name: Create new Let's Encrypt account
        ^ here

Looking at the code it seems the issue stems from 'letsencrypt_opt_test_cert' gets defined in certificate.yml but the var is used earlier in account.yml beforce being properly defined.

The easiest solution seems to be simply moving the set_fact that defines the var into account.yml.

107142 avatar Jan 03 '24 16:01 107142