- name: create caliopen configuration directory
  file:
    path: /etc/caliopen/notifiers
    state: directory

- name: api configuration file
  template: src=caliopen-api.yaml.j2 dest=/etc/caliopen/caliopen-api.yaml
  tags:
    - deploy

- name: install swagger.json
  copy:
    src: "{{ dist_directory }}/{{ caliopen_version }}/swagger.json"
    dest: /etc/caliopen/swagger.json
    mode: 0644
  tags:
    - deploy

- name: install notifiers templates
  copy:
    src: notifiers/templates
    dest: /etc/caliopen/notifiers

- name: copy caliopen binary
  copy:
    src: "{{ dist_directory }}/{{ caliopen_version }}/{{ item }}"
    dest: /usr/local/bin
    mode: 0711
  with_items:
    - caliopen_rest
  tags:
    - deploy

- name: install caliopen api as a systemd service
  template: src=caliopen-api.service.j2 dest=/etc/systemd/system/caliopen-api.service

- name: enable caliopen api service
  shell: systemctl enable caliopen-api.service

- name: start caliopen api service
  shell: systemctl start caliopen-api.service

- name: create caliopen configuration directory
  file:
    path: /etc/caliopen/notifiers
    state: directory
  tags:
    - deploy

- name: api configuration file
  template: src=caliopen-api.yaml.j2 dest=/etc/caliopen/caliopen-api.yaml
  tags:
    - deploy

- name: install swagger.json
  copy:
    src: "{{ dist_directory }}/{{ caliopen_version }}/swagger.json"
    dest: /etc/caliopen/swagger.json
    mode: 0644
  tags:
    - deploy

- name: install notifiers templates
  copy:
    src: notifiers/templates
    dest: /etc/caliopen/notifiers
  tags:
    - deploy

- name: copy caliopen binary
  copy:
    src: "{{ dist_directory }}/{{ caliopen_version }}/{{ item }}"
    dest: /usr/local/bin
    mode: 0711
  with_items:
    - caliopen_rest
  tags:
    - deploy

- name: install caliopen api as a systemd service
  template: src=caliopen-api.service.j2 dest=/etc/systemd/system/caliopen-api.service

- name: enable caliopen api service
  shell: systemctl enable caliopen-api.service

- name: start caliopen api service
  shell: systemctl start caliopen-api.service

Include notifier templates tasks in deploy tag
Include notifier templates tasks in deploy tag
