From ac11f3e4f30c61ca95054a2beb93fd6999643396 Mon Sep 17 00:00:00 2001 From: Tobias Manske Date: Wed, 7 Jun 2023 20:23:26 +0200 Subject: [PATCH] Allow pushing newly build containers to registry --- defaults/main.yml | 1 + tasks/build.yml | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 7eb0f03..432b0f5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -6,3 +6,4 @@ state: present # or running, build, absent execute: smart # or always or never disable_template: false docker_profiles: [] +docker_push: false # only works with build currently diff --git a/tasks/build.yml b/tasks/build.yml index ed56fe0..58e0e7d 100644 --- a/tasks/build.yml +++ b/tasks/build.yml @@ -6,11 +6,16 @@ community.docker.docker_compose: project_src: "{{ service_dir | mandatory }}" state: present - restarted: true + restarted: false recreate: smart build: true remove_orphans: true profiles: docker_profiles when: (compose_files.changed and execute == "smart") or execute == "always" +- name: Push compose container images + ansible.builtin.shell: + chdir: "{{ service_dir | mandatory }}" + cmd: "docker-compose push" + when: docker_push | bool # vim: ft=yaml.ansible