ansible-personal/roles/nginx/tasks/letsencrypt.yml

120 lines
2.9 KiB
YAML
Raw Normal View History

---
- name: Copy systemd service to renew Let's Encrypt certs
template: src=renew-letsencrypt.service.j2 dest=/etc/systemd/system/renew-letsencrypt.service mode=0644 owner=root group=root
register: letsencrypt_service
- name: Copy systemd timer to renew Let's Encrypt certs
copy: src=renew-letsencrypt.timer dest=/etc/systemd/system/renew-letsencrypt.timer mode=0644 owner=root group=root
register: letsencrypt_timer
# need to reload to pick up service/timer changes
- name: Reload systemd daemon
command: /bin/systemctl daemon-reload
when: letsencrypt_service|changed or letsencrypt_timer|changed
- name: Start and enable systemd timer to renew Let's Encrypt certs
service: name=renew-letsencrypt.timer state=started enabled=yes
- name: Download certbot
get_url: dest={{ letsencrypt_certbot_dest }} url=https://dl.eff.org/certbot-auto mode=700
# dependencies certbot checks for on its first run
# taken from running certbot right after a clean Ubuntu 16.04 install
- name: Install certbot dependencies (Ubuntu 16.04)
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version | version_compare('16.04', '==')
apt: name={{ item }} state=present update_cache=yes
with_items:
- augeas-doc
- augeas-tools
- binutils
- cpp
- cpp-5
- dialog
- gcc
- gcc-5
- libasan2
- libatomic1
- libcc1-0
- libcilkrts5
- libexpat1-dev
- libffi-dev
- libgcc-5-dev
- libgomp1
- libisl15
- libitm1
- liblsan0
- libmpc3
- libmpx0
- libpython-dev
- libpython2.7
- libpython2.7-dev
- libquadmath0
- libssl-dev
- libtsan0
- libubsan0
- python-dev
- python-pip-whl
- python-pkg-resources
- python-virtualenv
- python2.7-dev
- python3-virtualenv
- virtualenv
- zlib1g-dev
tags: packages
# dependencies certbot checks for on its first run
# taken from running certbot right after a clean Debian 9 install
- name: Install certbot dependencies (Debian 9)
when: ansible_distribution == 'Debian' and ansible_distribution_major_version | version_compare('9', '==')
apt: name={{ item }} state=present update_cache=yes
with_items:
- augeas-doc
- augeas-tools
- autoconf
- automake
- binutils
- bison
- cpp
- cpp-6
- flex
- gcc-6
- gcc-doc
- gcc-multilib
- gdb
- libasan3
- libatomic1
- libc-dev-bin
- libc6-dev
- libcc1-0
- libcilkrts5
- libexpat1-dev
- libffi-dev
- libgcc-6-dev
- libgomp1
- libisl15
- libitm1
- liblsan0
- libmpc3
- libmpx2
- libpython-dev
- libpython2.7
- libpython2.7-dev
- libquadmath0
- libssl-dev
- libtool
- libtsan0
- libubsan0
- linux-libc-dev
- make
- python-dev
- python-pip-whl
- python-pkg-resources
- python-virtualenv
- python2.7-dev
- python3-virtualenv
- virtualenv
tags: packages
# vim: set ts=2 sw=2: