Skip to content
Snippets Groups Projects
Forked from infrastruktur / ansible-warpzone
752 commits behind the upstream repository.
main.yml 1.70 KiB
---

- include_tasks: ../functions/get_secret.yml
  with_items:
  - { path: "{{ basedir }}/wlan_pass", length: -1 }

- name: "create folder struct for {{ servicename }}"
  file: 
    path: "{{ item }}"
    state: "directory"
  with_items:
    - "{{ basedir }}/"
    - "{{ basedir }}/config/"
    - "{{ basedir }}/config/components/"
    - "{{ basedir }}/config/components/frekvens_panel/"

- name: "copy  files for {{ servicename }}"
  copy: 
    src: "{{ item }}" 
    dest: "{{ basedir }}/{{ item }}"
  with_items: 
    - config/04B03.ttf
  register: config

- name: "create config files for {{ servicename }}"
  template: 
    src: "{{ item }}" 
    dest: "{{ basedir }}/{{ item }}"
  with_items: 
    - docker-compose.yml
    - compile.sh
    - config/esphome_alarm.yaml
    - config/esphome_dach.yaml
    - config/esphome_display01.yaml
    - config/esphome_display02.yaml
    - config/esphome_feinstaub01.yaml
    - config/esphome_hauptraum.yaml
    - config/esphome_holzwerkstatt.yaml
    - config/esphome_kamin.yaml
    - config/esphome_kuehlschrank.yaml
    - config/esphome_lounge.yaml
    - config/esphome_luftfilter01.yaml
    - config/esphome_strommesser.yaml
    - config/esphome_vortragsraum.yaml
  register: config

- name: download config includes files (esphome)
  get_url:
    url: "https://raw.githubusercontent.com/esphome/esphome-docs/current/_static/{{ item }}" 
    dest: "{{ basedir }}/config/{{ item }}"
  with_items:
    - webserver-v1.min.css
    - webserver-v1.min.js

- name: "stop {{ servicename }} docker"
  docker_compose:
    project_src: "{{ basedir }}"
    state: absent
  when: config.changed

- name: "start {{ servicename }} docker"
  docker_compose:
    project_src: "{{ basedir }}"
    state: present