# This role prepares a runit folder structure.
# The run script itself has to be written by
# the caller.
---
- name: Create runit service directory
  file:
    path=/etc/sv/{{runit_name}}/log
    state=directory

- name: Create runit supervise directory
  file:
    path={{item}}
    state=directory
    mode=0700
  with_items:
    - "/etc/sv/{{runit_name}}/supervise"
    - "/etc/sv/{{runit_name}}/log/supervise"

- name: Create runit log run script
  template:
    src=log-run.j2
    dest=/etc/sv/{{runit_name}}/log/run
    mode=0755
  notify: restart {{runit_name}}

- name: Log to central loghost
  template:
    src=log-config.j2
    dest=/var/log/{{runit_name}}/config
    mode=0644
  when: rsyslog_central_host_port is defined
  notify: restart {{runit_name}}/log

- name: Link service
  file:
    src=/etc/sv/{{runit_name}}
    dest=/etc/service/{{runit_name}}
    state=link

# This role prepares a runit folder structure.
# The run script itself has to be written by
# the caller.
---
- name: Create runit service directory
  file:
    path=/etc/sv/{{runit_name}}/log
    state=directory

- name: Create runit supervise directory
  file:
    path={{item}}
    state=directory
    mode=0700
  with_items:
    - "/etc/sv/{{runit_name}}/supervise"
    - "/etc/sv/{{runit_name}}/log/supervise"

- name: Create runit log run script
  template:
    src=log-run.j2
    dest=/etc/sv/{{runit_name}}/log/run
    mode=0755
  notify: restart {{runit_name}}

- name: Log to central loghost
  template:
    src=log-config.j2
    dest=/var/log/{{runit_name}}/config
    mode=0644
  when: (rsyslog_remote is defined and rsyslog_remote != False) rsyslog_central_host_port is defined
  notify: restart {{runit_name}}/log

- name: Disable logging to central loghost
  file:
    path=/var/log/{{runit_name}}/config
    state=absent
  when: rsyslog_remote is defined and rsyslog_remote == False
  notify: restart {{runit_name}}/log

- name: Link service
  file:
    src=/etc/sv/{{runit_name}}
    dest=/etc/service/{{runit_name}}
    state=link

Allow to disable logging for specified services
Allow to disable logging for specified services
