diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-08-14 12:18:25 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-08-14 12:18:25 +0200 |
commit | 72e353a3bfd3ca26dd454d805fa95dfcc7ace0f5 (patch) | |
tree | 8c6b51bacf935407ce999faac137f1c41ca6187f /roles/letsencrypt/tasks/digitalocean.yml | |
parent | update task names & add more logging (diff) | |
download | infra-ansible-72e353a3bfd3ca26dd454d805fa95dfcc7ace0f5.tar.gz infra-ansible-72e353a3bfd3ca26dd454d805fa95dfcc7ace0f5.zip |
letsencrypt: split tasks into different files
Diffstat (limited to 'roles/letsencrypt/tasks/digitalocean.yml')
-rw-r--r-- | roles/letsencrypt/tasks/digitalocean.yml | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/roles/letsencrypt/tasks/digitalocean.yml b/roles/letsencrypt/tasks/digitalocean.yml new file mode 100644 index 0000000..bbf9380 --- /dev/null +++ b/roles/letsencrypt/tasks/digitalocean.yml @@ -0,0 +1,28 @@ +- name: Configure Certbot DigitalOcean plugin + become: true + block: + - name: Prompt for token + ansible.builtin.pause: + prompt: | + Enter your API token: + echo: false + register: digitalocean_token + when: + - lookup('env', 'DIGITALOCEAN_TOKEN') | length <= 0 + + - name: Set the token as a fact + ansible.builtin.set_fact: + 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: + src: certbot.ini + dest: '{{ certbot_ini }}' + owner: root + group: root + mode: '600' |