diff --git a/roles/role_deploy_coturn/tasks/main.yml b/roles/role_deploy_coturn/tasks/main.yml index 96be0eb..f2af385 100644 --- a/roles/role_deploy_coturn/tasks/main.yml +++ b/roles/role_deploy_coturn/tasks/main.yml @@ -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 diff --git a/tasks/deploy_mysql-server.yml b/tasks/deploy_mysql-server.yml index 849e45d..ad7a83f 100644 --- a/tasks/deploy_mysql-server.yml +++ b/tasks/deploy_mysql-server.yml @@ -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: diff --git a/tasks/deploy_reverse-proxy.yml b/tasks/deploy_reverse-proxy.yml index 853422c..3ce7914 100644 --- a/tasks/deploy_reverse-proxy.yml +++ b/tasks/deploy_reverse-proxy.yml @@ -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: