Skip to content

Commit

Permalink
Fix certbot renewal
Browse files Browse the repository at this point in the history
  • Loading branch information
MeNsaaH committed Feb 26, 2022
1 parent 885c39d commit abd115e
Show file tree
Hide file tree
Showing 34 changed files with 84 additions and 913 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Ansible And Terraform scripts for the Gophie Infrastructure

- Ansible
```bash
$ pip install -r requirements.txt
$ ansible-galaxy install -r ./ansible/requirements.yml
```

Expand Down
52 changes: 39 additions & 13 deletions ansible/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
nodejs_version: "14.x"
nodejs_npm_global_packages:
- yarn
tags:
- nodejs

- name: Create Yarn symbolic link
file:
Expand All @@ -37,6 +39,8 @@
owner: "{{ nodejs_install_npm_user }}"
group: "{{ nodejs_install_npm_user }}"
state: link
tags:
- nodejs

- name: Clone Master Gophie Web Repo.
become: no
Expand All @@ -45,13 +49,17 @@
dest: "{{ gophie_web_path }}"
repo: https://github.com/go-phie/gophie-web.git
force: yes
tags:
- configuration

- name: Build Code using Yarn.
become: no
shell:
chdir: "{{ gophie_web_path }}"
cmd: |
/usr/bin/yarn
tags:
- configuration

- name: Setup pm2 and start app.
include_role:
Expand All @@ -66,24 +74,42 @@
NODE_ENV: production
PORT: "{{ gophie_web_port }}"
pm2_service_name: pm2-root
tags:
- pm2
- webserver

- name: Install Certbot.
include_role:
name: geerlingguy.certbot
vars:
certbot_auto_renew_user: "ubuntu"
certbot_auto_renew_options: "--quiet --no-self-upgrade --nginx"
certbot_create_if_missing: true
certbot_auto_renew_minute: "20"
certbot_auto_renew_hour: "5"
certbot_certs:
- domains:
- "{{ gophie_host }}"
certbot_create_method: nginx
- block:
- name: Install nginx certbot package
apt:
state: present
pkg:
- python3-certbot-nginx

- name: Install Certbot.
include_role:
name: geerlingguy.certbot
apply:
tags:
- certbot
vars:
certbot_auto_renew_options: "--quiet --no-self-upgrade --nginx"
certbot_admin_email: [email protected]
certbot_auto_renew_user: root
certbot_create_if_missing: true
certbot_certs:
- domains:
- "{{ gophie_host }}"
certbot_create_method: nginx
tags:
- certbot
become: yes

- name: Install Nginx.
include_role:
name: geerlingguy.nginx
tags:
- nginx
- webserver
vars:
nginx_vhosts:
- listen: "443 ssl http2"
Expand Down
45 changes: 31 additions & 14 deletions ansible/mythra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@
job: "sudo {{ mythra_path }} clear-cache >> /tmp/mythra-cache-clear.log 2>&1"
user: "gcp"

roles:
- name: geerlingguy.nginx
- name: Install Nginx.
include_role:
name: geerlingguy.nginx
tags: nginx
vars:
nginx_service_state: stopped
nginx_vhosts:
- listen: "443 ssl http2"
server_name: "mythra.gophie.cam"
Expand Down Expand Up @@ -113,19 +115,29 @@
return: "301 https://mythra.gophie.cam$request_uri"
filename: "mythra.cam.80.conf"

- name: certbot
- name: Certbot
tags: certbot
vars:
certbot_auto_renew_user: "gcp"
certbot_auto_renew_options: "--quiet --no-self-upgrade --nginx"
certbot_admin_email: [email protected]
certbot_create_if_missing: true
certbot_auto_renew_minute: "20"
certbot_auto_renew_hour: "5"
certbot_certs:
- domains:
- mythra.gophie.cam
certbot_create_method: nginx
block:
- name: Install nginx certbot package
apt:
state: present
pkg:
- python3-certbot-nginx
- include_role:
name: geerlingguy.certbot
apply:
tags:
- certbot
vars:
certbot_auto_renew_user: "root"
certbot_auto_renew_options: "--quiet --no-self-upgrade --nginx"
certbot_admin_email: [email protected]
certbot_create_if_missing: true
certbot_certs:
- domains:
- mythra.gophie.cam
notify:
- Restart nginx

handlers:
- name: Start mythra
Expand All @@ -144,3 +156,8 @@
state: started
name: chromedriver
daemon_reload: yes

- name: Restart nginx
systemd:
state: started
name: nginx
2 changes: 2 additions & 0 deletions ansible/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ansible==5.4.0
ansible-core==2.12.2
3 changes: 0 additions & 3 deletions ansible/roles/certbot/.ansible-lint

This file was deleted.

5 changes: 0 additions & 5 deletions ansible/roles/certbot/.gitignore

This file was deleted.

10 changes: 0 additions & 10 deletions ansible/roles/certbot/.yamllint

This file was deleted.

149 changes: 0 additions & 149 deletions ansible/roles/certbot/README.md

This file was deleted.

45 changes: 0 additions & 45 deletions ansible/roles/certbot/defaults/main.yml

This file was deleted.

Loading

0 comments on commit abd115e

Please sign in to comment.