mirror of
https://github.com/MatteZ02/infra.git
synced 2024-12-22 08:23:18 +00:00
Tasks Update: Move Certbot to Podman container
This commit is contained in:
parent
ecfa10fe1c
commit
f0601c105c
@ -1,15 +1,24 @@
|
|||||||
---
|
---
|
||||||
- name: "Deployer - Certbot - Renew Certificates"
|
- name: "Deployer - Certbot - Renew Certificates"
|
||||||
command: "certbot renew --config-dir ~/data/letsencrypt/config --logs-dir ~/data/letsencrypt/logs --work-dir ~/data/letsencrypt/work"
|
containers.podman.podman_container:
|
||||||
|
name: certbot
|
||||||
|
image: "docker.io/certbot/certbot:latest"
|
||||||
|
state: started
|
||||||
|
network: host
|
||||||
|
volumes:
|
||||||
|
- "{{ ansible_facts.user_dir }}/data/certbot:/etc/letsencrypt"
|
||||||
|
command: "renew"
|
||||||
|
detach: false
|
||||||
register: task
|
register: task
|
||||||
changed_when: task.stdout.find("No renewals were attempted.") == -1
|
changed_when:
|
||||||
|
- task.stdout.find("No renewals were attempted.") == -1
|
||||||
tags:
|
tags:
|
||||||
- certbot
|
- certbot
|
||||||
- tls
|
- tls
|
||||||
|
|
||||||
- name: "Deployer - Certbot - Copy Certificates"
|
- name: "Deployer - Certbot - Copy Certificates"
|
||||||
copy:
|
copy:
|
||||||
src: "~/data/letsencrypt/live/{{ cert }}/"
|
src: "~/data/certbot/live/{{ cert }}/"
|
||||||
dest: "~/data/certificates/{{ cert }}/"
|
dest: "~/data/certificates/{{ cert }}/"
|
||||||
follow: true
|
follow: true
|
||||||
loop: "{{ certs }}"
|
loop: "{{ certs }}"
|
||||||
|
@ -61,42 +61,35 @@
|
|||||||
label: "{{ library }}"
|
label: "{{ library }}"
|
||||||
loop_var: "library"
|
loop_var: "library"
|
||||||
|
|
||||||
- name: "Installer : Certbot : Install"
|
- name: "Installer : Certbot : Auth Hook - Create Folder"
|
||||||
pip:
|
file:
|
||||||
name: certbot
|
path: ~/data/certbot/auth-hooks
|
||||||
state: latest
|
state: directory
|
||||||
extra_args: --upgrade
|
|
||||||
virtualenv: ~/.venv/ansible
|
|
||||||
virtualenv_command: "python3 -m venv"
|
|
||||||
tags:
|
tags:
|
||||||
- certbot
|
- certbot
|
||||||
|
|
||||||
- name: "Installer : Certbot : Create Symbolic Links"
|
- name: "Installer : Certbot : Auth Hook - Download"
|
||||||
ansible.builtin.file:
|
get_url:
|
||||||
src: ~/.venv/ansible/bin/{{ binary }}
|
url: "https://git.waren.io/warengroup/acme-dns-auth/raw/branch/master/acme-dns-auth.py"
|
||||||
dest: ~/bin/{{ binary }}
|
dest: "~/data/certbot/auth-hooks/acme-dns.py"
|
||||||
state: link
|
mode: '700'
|
||||||
vars:
|
force: true
|
||||||
binaries:
|
|
||||||
- certbot
|
|
||||||
loop: "{{ binaries }}"
|
|
||||||
loop_control:
|
|
||||||
label: "{{ binary }}"
|
|
||||||
loop_var: "binary"
|
|
||||||
tags:
|
tags:
|
||||||
- certbot
|
- certbot
|
||||||
|
|
||||||
# - name: "Installer : Certbot : Auth Hook"
|
|
||||||
# get_url:
|
|
||||||
# url: "https://git.waren.io/warengroup/acme-dns-auth/raw/branch/master/acme-dns-auth.py"
|
|
||||||
# dest: "~/data/letsencrypt/config/renewal-hooks/pre/acme-dns-auth.py"
|
|
||||||
# mode: '700'
|
|
||||||
# force: true
|
|
||||||
# tags:
|
|
||||||
# - certbot
|
|
||||||
|
|
||||||
- name: "Installer : Certbot : Create Certificates"
|
- name: "Installer : Certbot : Create Certificates"
|
||||||
command: "certbot certonly --cert-name {{ cert.name }} --manual --preferred-challenges dns-01 --email {{ cert.email }} --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -n --manual-auth-hook ~/data/letsencrypt/config/renewal-hooks/pre/acme-dns-auth.py --debug-challenges --preferred-chain='ISRG Root X1' --key-type rsa -d {{ cert.domains | join(' -d ') }} --config-dir ~/data/letsencrypt/config --logs-dir ~/data/letsencrypt/logs --work-dir ~/data/letsencrypt/work"
|
containers.podman.podman_container:
|
||||||
|
name: certbot
|
||||||
|
image: "docker.io/certbot/certbot:latest"
|
||||||
|
state: started
|
||||||
|
network: host
|
||||||
|
volumes:
|
||||||
|
- "{{ ansible_facts.user_dir }}/data/certbot:/etc/letsencrypt"
|
||||||
|
command: "certonly --cert-name {{ cert.name }} --manual --preferred-challenges dns-01 --email {{ cert.email }} --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -n --manual-auth-hook /etc/letsencrypt/auth-hooks/acme-dns.py --debug-challenges --key-type rsa -d {{ cert.domains | join(' -d ') }}"
|
||||||
|
detach: false
|
||||||
|
register: task
|
||||||
|
changed_when:
|
||||||
|
- task.stdout.find("Certificate not yet due for renewal; no action taken.") == -1
|
||||||
loop: "{{ certs }}"
|
loop: "{{ certs }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ cert.name }}"
|
label: "{{ cert.name }}"
|
||||||
@ -107,8 +100,6 @@
|
|||||||
email: mattez02.contact@gmail.com
|
email: mattez02.contact@gmail.com
|
||||||
domains:
|
domains:
|
||||||
- arcadiamc.wgi.fi
|
- arcadiamc.wgi.fi
|
||||||
register: task
|
|
||||||
changed_when: task.stdout.find("Certificate not yet due for renewal; no action taken.") == -1
|
|
||||||
tags:
|
tags:
|
||||||
- certbot
|
- certbot
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user