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 - name: Build image
ansible.builtin.git: ansible.builtin.include_role:
repo: "https://git.{{ DOMAIN }}/yohan/docker-coturn.git" name: role_build_container_image
clone: no vars:
update: no image: "{{ item }}"
version: master with_items:
register: git - repo_url: "https://git.{{ DOMAIN }}/yohan/docker-coturn.git"
changed_when: false repo_name: docker-coturn
name: coturn
- name: Set fact commit result_var: coturn_result
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: Create coturn container - name: Create coturn container
containers.podman.podman_container: containers.podman.podman_container:
@ -44,7 +30,7 @@
- "0" - "0"
- "--stale-nonce" - "--stale-nonce"
- "--no-multicast-peers" - "--no-multicast-peers"
recreate: "{{ image is changed }}" recreate: "{{ coturn_result is changed }}"
state: present state: present
network: network:
- host - host

View File

@ -8,30 +8,16 @@
ansible.builtin.include_tasks: "tasks/mysql-server_install_from_backup_stage_1.yml" ansible.builtin.include_tasks: "tasks/mysql-server_install_from_backup_stage_1.yml"
when: not mysql_installed_flag.stat.exists when: not mysql_installed_flag.stat.exists
- name: Get docker-mysql repo's last commit - name: Build image
ansible.builtin.git: ansible.builtin.include_role:
repo: https://github.com/yohan-b/docker-mysql.git name: role_build_container_image
clone: no vars:
update: no image: "{{ item }}"
version: master with_items:
register: git - repo_url: https://github.com/yohan-b/docker-mysql.git
changed_when: false repo_name: docker-mysql
name: mysql-server
- name: Set fact commit result_var: mysql_server_result
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: Include tasks/mysql-server_install_from_backup_stage_2.yml - name: Include tasks/mysql-server_install_from_backup_stage_2.yml
ansible.builtin.include_tasks: "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: containers.podman.podman_container:
name: mysql-server name: mysql-server
image: mysql-server image: mysql-server
recreate: "{{ image is changed }}" recreate: "{{ mysql_server_result is changed }}"
network: network:
- mysqlnet - mysqlnet
volume: volume:

View File

@ -94,36 +94,22 @@
become: true become: true
when: not reverse_proxy_installed_flag.stat.exists when: not reverse_proxy_installed_flag.stat.exists
- name: Get docker-reverse-proxy repo's last commit - name: Build image
ansible.builtin.git: ansible.builtin.include_role:
repo: https://github.com/yohan-b/docker-reverse-proxy.git name: role_build_container_image
clone: no vars:
update: no image: "{{ item }}"
version: master with_items:
register: git - repo_url: https://github.com/yohan-b/docker-reverse-proxy.git
changed_when: false repo_name: docker-reverse-proxy
name: reverse-proxy
- name: Set fact commit result_var: reverse_proxy_result
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: Create reverse-proxy container - name: Create reverse-proxy container
containers.podman.podman_container: containers.podman.podman_container:
name: reverse-proxy name: reverse-proxy
image: reverse-proxy image: reverse-proxy
recreate: "{{ image is changed }}" recreate: "{{ reverse_proxy_result is changed }}"
network: network:
- reverse-proxy - reverse-proxy
ports: ports: