diff --git a/deploy.yml b/deploy.yml index 0c95575..bf29048 100644 --- a/deploy.yml +++ b/deploy.yml @@ -10,6 +10,8 @@ - name: Configure Modane server hosts: target gather_facts: false + vars_files: + - vars/main.yml tasks: - name: Gather facts ansible.builtin.setup: @@ -23,6 +25,10 @@ - name: Include secrets from yml db 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 containers.podman.podman_container: name: homeassistant diff --git a/tasks/deploy_reverse-proxy.yml b/tasks/deploy_reverse-proxy.yml new file mode 100644 index 0000000..af358e6 --- /dev/null +++ b/tasks/deploy_reverse-proxy.yml @@ -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 diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..120add3 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,2 @@ +--- +reverse_proxy_i686_tag: 8c0dc1f517