From e0ac1fa82073833a3860a8dfda558a9f6bf7a790 Mon Sep 17 00:00:00 2001
From: Egor Tensin <Egor.Tensin@gmail.com>
Date: Mon, 14 Aug 2023 11:45:49 +0200
Subject: letsencrypt: fix manual token prompts

---
 roles/letsencrypt/tasks/main.yml | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'roles')

diff --git a/roles/letsencrypt/tasks/main.yml b/roles/letsencrypt/tasks/main.yml
index 814c549..d12aad2 100644
--- a/roles/letsencrypt/tasks/main.yml
+++ b/roles/letsencrypt/tasks/main.yml
@@ -40,7 +40,12 @@
 
     - name: Set the token as a fact
       ansible.builtin.set_fact:
-        digitalocean_token: "{{ digitalocean_.user_input | default(lookup('env', 'DIGITALOCEAN_TOKEN')) }}"
+        digitalocean_token: "{{ digitalocean_token.user_input | default(lookup('env', 'DIGITALOCEAN_TOKEN')) }}"
+
+    - name: Fail if the token is invalid
+      ansible.builtin.fail:
+        msg: 'DigitalOcean token is invalid'
+      when: digitalocean_token | length == 0
 
     - name: Configure certbot.ini
       ansible.builtin.template:
-- 
cgit v1.2.3