-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically renew cert with certbot
- Loading branch information
1 parent
963860a
commit 73eee3a
Showing
28 changed files
with
106 additions
and
676 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
- hosts: | ||
- frontman | ||
roles: | ||
- config-delivery | ||
- frontman |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
- name: Install snap | ||
package: | ||
name: snapd | ||
state: present | ||
|
||
- name: Install certbot | ||
snap: | ||
name: certbot | ||
state: present | ||
|
||
- name: Render systemd service config | ||
template: | ||
src: certbot.service.j2 | ||
dest: /etc/systemd/system/{{ certbot_service_name }}.service | ||
register: systemd_service | ||
|
||
- name: Render systemd timer config | ||
template: | ||
src: certbot.timer.j2 | ||
dest: /etc/systemd/system/{{ certbot_service_name }}.timer | ||
register: systemd_timer | ||
|
||
- name: Reload daemon | ||
systemd: | ||
daemon_reload: yes | ||
when: systemd_service.changed or systemd_timer.changed | ||
|
||
- name: Enable systemd timer service | ||
systemd: | ||
name: "{{ certbot_service_name }}.timer" | ||
enabled: yes | ||
|
||
- name: Run certbot one time | ||
systemd: | ||
name: "{{ certbot_service_name }}.service" | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Unit] | ||
Description=frontman-certbot | ||
After=network.service | ||
|
||
[Service] | ||
User=root | ||
ExecStart=/snap/bin/certbot certonly --standalone --non-interactive --agree-tos -d {{ certbot_domain }} --post-hook "{{ certbot_post_hook }}" | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Unit] | ||
Description="Timer for the {{ certbot_service_name }}.service" | ||
|
||
[Timer] | ||
Unit={{ certbot_service_name }}.service | ||
OnUnitActiveSec={{ certbot_repeat_interval }} | ||
|
||
[Install] | ||
WantedBy=timers.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# how ofter to check the ssl cert/key | ||
certbot_repeat_interval: 720min | ||
|
||
# domain for issuing a cert | ||
certbot_domain: | ||
|
||
# how to name systemctl service for aute renewing | ||
certbot_service_name: | ||
|
||
# what command to run after successful renewal/issueing | ||
certbot_post_hook: |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dependencies: | ||
- role: certbot | ||
vars: | ||
certbot_domain: "{{ frontman_domain }}" | ||
certbot_service_name: "frontman-certbot" | ||
certbot_post_hook: "systemctl restart frontman" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
...very/templates/config-delivery.service.j2 → roles/frontman/templates/frontman.service.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
keys: | ||
{% for ss_username in users.keys() %} | ||
{% for ss_client in users[ss_username] %} | ||
- cipher: {{ servers[server_name].ss_cipher }} | ||
- cipher: {{ server.ss_cipher }} | ||
id: '{{ ss_username }}-{{ loop.index }}' | ||
port: {{ servers[server_name].ss_port }} | ||
port: {{ server.ss_port }} | ||
secret: {{ ss_client.secret }} | ||
{% endfor %} | ||
{% endfor %} |
Oops, something went wrong.