Add protonmail + cloud + fix prometheus
This commit is contained in:
parent
525c6ed2a4
commit
427838c903
13 changed files with 106 additions and 2 deletions
|
@ -4,4 +4,8 @@ server:
|
||||||
domain: mrdev023.fr
|
domain: mrdev023.fr
|
||||||
acme:
|
acme:
|
||||||
email: florian.richer.97@outlook.com
|
email: florian.richer.97@outlook.com
|
||||||
debug: true
|
debug: true
|
||||||
|
|
||||||
|
# Other
|
||||||
|
protonmail:
|
||||||
|
initialized: false
|
|
@ -6,3 +6,5 @@
|
||||||
- { role: docker, tags: ["docker"] }
|
- { role: docker, tags: ["docker"] }
|
||||||
- { role: traefik, tags: ["traefik"] }
|
- { role: traefik, tags: ["traefik"] }
|
||||||
- { role: whoami, tags: ["whoami"] }
|
- { role: whoami, tags: ["whoami"] }
|
||||||
|
- { role: protonmail, tags: ["protonmail"] }
|
||||||
|
- { role: cloud, tags: ["cloud"] }
|
||||||
|
|
39
roles/cloud/tasks/base.yml
Normal file
39
roles/cloud/tasks/base.yml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Check cloud directory exist
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: cloud
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Copy cloud conf
|
||||||
|
ansible.builtin.copy:
|
||||||
|
backup: true
|
||||||
|
src: .
|
||||||
|
dest: cloud/
|
||||||
|
register: cloud_copy_files_results
|
||||||
|
|
||||||
|
- name: Copy template conf
|
||||||
|
ansible.builtin.template:
|
||||||
|
backup: true
|
||||||
|
src: "{{ item.src }}"
|
||||||
|
dest: "cloud/{{ item.dest }}"
|
||||||
|
loop:
|
||||||
|
- { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' }
|
||||||
|
register: cloud_copy_templates_results
|
||||||
|
|
||||||
|
- name: Force update and restart container
|
||||||
|
community.docker.docker_compose:
|
||||||
|
project_src: cloud
|
||||||
|
state: present
|
||||||
|
pull: true
|
||||||
|
restarted: true
|
||||||
|
when: cloud_copy_files_results.changed or cloud_copy_templates_results.changed
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Update or start container
|
||||||
|
community.docker.docker_compose:
|
||||||
|
project_src: cloud
|
||||||
|
state: present
|
||||||
|
pull: true
|
||||||
|
when: not cloud_copy_files_results.changed and not cloud_copy_templates_results.changed
|
||||||
|
become: true
|
7
roles/cloud/tasks/cron.yml
Normal file
7
roles/cloud/tasks/cron.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Ensure a job that run all 5 minutes for nextcloud cron
|
||||||
|
ansible.builtin.cron:
|
||||||
|
name: "check dirs"
|
||||||
|
minute: "*/5"
|
||||||
|
job: "cd {{ ansible_env.HOME }}/cloud && ./cron.sh"
|
7
roles/cloud/tasks/main.yml
Normal file
7
roles/cloud/tasks/main.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- ansible.builtin.import_tasks: base.yml
|
||||||
|
name: base
|
||||||
|
|
||||||
|
- ansible.builtin.import_tasks: cron.yml
|
||||||
|
name: cron
|
|
@ -44,7 +44,7 @@ services:
|
||||||
- "traefik.http.middlewares.nextcloud-headers.headers.customRequestHeaders.X-Robots-Tag=none"
|
- "traefik.http.middlewares.nextcloud-headers.headers.customRequestHeaders.X-Robots-Tag=none"
|
||||||
- "traefik.http.middlewares.nextcloud-headers.headers.customFrameOptionsValue=SAMEORIGIN"
|
- "traefik.http.middlewares.nextcloud-headers.headers.customFrameOptionsValue=SAMEORIGIN"
|
||||||
- "traefik.http.routers.nextcloud-secure.entrypoints=https"
|
- "traefik.http.routers.nextcloud-secure.entrypoints=https"
|
||||||
- "traefik.http.routers.nextcloud-secure.rule=Host(`mycld.mrdev023.fr`)"
|
- "traefik.http.routers.nextcloud-secure.rule=Host(`mycld.{{ server.domain }}`)"
|
||||||
- "traefik.http.routers.nextcloud-secure.tls=true"
|
- "traefik.http.routers.nextcloud-secure.tls=true"
|
||||||
- "traefik.http.routers.nextcloud-secure.tls.certresolver=sslResolver"
|
- "traefik.http.routers.nextcloud-secure.tls.certresolver=sslResolver"
|
||||||
- "traefik.http.routers.nextcloud-secure.middlewares=nextcloud-compress,nextcloud-regex-redirect,nextcloud-headers"
|
- "traefik.http.routers.nextcloud-secure.middlewares=nextcloud-compress,nextcloud-regex-redirect,nextcloud-headers"
|
41
roles/protonmail/tasks/base.yml
Normal file
41
roles/protonmail/tasks/base.yml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Check protonmail directory exist
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: protonmail
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Copy protonmail conf
|
||||||
|
ansible.builtin.copy:
|
||||||
|
backup: true
|
||||||
|
src: .
|
||||||
|
dest: protonmail/
|
||||||
|
register: protonmail_copy_files_results
|
||||||
|
|
||||||
|
- name: Create protonmail network
|
||||||
|
community.docker.docker_network:
|
||||||
|
name: protonmail
|
||||||
|
state: present
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Show message if not initialized
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: Please run init.sh in protonmail folder and set variable protonmail.initialized to true and restart tasks
|
||||||
|
when: not protonmail.initialized
|
||||||
|
|
||||||
|
- name: Force update and restart container
|
||||||
|
community.docker.docker_compose:
|
||||||
|
project_src: protonmail
|
||||||
|
state: present
|
||||||
|
pull: true
|
||||||
|
restarted: true
|
||||||
|
when: protonmail.initialized and protonmail_copy_files_results.changed
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Update or start container
|
||||||
|
community.docker.docker_compose:
|
||||||
|
project_src: protonmail
|
||||||
|
state: present
|
||||||
|
pull: true
|
||||||
|
when: protonmail.initialized and not protonmail_copy_files_results.changed
|
||||||
|
become: true
|
4
roles/protonmail/tasks/main.yml
Normal file
4
roles/protonmail/tasks/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- ansible.builtin.import_tasks: base.yml
|
||||||
|
name: base
|
Loading…
Reference in a new issue