diff --git a/tasks/deploy_sensors-polling.yml b/tasks/deploy_sensors-polling.yml index 5525610..93b77d3 100644 --- a/tasks/deploy_sensors-polling.yml +++ b/tasks/deploy_sensors-polling.yml @@ -25,33 +25,10 @@ - debug: var=build_result when: build_result.changed -- name: Gather facts on sensors-polling container - containers.podman.podman_container_info: - name: sensors-polling - register: container_info - become: true - -- debug: var=container_info.containers[0].Config.Annotations.git_commit - when: container_info.containers | length == 1 - -- name: Set fact bool_recreate to true - set_fact: - bool_recreate: true - when: - - container_info.containers | length == 1 - - container_info.containers[0].Config.Annotations.git_commit != commit - -- name: Delete sensors-polling container - containers.podman.podman_container: - name: sensors-polling - state: absent - become: true - when: bool_recreate | default(false) - - name: Create sensors-polling container containers.podman.podman_container: name: sensors-polling - image: localhost/sensors-polling:latest + image: "localhost/sensors-polling:{{ commit }}" network: - host env: @@ -62,9 +39,9 @@ - /usr/local/docker-mounted-files/docker-sensors-polling/conf.yml:/root/conf.yml - /run/udev:/run/udev become: true - when: bool_recreate | default(false) or container_info.containers | length == 0 - name: Prune images containers.podman.podman_prune: image: true + dangling_only: false become: true diff --git a/tasks/deploy_thermostat.yml b/tasks/deploy_thermostat.yml index cac9cae..62ab01e 100644 --- a/tasks/deploy_thermostat.yml +++ b/tasks/deploy_thermostat.yml @@ -25,39 +25,16 @@ - debug: var=build_result when: build_result.changed -- name: Gather facts on thermostat container - containers.podman.podman_container_info: - name: thermostat - register: container_info - become: true - -- debug: var=container_info.containers[0].Config.Annotations.git_commit - when: container_info.containers | length == 1 - -- name: Set fact bool_recreate to true - set_fact: - bool_recreate: true - when: - - container_info.containers | length == 1 - - container_info.containers[0].Config.Annotations.git_commit != commit - - name: create thermostat volume ansible.builtin.file: path: "/mnt/apps/volumes/thermostat" state: directory become: true -- name: Delete thermostat container - containers.podman.podman_container: - name: thermostat - state: absent - become: true - when: bool_recreate | default(false) - - name: Create thermostat container containers.podman.podman_container: name: thermostat - image: localhost/thermostat:latest + image: "localhost/thermostat:{{ commit }}" network: - host env: @@ -70,9 +47,9 @@ - /mnt/apps/volumes/thermostat:/root/instance - /run/udev:/run/udev become: true - when: bool_recreate | default(false) or container_info.containers | length == 0 - name: Prune images containers.podman.podman_prune: image: true + dangling_only: false become: true