Finish confs
This commit is contained in:
parent
3f92c47e1c
commit
2566f36c51
15 changed files with 148 additions and 30 deletions
|
@ -1,26 +0,0 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
home_assistant:
|
||||
image: homeassistant/home-assistant
|
||||
restart: always
|
||||
container_name: home_assistant
|
||||
environment:
|
||||
- TZ=Europe/Paris
|
||||
volumes:
|
||||
- home_assistant_config:/config
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
network_mode: host
|
||||
expose:
|
||||
- 8123
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.homeassistant-secure.entrypoints=https"
|
||||
- "traefik.http.routers.homeassistant-secure.rule=Host(`domo.mrdev023.fr`)"
|
||||
- "traefik.http.routers.homeassistant-secure.tls=true"
|
||||
- "traefik.http.routers.homeassistant-secure.tls.certresolver=sslResolver"
|
||||
# - "traefik.http.routers.homeassistant-secure.service=homeassistant"
|
||||
- "traefik.http.services.homeassistant.loadbalancer.server.port=8123"
|
||||
|
||||
volumes:
|
||||
home_assistant_config:
|
|
@ -1,7 +1,7 @@
|
|||
##
|
||||
# Global configuration
|
||||
server:
|
||||
domain: mrdev023.fr
|
||||
domain: mrdev023.test
|
||||
acme:
|
||||
email: florian.richer.97@outlook.com
|
||||
debug: true
|
||||
|
|
|
@ -8,3 +8,6 @@
|
|||
- { role: whoami, tags: ["whoami"] }
|
||||
- { role: protonmail, tags: ["protonmail"] }
|
||||
- { role: cloud, tags: ["cloud"] }
|
||||
- { role: home_assistant, tags: ["home_assistant"] }
|
||||
- { role: n8n, tags: ["n8n"] }
|
||||
- { role: matrix, tags: ["matrix"] }
|
||||
|
|
32
roles/home_assistant/tasks/base.yml
Normal file
32
roles/home_assistant/tasks/base.yml
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
|
||||
- name: Check home_assistant directory exist
|
||||
ansible.builtin.file:
|
||||
path: home_assistant
|
||||
state: directory
|
||||
|
||||
- name: Copy template conf
|
||||
ansible.builtin.template:
|
||||
backup: true
|
||||
src: "{{ item.src }}"
|
||||
dest: "home_assistant/{{ item.dest }}"
|
||||
loop:
|
||||
- { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' }
|
||||
register: home_assistant_copy_templates_results
|
||||
|
||||
- name: Force update and restart container
|
||||
community.docker.docker_compose:
|
||||
project_src: home_assistant
|
||||
state: present
|
||||
pull: true
|
||||
restarted: true
|
||||
when: home_assistant_copy_templates_results.changed
|
||||
become: true
|
||||
|
||||
- name: Update or start container
|
||||
community.docker.docker_compose:
|
||||
project_src: home_assistant
|
||||
state: present
|
||||
pull: true
|
||||
when: not home_assistant_copy_templates_results.changed
|
||||
become: true
|
4
roles/home_assistant/tasks/main.yml
Normal file
4
roles/home_assistant/tasks/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
|
||||
- ansible.builtin.import_tasks: base.yml
|
||||
name: base
|
26
roles/home_assistant/templates/docker-compose.yml.j2
Normal file
26
roles/home_assistant/templates/docker-compose.yml.j2
Normal file
|
@ -0,0 +1,26 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
home_assistant:
|
||||
image: homeassistant/home-assistant
|
||||
restart: always
|
||||
container_name: home_assistant
|
||||
environment:
|
||||
- TZ=Europe/Paris
|
||||
volumes:
|
||||
- home_assistant_config:/config
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
network_mode: host
|
||||
expose:
|
||||
- 8123
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.homeassistant-secure.entrypoints=https"
|
||||
- "traefik.http.routers.homeassistant-secure.rule=Host(`domo.{{ server.domain }}`)"
|
||||
- "traefik.http.routers.homeassistant-secure.tls=true"
|
||||
- "traefik.http.routers.homeassistant-secure.tls.certresolver=sslResolver"
|
||||
# - "traefik.http.routers.homeassistant-secure.service=homeassistant"
|
||||
- "traefik.http.services.homeassistant.loadbalancer.server.port=8123"
|
||||
|
||||
volumes:
|
||||
home_assistant_config:
|
39
roles/matrix/tasks/base.yml
Normal file
39
roles/matrix/tasks/base.yml
Normal file
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
|
||||
- name: Check matrix directory exist
|
||||
ansible.builtin.file:
|
||||
path: matrix
|
||||
state: directory
|
||||
|
||||
- name: Copy matrix conf
|
||||
ansible.builtin.copy:
|
||||
backup: true
|
||||
src: .
|
||||
dest: matrix/
|
||||
register: matrix_copy_files_results
|
||||
|
||||
- name: Copy template conf
|
||||
ansible.builtin.template:
|
||||
backup: true
|
||||
src: "{{ item.src }}"
|
||||
dest: "matrix/{{ item.dest }}"
|
||||
loop:
|
||||
- { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' }
|
||||
register: matrix_copy_templates_results
|
||||
|
||||
- name: Force update and restart container
|
||||
community.docker.docker_compose:
|
||||
project_src: matrix
|
||||
state: present
|
||||
pull: true
|
||||
restarted: true
|
||||
when: matrix_copy_files_results.changed or matrix_copy_templates_results.changed
|
||||
become: true
|
||||
|
||||
- name: Update or start container
|
||||
community.docker.docker_compose:
|
||||
project_src: matrix
|
||||
state: present
|
||||
pull: true
|
||||
when: not matrix_copy_files_results.changed and not matrix_copy_templates_results.changed
|
||||
become: true
|
4
roles/matrix/tasks/main.yml
Normal file
4
roles/matrix/tasks/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
|
||||
- ansible.builtin.import_tasks: base.yml
|
||||
name: base
|
|
@ -27,7 +27,7 @@ services:
|
|||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.matrix-secure.entrypoints=https"
|
||||
- "traefik.http.routers.matrix-secure.rule=Host(`matrix.mrdev023.fr`)"
|
||||
- "traefik.http.routers.matrix-secure.rule=Host(`matrix.{{ server.domain }}`)"
|
||||
- "traefik.http.routers.matrix-secure.tls=true"
|
||||
- "traefik.http.routers.matrix-secure.tls.certresolver=sslResolver"
|
||||
- "traefik.port=8008"
|
||||
|
@ -47,7 +47,7 @@ services:
|
|||
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowOriginList=*"
|
||||
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowHeaders=Origin, X-Requested-With, Content-Type, Accept, Authorization"
|
||||
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowMethods=GET, POST, PUT, DELETE, OPTIONS"
|
||||
- "traefik.http.routers.matrix-wellknown.rule=Host(`matrix.mrdev023.fr`) && PathPrefix(`/.well-known/matrix`)"
|
||||
- "traefik.http.routers.matrix-wellknown.rule=Host(`matrix.{{ server.domain }}`) && PathPrefix(`/.well-known/matrix`)"
|
||||
- "traefik.http.routers.matrix-wellknown.tls=true"
|
||||
- "traefik.http.routers.matrix-wellknown.tls.certresolver=sslResolver"
|
||||
- "traefik.http.routers.matrix-wellknown.middlewares=cors-headers@docker"
|
32
roles/n8n/tasks/base.yml
Normal file
32
roles/n8n/tasks/base.yml
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
|
||||
- name: Check n8n directory exist
|
||||
ansible.builtin.file:
|
||||
path: n8n
|
||||
state: directory
|
||||
|
||||
- name: Copy template conf
|
||||
ansible.builtin.template:
|
||||
backup: true
|
||||
src: "{{ item.src }}"
|
||||
dest: "n8n/{{ item.dest }}"
|
||||
loop:
|
||||
- { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' }
|
||||
register: n8n_copy_templates_results
|
||||
|
||||
- name: Force update and restart container
|
||||
community.docker.docker_compose:
|
||||
project_src: n8n
|
||||
state: present
|
||||
pull: true
|
||||
restarted: true
|
||||
when: n8n_copy_templates_results.changed
|
||||
become: true
|
||||
|
||||
- name: Update or start container
|
||||
community.docker.docker_compose:
|
||||
project_src: n8n
|
||||
state: present
|
||||
pull: true
|
||||
when: not n8n_copy_templates_results.changed
|
||||
become: true
|
4
roles/n8n/tasks/main.yml
Normal file
4
roles/n8n/tasks/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
|
||||
- ansible.builtin.import_tasks: base.yml
|
||||
name: base
|
|
@ -26,7 +26,7 @@ services:
|
|||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.n8n-secure.entrypoints=https"
|
||||
- "traefik.http.routers.n8n-secure.rule=Host(`n8n.mrdev023.fr`)"
|
||||
- "traefik.http.routers.n8n-secure.rule=Host(`n8n.{{ server.domain }}`)"
|
||||
- "traefik.http.routers.n8n-secure.tls=true"
|
||||
- "traefik.http.routers.n8n-secure.tls.certresolver=sslResolver"
|
||||
# - "traefik.http.routers.whoami-secure.service=whoami"
|
Loading…
Reference in a new issue