---
# main tasks for running graylog on a docker host

# configure host for graylog
# create folders for certs, data,
- name: create data folders (/opt/dkregistry)
  run_once: true
  file:
    path: "{{ item }}"
    state: directory
    owner: root
    group: docker
    mode: 0777
  with_items:
    - /opt/shared/graylog/config
    - /opt/shared/graylog/data/config
    - /opt/shared/graylog/data/elasticsearch
    - /opt/shared/graylog/data/journal
    - /opt/shared/graylog/data/mongo

- name: install default config files
  run_once: true
  copy:
    src: "{{ item }}"
    dest: "/opt/shared/graylog/config/{{ item }}"
  with_items:
    - graylog.conf
    - log4j2.xml

# setup graylog docker service
#- name: run docker up
#  shell: "DOCKER_HOST=dkhost03:2376 docker stack deploy -c docker-compose.yml graylog"
#  run_once: true
#  args:
#    chdir: roles/docker_graylog/files
