Update lego to only install, no initial certs since it varies by purpose
This commit is contained in:
@@ -1,35 +0,0 @@
|
|||||||
- name: Find certificates to copy
|
|
||||||
find:
|
|
||||||
paths: /root/.lego/certificates
|
|
||||||
recurse: true
|
|
||||||
patterns:
|
|
||||||
- "*.crt"
|
|
||||||
register: certs_to_copy
|
|
||||||
|
|
||||||
- name: Copy certificates to nginx ssl directory
|
|
||||||
copy:
|
|
||||||
remote_src: true
|
|
||||||
src: "{{ item.path }}"
|
|
||||||
dest: /etc/nginx/ssl
|
|
||||||
owner: nginx
|
|
||||||
mode: 0600
|
|
||||||
with_items: "{{ certs_to_copy.files }}"
|
|
||||||
|
|
||||||
- name: Find keys to copy
|
|
||||||
find:
|
|
||||||
paths: /root/.lego/certificates
|
|
||||||
recurse: true
|
|
||||||
patterns:
|
|
||||||
- "*.key"
|
|
||||||
register: keys_to_copy
|
|
||||||
|
|
||||||
|
|
||||||
- name: Copy keys to nginx ssl directory
|
|
||||||
copy:
|
|
||||||
remote_src: true
|
|
||||||
src: "{{ item.path }}"
|
|
||||||
dest: /etc/nginx/ssl
|
|
||||||
owner: nginx
|
|
||||||
mode: 0600
|
|
||||||
with_items: "{{ keys_to_copy.files }}"
|
|
||||||
|
|
||||||
5
ansible/roles/lego/tasks/install.yaml
Normal file
5
ansible/roles/lego/tasks/install.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
- name: Download and untar lego
|
||||||
|
unarchive:
|
||||||
|
src: https://github.com/go-acme/lego/releases/download/v{{ lego_version }}/lego_v{{ lego_version }}_linux_amd64.tar.gz
|
||||||
|
dest: /usr/local/bin
|
||||||
|
remote_src: yes
|
||||||
@@ -1,19 +1 @@
|
|||||||
- name: Download and untar lego
|
- import_tasks: install.yaml
|
||||||
unarchive:
|
|
||||||
src: https://github.com/go-acme/lego/releases/download/v{{ lego_version }}/lego_v{{ lego_version }}_linux_amd64.tar.gz
|
|
||||||
dest: /usr/local/bin
|
|
||||||
remote_src: yes
|
|
||||||
|
|
||||||
- name: Check if certs exist
|
|
||||||
stat:
|
|
||||||
path: /root/.lego/certificates/{{ inventory_hostname | default(cert_domain) }}.crt
|
|
||||||
register: cert_check
|
|
||||||
|
|
||||||
- name: Generate an initial cert if not present
|
|
||||||
include_tasks:
|
|
||||||
file: initial_cert.yaml
|
|
||||||
when: not cert_check.stat.exists
|
|
||||||
|
|
||||||
- name: Copy certificates
|
|
||||||
include_tasks:
|
|
||||||
file: copy_certs.yaml
|
|
||||||
|
|||||||
Reference in New Issue
Block a user