---
# Install Haproxy
- name: Installing Haproxy
  apt:
    update_cache: yes
    state: present
    name: haproxy

# Ensure /etc/haproxy/ssl/certs exists
- name: Creating /etc/haproxy/ssl/certs
  file:
    path: /etc/haproxy/ssl/certs
    state: directory
    owner: root
    group: root

# Copy /etc/rsyslog.conf
- name: Copying /etc/rsyslog.conf
  copy:
    src: rsyslog.conf
    dest: /etc/rsyslog.conf
    owner: root
    group: root
    mode: '0644' # -rw-r--r--
  notify: restart rsyslog

# Copy /etc/rsyslog.d/49-haproxy.conf
# Generic roles should never apply "default" configs, but this one is OK as every instance will inherit this rsyslog setting
- name: Copying /etc/rsyslog.d/49-haproxy.conf
  copy:
    src: 49-haproxy.conf
    dest: /etc/rsyslog.d/49-haproxy.conf
    owner: root
    group: root
    mode: '0644' # -rw-r--r--
  notify: restart rsyslog

# Copy scripts to /usr/local/bin
- include_tasks: ../../shared/functions/copy_usr-local-bin.yml
