2024-06-08 19:45:32 +00:00
|
|
|
---
|
|
|
|
- name: create docker-mounted-files directory
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "/usr/local/docker-mounted-files/docker-thermostat"
|
|
|
|
state: directory
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Template thermostat conf.yml
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: templates/thermostat-conf.yml.j2
|
|
|
|
dest: /usr/local/docker-mounted-files/docker-thermostat/conf.yml
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Build thermostat image
|
|
|
|
ansible.builtin.include_role:
|
|
|
|
name: role_build_container_image
|
|
|
|
vars:
|
|
|
|
image: "{{ item }}"
|
|
|
|
with_items:
|
|
|
|
- repo_url: https://git.scimetis.net/yohan/docker-thermostat.git
|
|
|
|
repo_name: docker-thermostat
|
|
|
|
name: thermostat
|
|
|
|
result_var: build_result
|
|
|
|
|
|
|
|
- debug: var=build_result
|
|
|
|
when: build_result.changed
|
|
|
|
|
|
|
|
- name: create thermostat volume
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "/mnt/apps/volumes/thermostat"
|
|
|
|
state: directory
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Create thermostat container
|
|
|
|
containers.podman.podman_container:
|
|
|
|
name: thermostat
|
2024-06-09 08:21:35 +00:00
|
|
|
image: "localhost/thermostat:{{ commit }}"
|
2024-06-08 19:45:32 +00:00
|
|
|
network:
|
|
|
|
- host
|
|
|
|
env:
|
|
|
|
TZ: "Europe/Paris"
|
|
|
|
GUNICORN_CMD_ARGS: "--bind=0.0.0.0:3002"
|
|
|
|
privileged: true
|
|
|
|
restart_policy: always
|
|
|
|
volume:
|
|
|
|
- /usr/local/docker-mounted-files/docker-thermostat/conf.yml:/root/conf.yml
|
|
|
|
- /mnt/apps/volumes/thermostat:/root/instance
|
|
|
|
- /run/udev:/run/udev
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Prune images
|
|
|
|
containers.podman.podman_prune:
|
|
|
|
image: true
|
2024-06-09 08:21:35 +00:00
|
|
|
dangling_only: false
|
2024-06-08 19:45:32 +00:00
|
|
|
become: true
|