infrastructure/ansible/roles/dokku/tasks/main.yml
Jake Howard 92052a3d0a
Unify nginx configuration
This creates a simple base configuration skeleton, that other configuration can be easily loaded into.
2023-12-16 17:47:04 +00:00

63 lines
1.6 KiB
YAML

# HACK: Fake include some tasks from `ansible_dokku`, so its library plugins can be used below
- name: Run role without running any tasks
include_role:
name: dokku_bot.ansible_dokku
tasks_from: init.yml
apply:
when: false
- name: Install Dokku
package:
name: dokku
become: true
- name: List dokku plugins
command: dokku plugin:list
changed_when: false
register: installed_dokku_plugins
- name: Install Dokku plugins
command: dokku plugin:install {{ item.url }} --name {{ item.name }}
when: installed_dokku_plugins.stdout.find(item.name) == -1
loop: "{{ dokku_plugins }}"
loop_control:
label: "{{ item.name }}"
become: true
- name: Automatically update Dokku plugins
cron:
name: dokku plugin:update {{ item.name }}
minute: 0
hour: 12
user: root
job: /usr/bin/chronic /usr/bin/dokku plugin:update {{ item.name }}
cron_file: dokku-plugin-update-{{ item.name }}
loop: "{{ dokku_plugins }}"
loop_control:
label: "{{ item.name }}"
become: true
- name: Set up global domain
dokku_domains:
global: true
domains: d.theorangeone.net
become: true
- name: Install nginx config
template:
src: files/nginx.conf
dest: /etc/nginx/http.d/dokku.conf
mode: "644"
notify: reload nginx
become: true
# https://dokku.com/docs/advanced-usage/backup-recovery/
- name: Sync data to app-data
cron:
name: clean up docker containers
hour: "*/6"
minute: 0
user: root
job: rsync --archive --progress -h /var/lib/dokku/{config,data,services} /home/dokku --exclude '/home/dokku/**/cache/*' /mnt/tank/app-data/dokku/
cron_file: dokku-data-sync
become: true