modane_server_playbooks/tasks/deploy_reverse-proxy.yml
2024-06-14 20:47:34 +02:00

64 lines
1.9 KiB
YAML

---
- 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