|
2 | 2 | - name: Setup Artemis Load Balancer / Reverse Proxy |
3 | 3 | hosts: artemis_production_proxy |
4 | 4 | pre_tasks: |
5 | | - - name: Create certificate dir on proxy |
6 | | - ansible.builtin.file: |
7 | | - dest: "{{ proxy_certificate_base_path }}" |
8 | | - state: directory |
9 | | - mode: "0700" |
10 | | - owner: "root" |
11 | | - group: "root" |
| 5 | + - name: Install certbot nginx plugin |
| 6 | + ansible.builtin.package: |
| 7 | + name: python3-certbot-nginx |
| 8 | + state: present |
| 9 | + tags: certbot |
12 | 10 | become: true |
13 | 11 |
|
14 | | - - name: Copy certificates to proxy |
15 | | - ansible.builtin.copy: |
16 | | - src: "{{ item }}" |
17 | | - dest: "{{ proxy_certificate_base_path }}/{{ proxy_tum_certificate_name }}" |
18 | | - mode: "0755" |
19 | | - owner: "root" |
20 | | - group: "root" |
21 | | - with_fileglob: |
22 | | - - "artemis_tum_de-certificates/artemis_tum_de.pem" |
23 | | - become: true |
24 | | - |
25 | | - - name: Get the tum certificate key from vault |
26 | | - ansible.builtin.set_fact: |
27 | | - artemis_tum_cert_key: "{{ lookup('hashi_vault', 'kv/data/artemis/production/proxy').get('artemis_tum_de-key') }}" |
28 | | - |
29 | | - - name: Write tum certificate key to file |
30 | | - ansible.builtin.copy: |
31 | | - content: "{{ artemis_tum_cert_key }}" |
32 | | - dest: "{{ proxy_certificate_base_path }}/{{ proxy_tum_certificate_key_name }}" |
33 | | - mode: "0755" |
34 | | - owner: "root" |
35 | | - group: "root" |
| 12 | + roles: |
| 13 | + - role: geerlingguy.certbot |
36 | 14 | become: true |
| 15 | + tags: certbot |
| 16 | + vars: |
| 17 | + certbot_auto_renew: true |
| 18 | + certbot_auto_renew_hour: "3" |
| 19 | + certbot_auto_renew_minute: "30" |
| 20 | + certbot_auto_renew_user: root |
| 21 | + certbot_auto_renew_options: "--quiet" |
| 22 | + certbot_create_if_missing: true |
| 23 | + certbot_admin_email: "{{ artemis_email }}" |
| 24 | + certbot_certs: |
| 25 | + - domains: "{{ (servers | map(attribute='name') | map('split', ' ') | flatten | list) + (redirects | map(attribute='name') | map('split', ' ') | flatten | list) }}" |
| 26 | + certbot_create_standalone_stop_services: |
| 27 | + certbot_create_command: "{{ certbot_script }} certonly --nginx --noninteractive --agree-tos --email {{ cert_item.email | default(certbot_admin_email) }} -d {{ cert_item.domains | join(',') }}" |
37 | 28 |
|
38 | | - roles: |
39 | 29 | - role: ls1intum.artemis.firewall |
40 | 30 | tags: firewall |
41 | 31 | vars: |
|
0 commit comments