- name: Directories are present
  file:
    dest: "{{ item }}"
    state: directory
    owner: vagrant
  with_items: "{{ directories }}"
  tags: [haproxy]

- name: Files are present
  copy:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
  with_items: "{{ files }}"
  register: result
  tags: [haproxy]

- name: Container is running
  docker:
    image: million12/haproxy
    name: haproxy
    state: running
    ports: "{{ ports }}"
    volumes: /data/haproxy/config/:/etc/haproxy/
  tags: [haproxy]

- name: Directories are present
  file:
    dest: "{{ item }}"
    state: directory
    owner: vagrant
  with_items: "{{ directories }}"
  tags: [haproxy]

- name: Files are present
  copy:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
  with_items: "{{ files }}"
  register: result
  tags: [haproxy]

- name: Container is running
  docker:
    image: million12/haproxy
    name: haproxy
    state: running
    ports: "{{ ports }}"
    volumes: /data/haproxy/config/:/etc/haproxy/
    cap_add: NET_ADMIN
  tags: [haproxy]

Add NET_ADMIN capability to haproxy
Add NET_ADMIN capability to haproxy

million12/haproxy requires NET_ADMIN since ead207ddf282ecf4b7503d28662601ea663fc030.

Add NET_ADMIN to cap_add to stop the warning:
"Please enable NET_ADMIN capabilities by passing '--cap-add NET_ADMIN' parameter to docker run command"