You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.1 KiB
52 lines
1.1 KiB
5 years ago
|
- hosts: all
|
||
|
become: yes
|
||
|
tasks:
|
||
|
- name: install nginx
|
||
|
apt:
|
||
|
name: nginx
|
||
|
|
||
|
- name: install certbot
|
||
|
block:
|
||
|
- apt_repository:
|
||
|
repo: ppa:certbot/certbot
|
||
|
state: present
|
||
|
filename: certbot
|
||
|
- apt:
|
||
|
name: python-certbot-nginx
|
||
|
update_cache: yes
|
||
|
|
||
5 years ago
|
- name: nginx conf files
|
||
5 years ago
|
copy:
|
||
5 years ago
|
src: nginx/{{ item }}.conf
|
||
|
dest: /etc/nginx/conf.d/{{ item }}.conf
|
||
|
with_items:
|
||
|
- irregular-apocalypse.kejadlen.dev
|
||
|
- dev.irregular-apocalypse.kejadlen.dev
|
||
5 years ago
|
notify: reload nginx
|
||
5 years ago
|
|
||
5 years ago
|
- name: obtain ssl certificates
|
||
5 years ago
|
command: >-
|
||
5 years ago
|
certbot certonly --nginx
|
||
5 years ago
|
-d {{ item }}
|
||
5 years ago
|
-m alpha+lets.encrypt@kejadlen.dev
|
||
|
--agree-tos
|
||
|
--non-interactive
|
||
|
args:
|
||
5 years ago
|
creates: /etc/letsencrypt/live/{{ item }}
|
||
|
with_items:
|
||
|
- irregular-apocalypse.kejadlen.dev
|
||
|
- dev.irregular-apocalypse.kejadlen.dev
|
||
|
notify: reload nginx
|
||
5 years ago
|
|
||
|
- name: automatically renew certs
|
||
|
cron:
|
||
|
name: renew certs
|
||
5 years ago
|
minute: "0"
|
||
|
hour: "12"
|
||
5 years ago
|
job: /usr/bin/certbot renew --quiet
|
||
|
|
||
|
handlers:
|
||
|
|
||
|
- name: reload nginx
|
||
5 years ago
|
shell: nginx -t && nginx -s reload
|