Use a role to build all images.

This commit is contained in:
yohan 2024-04-13 14:42:52 +02:00
parent b7c6f4e752
commit 82fc952882
3 changed files with 33 additions and 75 deletions

View File

@ -1,28 +1,14 @@
---
- name: Get coturn repo's last commit
ansible.builtin.git:
repo: "https://git.{{ DOMAIN }}/yohan/docker-coturn.git"
clone: no
update: no
version: master
register: git
changed_when: false
- name: Set fact commit
set_fact:
commit: "{{ git.after[0:10] }}"
- name: Build coturn image
containers.podman.podman_image:
name: coturn
path: "https://git.{{ DOMAIN }}/yohan/docker-coturn.git"
force: true
build:
force_rm: true
annotation:
git_commit: "{{ commit }}"
become: true
register: image
- name: Build image
ansible.builtin.include_role:
name: role_build_container_image
vars:
image: "{{ item }}"
with_items:
- repo_url: "https://git.{{ DOMAIN }}/yohan/docker-coturn.git"
repo_name: docker-coturn
name: coturn
result_var: coturn_result
- name: Create coturn container
containers.podman.podman_container:
@ -44,7 +30,7 @@
- "0"
- "--stale-nonce"
- "--no-multicast-peers"
recreate: "{{ image is changed }}"
recreate: "{{ coturn_result is changed }}"
state: present
network:
- host

View File

@ -8,30 +8,16 @@
ansible.builtin.include_tasks: "tasks/mysql-server_install_from_backup_stage_1.yml"
when: not mysql_installed_flag.stat.exists
- name: Get docker-mysql repo's last commit
ansible.builtin.git:
repo: https://github.com/yohan-b/docker-mysql.git
clone: no
update: no
version: master
register: git
changed_when: false
- name: Set fact commit
set_fact:
commit: "{{ git.after[0:10] }}"
- name: Build mysql-server image
containers.podman.podman_image:
name: mysql-server
path: https://github.com/yohan-b/docker-mysql.git
force: true
build:
force_rm: true
annotation:
git_commit: "{{ commit }}"
become: true
register: image
- name: Build image
ansible.builtin.include_role:
name: role_build_container_image
vars:
image: "{{ item }}"
with_items:
- repo_url: https://github.com/yohan-b/docker-mysql.git
repo_name: docker-mysql
name: mysql-server
result_var: mysql_server_result
- name: Include tasks/mysql-server_install_from_backup_stage_2.yml
ansible.builtin.include_tasks: "tasks/mysql-server_install_from_backup_stage_2.yml"
@ -41,7 +27,7 @@
containers.podman.podman_container:
name: mysql-server
image: mysql-server
recreate: "{{ image is changed }}"
recreate: "{{ mysql_server_result is changed }}"
network:
- mysqlnet
volume:

View File

@ -94,36 +94,22 @@
become: true
when: not reverse_proxy_installed_flag.stat.exists
- name: Get docker-reverse-proxy repo's last commit
ansible.builtin.git:
repo: https://github.com/yohan-b/docker-reverse-proxy.git
clone: no
update: no
version: master
register: git
changed_when: false
- name: Set fact commit
set_fact:
commit: "{{ git.after[0:10] }}"
- name: Build reverse-proxy image
containers.podman.podman_image:
name: reverse-proxy
path: https://github.com/yohan-b/docker-reverse-proxy.git
force: true
build:
force_rm: true
annotation:
git_commit: "{{ commit }}"
become: true
register: image
- name: Build image
ansible.builtin.include_role:
name: role_build_container_image
vars:
image: "{{ item }}"
with_items:
- repo_url: https://github.com/yohan-b/docker-reverse-proxy.git
repo_name: docker-reverse-proxy
name: reverse-proxy
result_var: reverse_proxy_result
- name: Create reverse-proxy container
containers.podman.podman_container:
name: reverse-proxy
image: reverse-proxy
recreate: "{{ image is changed }}"
recreate: "{{ reverse_proxy_result is changed }}"
network:
- reverse-proxy
ports: