---
# HAProxy main task
- name: Install HAProxy
  apt:
    name: haproxy
    state: installed
    update_cache: yes

  tags: haproxy

- name: Set HAProxy SSL cert file
  copy: 
    src: "{{ haproxy_ssl_certfile }}"
    dest: "{{ haproxy_ssl_path }}"
    owner: "root"
    group: "root"
    mode: 0644
  tags: haproxy

- name: Set HAProxy rsyslog configuration
  template:
    src: haproxy.conf.j2
    dest: /etc/rsyslog.d/49-haproxy.conf
  notify: restart rsyslog
  tags: haproxy

- name: Set HAProxy log permissions
  file:
    dest: "{{ haproxy_accesslog_filename }}"
    mode: 0644
  tags: haproxy

- name: Set HAProxy configuration
  template:
    src: haproxy.cfg.j2
    dest: /etc/haproxy/haproxy.cfg
    mode: 0644
    validate: haproxy -f %s -c -q
  notify: restart haproxy
  tags: haproxy

---
# HAProxy main task
- name: Install HAProxy
  apt:
    name: haproxy
    state: installed
    update_cache: yes

  tags: haproxy

- name: Set HAProxy SSL cert file
  copy: 
    src: "{{ haproxy_ssl_certfile }}"
    dest: "{{ haproxy_ssl_path }}"
    owner: "root"
    group: "root"
    mode: 0644
  tags: haproxy

- name: Set HAProxy rsyslog configuration
  template:
    src: haproxy.conf.j2
    dest: /etc/rsyslog.d/49-haproxy.conf
  notify: restart rsyslog
  tags: haproxy

- name: Set HAProxy log permissions
  file:
    dest: "{{ haproxy_accesslog_filename }}"
    state: touch
    mode: 0644
  tags: haproxy

- name: Set HAProxy configuration
  template:
    src: haproxy.cfg.j2
    dest: /etc/haproxy/haproxy.cfg
    mode: 0644
    validate: haproxy -f %s -c -q
  notify: restart haproxy
  tags: haproxy

Set touch state in access log file of haproxy ansible role
Set touch state in access log file of haproxy ansible role
