ansible-role-knx-monitor/tasks/main.yml

57 lines
1.6 KiB
YAML
Raw Normal View History

2022-12-19 16:11:10 +01:00
---
# tasks file for knx monitor
- name: Create configuration directory
ansible.builtin.file:
state: directory
path: "{{ item }}"
owner: "{{ ansible_effective_user_id }}"
group: "{{ ansible_effective_group_id }}"
mode: "0750"
with_items:
- "{{ knx_monitor.config_path | expanduser | realpath }}"
tags:
- configuration
- name: Print the gateway for each host when defined
ansible.builtin.debug:
msg: Source {{ knx_monitor.topology_source }} to {{ knx_monitor.config_path | expanduser | realpath }}/export-addresses.csv
- name: Copy knx-monitor docker-compose template.
ansible.builtin.template:
src: templates/docker-compose.yml.j2
dest: "{{ knx_monitor.config_path | expanduser | realpath }}/docker-compose.yml"
mode: '0640'
become: false
notify: Restart knx-monitor
tags:
- configuration
- name: Copy topology file
ansible.builtin.copy:
src: "{{ knx_monitor.topology_source }}"
dest: "{{ knx_monitor.config_path | expanduser | realpath }}/export-addresses.csv"
owner: "{{ ansible_effective_user_id }}"
group: "{{ ansible_effective_group_id }}"
mode: '0644'
tags:
- configuration
- name: Copy knx-monitor configuration.
ansible.builtin.template:
src: templates/env.knx-monitor.conf.j2
dest: "{{ knx_monitor.config_path | expanduser | realpath }}/env.knx-monitor.conf"
mode: '0640'
become: false
notify: Restart knx-monitor
tags:
- configuration
- name: Ensure knx-monitor is running.
community.docker.docker_compose:
project_src: "{{ knx_monitor.config_path | expanduser | realpath }}"
build: false
become: false