Add reverse-proxy.

This commit is contained in:
yohan 2024-06-14 20:47:34 +02:00
parent 1073d8f777
commit dd260a30aa
3 changed files with 71 additions and 0 deletions

View File

@ -10,6 +10,8 @@
- name: Configure Modane server - name: Configure Modane server
hosts: target hosts: target
gather_facts: false gather_facts: false
vars_files:
- vars/main.yml
tasks: tasks:
- name: Gather facts - name: Gather facts
ansible.builtin.setup: ansible.builtin.setup:
@ -23,6 +25,10 @@
- name: Include secrets from yml db - name: Include secrets from yml db
ansible.builtin.include_vars: "{{ local_workdir }}/secrets/secrets.yml" ansible.builtin.include_vars: "{{ local_workdir }}/secrets/secrets.yml"
- name: Include deploy_reverse-proxy tasks
ansible.builtin.include_tasks: "tasks/deploy_reverse-proxy.yml"
tags: deploy_reverse-proxy
- name: Create homeassistant container - name: Create homeassistant container
containers.podman.podman_container: containers.podman.podman_container:
name: homeassistant name: homeassistant

View File

@ -0,0 +1,63 @@
---
- name: Login to {{ private_registry_domain }} and create ${XDG_RUNTIME_DIR}/containers/auth.json
containers.podman.podman_login:
username: "{{ private_registry_user }}"
password: "{{ private_registry_password }}"
registry: "{{ private_registry_domain }}"
become: true
- name: Search reverse-proxy-i686 image
containers.podman.podman_image_info:
name: "{{ private_registry_domain }}/reverse-proxy-i686:{{ reverse_proxy_i686_tag }}"
register: reverse_proxy_i686
become: true
- name: Build reverse-proxy-i686 image
ansible.builtin.include_role:
name: role_build_container_image
vars:
image: "{{ item }}"
with_items:
- repo_url: https://git.scimetis.net/yohan/docker-reverse-proxy.git
repo_name: docker-reverse-proxy
name: reverse-proxy-i686
result_var: build_result
push: true
push_dest: "{{ private_registry_domain }}"
when: reverse_proxy_i686.images | length == 0
- debug: var=build_result
when:
- reverse_proxy_i686.images | length == 0
- build_result.changed
- name: Create reverse-proxy network
containers.podman.podman_network:
name: reverse-proxy
become: true
- name: Create volumes directories
ansible.builtin.file:
path: "/mnt/apps/volumes/{{ item }}"
state: directory
mode: '0755'
become: true
with_items:
- reverse-proxy_conf
- reverse-proxy_conf_enabled
- reverse-proxy_letsencrypt
- name: Create reverse-proxy container
containers.podman.podman_container:
name: reverse-proxy
image: "{{ private_registry_domain }}/reverse-proxy-i686:{{ reverse_proxy_i686_tag }}"
network:
- reverse-proxy
ports:
- 80:80/tcp
- 443:443/tcp
volume:
- /mnt/apps/volumes/reverse-proxy_conf:/etc/apache2/sites-available
- /mnt/apps/volumes/reverse-proxy_conf_enabled:/etc/apache2/sites-enabled
- /mnt/apps/volumes/reverse-proxy_letsencrypt:/etc/letsencrypt
become: true

2
vars/main.yml Normal file
View File

@ -0,0 +1,2 @@
---
reverse_proxy_i686_tag: 8c0dc1f517