Adapt to more scoped config

This commit is contained in:
Luke Murphy
2020-04-14 13:02:16 +02:00
parent ddaa516e38
commit 22e15e4b50
11 changed files with 55 additions and 27 deletions

View File

@ -1,7 +1,7 @@
---
- name: Set HTTP 80 port proxy
dokku_ports:
app: "{{ app }}"
app: "{{ dokku.app }}"
mappings:
- "http:80:{{ port }}"
- "http:80:{{ vars.port }}"
state: present

View File

@ -1,17 +1,17 @@
---
- name: Setup lets encrypt certificates
shell: "dokku letsencrypt {{ app }}"
shell: "dokku letsencrypt {{ dokku.app }}"
args:
creates: "/home/dokku/{{ app }}/letsencrypt/certs"
creates: "/home/dokku/{{ dokku.app }}/letsencrypt/certs"
- name: Setup lets encrypt certificates renew cron job
shell: dokku letsencrypt:cron-job --add
args:
creates: "/home/dokku/{{ app }}/letsencrypt/cron-job"
creates: "/home/dokku/{{ dokku.app }}/letsencrypt/cron-job"
- name: Set HTTP 443 port
dokku_ports:
app: "{{ app }}"
app: "{{ dokku.app }}"
mappings:
- "https:443:{{ port }}"
- "https:443:{{ vars.port }}"
state: present

View File

@ -1,24 +1,32 @@
---
- name: Check if a custom nginx directory exists
stat:
path: "{{ app_config_root }}/nginx.d/"
register: custom_nginx_d
- name: Create nginx customisation directory
become: true
file:
path: "/home/dokku/{{ app }}/nginx.conf.d/"
path: "/home/dokku/{{ dokku.app }}/nginx.conf.d/"
state: directory
owner: dokku
group: dokku
when: custom_nginx_d.stat.exists
- name: Copy over the nginx custom configuration
become: true
template:
src: "{{ item }}"
dest: "/home/dokku/{{ app }}/nginx.conf.d/{{ item | basename }}"
dest: "/home/dokku/{{ dokku.app }}/nginx.conf.d/{{ item | basename }}"
owner: dokku
group: dokku
with_fileglob:
- "{{ app_config_root }}/nginx.d/*.conf"
when: custom_nginx_d.stat.exists
- name: Reload nginx to enable custom configurations
become: true
service:
name: nginx
state: reloaded
when: custom_nginx_d.stat.exists

View File

@ -1,7 +1,7 @@
---
- name: Remove automatically configured ports
dokku_ports:
app: "{{ app }}"
app: "{{ dokku.app }}"
mappings:
- "http:{{ port }}:{{ port }}"
- "http:{{ vars.port }}:{{ vars.port }}"
state: absent