93 lines
2.5 KiB
YAML
93 lines
2.5 KiB
YAML
---
|
|
- hosts: all
|
|
gather_facts: false
|
|
tasks:
|
|
- name: Load variables
|
|
include_vars:
|
|
dir: "{{ dokku_lib_root }}/data/ansible/autonomic.zone/vars/"
|
|
extensions:
|
|
- yml
|
|
|
|
- name: Prepare Python system dependencies
|
|
become: true
|
|
apt:
|
|
name: python3-pip
|
|
state: present
|
|
|
|
- name: Install dns-lexicon system wide
|
|
become: true
|
|
pip:
|
|
name: ["cryptography==2.8", "dns-lexicon==3.3.19"]
|
|
executable: /usr/bin/pip3
|
|
state: present
|
|
|
|
- name: "Create {{ domain }} DNS entry"
|
|
gandi_dns:
|
|
gandi_rest_token: "{{ gandi_rest_token }}"
|
|
domain: "{{ domain }}"
|
|
ipv4: "{{ dokku_domain_ipv4 }}"
|
|
state: present
|
|
|
|
- name: "Configure the {{ domain }} domain"
|
|
dokku_domains:
|
|
app: autonomic.zone
|
|
domains:
|
|
- "{{ domain }}"
|
|
state: present
|
|
|
|
- name: Ensure default app configured domains go away
|
|
dokku_domains:
|
|
app: autonomic.zone
|
|
domains:
|
|
- autonomic.zone.dokku.autonomic.zone
|
|
state: absent
|
|
|
|
- name: Set HTTP 80 port proxy
|
|
dokku_ports:
|
|
app: autonomic.zone
|
|
mappings:
|
|
- "http:80:{{ http_port }}"
|
|
state: present
|
|
|
|
- name: Remove automatically configured ports
|
|
dokku_ports:
|
|
app: autonomic.zone
|
|
mappings:
|
|
- "http:4000:4000"
|
|
state: absent
|
|
|
|
- name: Setup LE certificates
|
|
shell: dokku letsencrypt autonomic.zone
|
|
args:
|
|
creates: /home/dokku/autonomic.zone/letsencrypt/certs
|
|
|
|
- name: Setup LE certificates renew cron job
|
|
shell: dokku letsencrypt:cron-job --add
|
|
args:
|
|
creates: /home/dokku/autonomic.zone/letsencrypt/cron-job
|
|
|
|
- name: Set HTTP 443 port
|
|
dokku_ports:
|
|
app: autonomic.zone
|
|
mappings:
|
|
- "https:443:{{ http_port }}"
|
|
state: present
|
|
|
|
- name: Specify docker volume mounts
|
|
dokku_storage:
|
|
app: autonomic.zone
|
|
mounts:
|
|
- /home/dokku/autonomic.zone/letsencrypt/certs/current/key.pem:/etc/x509/https/tls.key
|
|
- /home/dokku/autonomic.zone/letsencrypt/certs/current/cert.pem:/etc/x509/https/tls.crt
|
|
|
|
- name: Configure the dokku app environment
|
|
dokku_config:
|
|
app: autonomic.zone
|
|
restart: false
|
|
config:
|
|
DOKKU_LETSENCRYPT_EMAIL: "{{ autonomic_admin_mail }}"
|
|
JEKYLL_HOST: "{{ domain }}"
|
|
JEKYLL_PORT: "{{ http_port }}"
|
|
JEKYLL_SSL_CERT: "{{ ssl_cert_path }}"
|
|
JEKYLL_SSL_KEY: "{{ ssl_key_path }}"
|