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
6 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
|
||
|
|
||
6 years ago
|
- name: nginx conf files
|
||
6 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
|
||
6 years ago
|
notify: reload nginx
|
||
6 years ago
|
|
||
6 years ago
|
- name: obtain ssl certificates
|
||
6 years ago
|
command: >-
|
||
5 years ago
|
certbot certonly --nginx
|
||
6 years ago
|
-d {{ item }}
|
||
6 years ago
|
-m alpha+lets.encrypt@kejadlen.dev
|
||
|
--agree-tos
|
||
|
--non-interactive
|
||
|
args:
|
||
6 years ago
|
creates: /etc/letsencrypt/live/{{ item }}
|
||
|
with_items:
|
||
|
- irregular-apocalypse.kejadlen.dev
|
||
|
- dev.irregular-apocalypse.kejadlen.dev
|
||
|
notify: reload nginx
|
||
6 years ago
|
|
||
|
- name: automatically renew certs
|
||
|
cron:
|
||
|
name: renew certs
|
||
6 years ago
|
minute: "0"
|
||
|
hour: "12"
|
||
6 years ago
|
job: /usr/bin/certbot renew --quiet
|
||
|
|
||
|
handlers:
|
||
|
|
||
|
- name: reload nginx
|
||
6 years ago
|
shell: nginx -t && nginx -s reload
|